Skip to content

Commit

Permalink
[2474] Move group items and item templates into partials
Browse files Browse the repository at this point in the history
  • Loading branch information
aron committed May 30, 2012
1 parent d6ab19b commit 906b526
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
20 changes: 1 addition & 19 deletions ckan/templates/group/index.html
Expand Up @@ -18,25 +18,7 @@
<div class="module">
<div class="content">
<h1>{{ _('Groups') }}</h1>
<ul>
{% for group in c.page.items %}
{% set url = h.url_for(group.type ~ '_read', action='read', id=group.name) %}
<li class="media media-vertical">
<h3 class="heading">
<a href="{{ url }}" title="{{ _('View {name}').format(name=group.display_name) }}">
{{ group.display_name }}
</a>
</h3>
<a class="image" href="{{ url }}"><img src="{{ group.image_url or '/base/images/placeholder-group.png' }}" /></a>
{% if group.description %}
<p>{{ h.truncate(group.description, length=80, whole_word=True) }}</p>
{% else %}
<p class="empty">{{ _('This group has no description') }}</p>
{% endif %}
<a class="btn btn-primary" href="{{ url }}">{{ ungettext('{num} Dataset', '{num} Datasets', group.packages).format(num=group.packages) }}</a>
</li>
{% endfor %}
</ul>
{% include "group/partials/group_list.html" %}
</div>
{{ c.page.pager() }}
</div>
Expand Down
15 changes: 15 additions & 0 deletions ckan/templates/group/partials/group_item.html
@@ -0,0 +1,15 @@
{% set url = h.url_for(group.type ~ '_read', action='read', id=group.name) %}
<li class="media media-vertical">
<h3 class="heading">
<a href="{{ url }}" title="{{ _('View {name}').format(name=group.display_name) }}">
{{ group.display_name }}
</a>
</h3>
<a class="image" href="{{ url }}"><img src="{{ group.image_url or '/base/images/placeholder-group.png' }}" /></a>
{% if group.description %}
<p>{{ h.truncate(group.description, length=80, whole_word=True) }}</p>
{% else %}
<p class="empty">{{ _('This group has no description') }}</p>
{% endif %}
<a class="btn btn-primary" href="{{ url }}">{{ ungettext('{num} Dataset', '{num} Datasets', group.packages).format(num=group.packages) }}</a>
</li>
5 changes: 5 additions & 0 deletions ckan/templates/group/partials/group_list.html
@@ -0,0 +1,5 @@
<ul>
{% for group in c.page.items %}
{% include "group/partials/group_item.html" %}
{% endfor %}
</ul>

0 comments on commit 906b526

Please sign in to comment.