Source

moin-2.0 / MoinMoin / templates / utils.html

Full commit
psviderski 72ec4f9 

Akash Sinha 08e3faf 
Thomas Waldmann 5568cf1 













Thomas Waldmann 2e07666 

Thomas Waldmann 9a7889c 

Akash Sinha 08e3faf 



Roger Haase 9a6a2ea 
Julian Brost f2d8c60 
Thomas Waldmann 2e07666 


Roger Haase 4f3ea3b 




Thomas Waldmann 2e07666 






Roger Haase ce5454f 

Roger Haase 9a6a2ea 



Roger Haase ce5454f 


Thomas Waldmann 2e07666 






xiaq d697fd1 
Sam Toyer 4b68cc7 
xiaq d697fd1 
Sam Toyer 4b68cc7 



xiaq d697fd1 
Sam Toyer 4b68cc7 
xiaq d697fd1 



Sam Toyer 784beae 
Jaiditya f696584 
xiaq d697fd1 
Sam Toyer 4b68cc7 





Roger Haase 7f04d45 



Sam Toyer 4b68cc7 





Roger Haase ce5454f 
Sam Toyer 4b68cc7 

Sam Toyer 8f73b05 
Sam Toyer 4b68cc7 
Sam Toyer 8f73b05 
psviderski 72ec4f9 








{% import 'forms.html' as forms %}

{% macro show_editor_info(info) %}
  {%- if info.uri -%}
      <a href="{{ info.uri }}" class="{{ info.css }}" title="{{ info.title }}">
  {%- elif info.email -%}
      <a href="mailto:{{ info.email }}" class="{{ info.css }}" title="{{ info.title }}">
  {%- else -%}
      <span class="{{ info.css }}" title="{{ info.title }}">
  {%- endif -%}
  {{ info.text }}
  {%- if info.uri or info.email -%}
    </a>
  {%- else -%}
    </span>
  {%- endif -%}
{% endmacro %}


{% macro editor_info(meta) %}
  {%- set info = get_editor_info(meta) -%}
  {{ show_editor_info(info) }}
{% endmacro %}


{% macro table(headings, rows, itemname_cols=[], url_cols=[]) %}
<table class="zebra">
<thead>
    <tr>
        {% for heading in headings %}
            {% if rows and rows[0][loop.index0] is number %}
                <th class="moin-integer">{{ heading }}</th>
            {% else %}
                <th>{{ heading }}</th>
            {% endif %}
        {% endfor %}
    </tr>
</thead>
<tbody>
{% for row in rows %}
    <tr>
        {% for col in row %}
            {% if col is number %}
                <td class="moin-integer">{{ col }}</td>
            {% elif loop.index in itemname_cols %}
                <td><a href="{{ url_for('frontend.show_item', item_name=col) }}">{{ col }}</a></td>
            {% elif loop.index in url_cols %}
                <td><a href="{{ col }}">{{ col }}</a></td>
            {%- else -%}
                <td>{{ col }}</td>
            {% endif %}
        {% endfor %}
    </tr>
{% endfor %}
</tbody>
</table>
{% endmacro %}

{% macro _render_subitem_navigation_tree(index, newtab, parentcaller) %}
    <ul>
        {% for e in index %}
            <li>
                {# call our parent's caller with all the data we have if they exist, used to implement
                    transclude/link actions in the modify view #}
                {% if parentcaller %}
                    {{ parentcaller(e.meta['name'], e.relname, e.meta['contenttype'], e.hassubitems) }}
                {% endif %}
                <a href="{{ url_for('frontend.show_item', item_name=e.meta['name']) }}"
                    title="{{ e.relname }}" class="subitem-link"
                    {% if newtab %}target="_blank"{% endif %}>{{ e.relname }}</a>
                {% if e.hassubitems %}
                    <button class="expander" title="{{ _('Expand Subitem') }}"
                        onclick="toggleSubtree(this)"></button>
                    {{ _render_subitem_navigation_tree(theme_supp.subitem_index(e.meta['name']), newtab, parentcaller) }}
                {% endif %}
            </li>
        {% endfor %}
    </ul>
{% endmacro %}

{% macro render_subitem_navigation(itemname, newtab, subitems=None) %}
    {% if not subitems %}
        {% set subitems = theme_supp.subitem_index(itemname) %}
    {% endif %}
    {% if caller %}
        {% set mycaller = caller %}
    {% endif %}
    {% if subitems %}
        <div class="moin-subitem-navigation">
            <div class="list-header">
                {{ _('Subitems') }}
            </div>
            {{ _render_subitem_navigation_tree(subitems, newtab, mycaller) }}
        </div>
    {% endif %}
{% endmacro %}

{% macro header_search(form) %}
    {{ gen.form.open(form, id='moin-searchform', method='get', action=url_for('frontend.search')) }}
        <div>
            {{ forms.render(form['q']) }}
            {{ gen.button(form['submit'], type='submit', id='moin-search-submit') }}
            {{ forms.render_errors(form) }}
        </div>
    {{ gen.form.close() }}
{% endmacro %}