Skip to content

Commit

Permalink
[#2599] Document some of the group snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
aron committed Jun 26, 2012
1 parent 953145f commit e471c30
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
17 changes: 17 additions & 0 deletions ckan/templates/group/snippets/group_item.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
{#
Renders a media item for a group. This should be used in a list.

group - A group dict.
first - Pass true if this is the first item in a row.
last - Pass true if this is the last item in a row.

Example:

<ul class="media-grid">
{% for group in groups %}
{% set first = loop.index0 % 3 == 0 %}
{% set last = loop.index0 % 3 == 2 %}
{% snippet "group/snippets/group_item.html", group=group, first=first, last=last %}
{% endfor %}
</ul>
#}
{% set url = h.url_for(group.type ~ '_read', action='read', id=group.name) %}
<li class="media-item media media-vertical{% if first %} first{% endif %}{% if last %} last{% endif %}">
<a class="media-image" href="{{ url }}"><img src="{{ group.image_url or '/base/images/placeholder-group.png' }}" /></a>
Expand Down
14 changes: 12 additions & 2 deletions ckan/templates/group/snippets/group_list.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
{#
Display a grid of group items.

groups - A list of groups.

Example:

{% snippet "group/snippets/group_list.html" %}

#}
<ul class="media-grid">
{% for group in c.page.items %}
{% for group in groups %}
{% set first = loop.index0 % 3 == 0 %}
{% set last = loop.index0 % 3 == 2 %}
{% include "group/snippets/group_item.html" %}
{% snippet "group/snippets/group_item.html", group=group, first=first, last=last %}
{% endfor %}
</ul>

0 comments on commit e471c30

Please sign in to comment.