comparison MoinMoin/templates/index.html @ 1829:6ef26d1fa2fe

Use different macros for dir and file in index, make dir items link to +index view instead of +show
author Cheer Xiao <xiaqqaix@gmail.com>
date Fri, 05 Oct 2012 11:13:28 +0800
parents 54062fc0ca97
children 9e8e47fd8fba
comparison
equal deleted inserted replaced
1828:12053b28483d 1829:6ef26d1fa2fe
67 <div class="moin-align-right"> 67 <div class="moin-align-right">
68 {{ self.action_bars_inner() }} 68 {{ self.action_bars_inner() }}
69 </div> 69 </div>
70 {% endblock %} 70 {% endblock %}
71 71
72 {% macro render_entry(e) %} 72 {% set maxchars = 20 %}
73 {% set maxchars = 20 %} 73
74 {% macro render_dir_entry(e) %}
75 <div>
76 <a href="{{ url_for('.index', item_name=e.meta['name']) }}"
77 {# TODO .moin-dir-item class is not styled yet #}
78 class="moin-dir-item"
79 title="{{ e.relname }}">
80 {{ e.relname|truncate(maxchars, true, '..') }}
81 </a>
82 </div>
83 {% endmacro %}
84
85 {% macro render_file_entry(e) %}
74 <div> 86 <div>
75 <span class="moin-select-item">&nbsp;</span> 87 <span class="moin-select-item">&nbsp;</span>
76 {% set mimetype = "application/x.moin.download" %} 88 {% set mimetype = "application/x.moin.download" %}
77 <a href="{{ url_for('.download_item', item_name=e.meta['name'], mimetype=mimetype) }}" class="moin-download-link"> 89 <a href="{{ url_for('.download_item', item_name=e.meta['name'], mimetype=mimetype) }}" class="moin-download-link">
78 </a> 90 </a>
80 {# TODO .moin-itemtype-* classes are not styled yet #} 92 {# TODO .moin-itemtype-* classes are not styled yet #}
81 class="{{ e.meta['contenttype']|contenttype_to_class }} moin-itemtype-{{ e.meta['itemtype'] }} moin-item" 93 class="{{ e.meta['contenttype']|contenttype_to_class }} moin-itemtype-{{ e.meta['itemtype'] }} moin-item"
82 title="{{ e.relname }}"> 94 title="{{ e.relname }}">
83 {{ e.relname|truncate(maxchars, true, '..') }} 95 {{ e.relname|truncate(maxchars, true, '..') }}
84 </a> 96 </a>
85 {% if e.hassubitems %}
86 <a href="{{ url_for('frontend.index', item_name=e.meta['name']) }}"
87 title="{{ _("More") }}"
88 class="moin-more-index">&nbsp;
89 </a>
90 {% endif %}
91 </div> 97 </div>
92 {% endmacro %} 98 {% endmacro %}
93 99
94 {% block content %} 100 {% block content %}
95 <div class="moin-index-message"><span></span></div> 101 <div class="moin-index-message"><span></span></div>
136 </div> 142 </div>
137 {% if dirs %} 143 {% if dirs %}
138 <div class="moin-item-index"> 144 <div class="moin-item-index">
139 <p>{{ _("These items have subitems that match your filter:") }}</p> 145 <p>{{ _("These items have subitems that match your filter:") }}</p>
140 {% for e in dirs %} 146 {% for e in dirs %}
141 {{ render_entry(e) }} 147 {{ render_dir_entry(e) }}
142 {% endfor %} 148 {% endfor %}
143 </div> 149 </div>
144 <div class="moin-clr"></div> 150 <div class="moin-clr"></div>
145 <hr /> 151 <hr />
146 {% endif %} 152 {% endif %}
147 {% if files %} 153 {% if files %}
148 <div class="moin-item-index"> 154 <div class="moin-item-index">
149 {% for e in files %} 155 {% for e in files %}
150 {{ render_entry(e) }} 156 {{ render_file_entry(e) }}
151 {% endfor %} 157 {% endfor %}
152 </div> 158 </div>
153 <div class="moin-clr"></div> 159 <div class="moin-clr"></div>
154 {% endif %} 160 {% endif %}
155 {% endif %} 161 {% endif %}