Skip to content

Commit

Permalink
[#1102] Improves the groups list within package template
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmartin committed Oct 1, 2013
1 parent bfad157 commit d4cd290
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
6 changes: 5 additions & 1 deletion ckan/templates/group/snippets/group_item.html
Expand Up @@ -11,7 +11,8 @@
{% endfor %}
</ul>
#}
{% set url = h.url_for(group.type ~ '_read', action='read', id=group.name) %}
{% set type = group.type or 'group' %}
{% set url = h.url_for(type ~ '_read', action='read', id=group.name) %}
<li class="media-item">
{% block image %}
<img src="{{ group.image_url or '/base/images/placeholder-group.png' }}" alt="{{ group.name }}" class="media-image">
Expand All @@ -36,6 +37,9 @@ <h3 class="media-heading">{{ group.display_name }}</h3>
<a href="{{ url }}" title="{{ _('View {name}').format(name=group.display_name) }}" class="media-view">
<span>{{ _('View {name}').format(name=group.display_name) }}</span>
</a>
{% if group.user_member %}
<button name="group_removed" value="{{ group.id }}" type="submit" class="btn btn-danger btn-small media-edit" title="{{ _('Remove this group from dataset') }}">{{ _('Remove') }}</button>
{% endif %}
</li>
{% if position is divisibleby 3 %}
<li class="clearfix js-hide"></li>
Expand Down
41 changes: 18 additions & 23 deletions ckan/templates/package/group_list.html
@@ -1,32 +1,27 @@
{% import 'macros/form.html' as form %}
{% extends "package/read_base.html" %}
{% import 'macros/form.html' as form %}

{% block primary_content_inner %}
<h2 class="hide-heading">{% block page_heading %}{{ _('Groups {dataset} belongs to.').format(dataset=h.dataset_display_name(c.pkg)) }}{% endblock %}</h2>
<h2 class="hide-heading">{{ _('Groups') }}</h2>

{% if c.group_dropdown %}
<form class="module-content form-horizontal" method='post'>
<select id="field-add_group" name="group_added">
{% for option in c.group_dropdown %}
<option value="{{ option[0] }}"> {{ option[1] }}</option>
{% endfor %}
</select>
<button type="submit"> <span>Add Group</span></button>
</form>
<form method="post" class="form-horizontal">
{#'data-module': ''#}
<select id="field-add_group" name="group_added" data-module="autocomplete">
{% for option in c.group_dropdown %}
<option value="{{ option[0] }}"> {{ option[1] }}</option>
{% endfor %}
</select>
<button type="submit" class="btn btn-primary" title="{{ _('Associate this group with this dataset') }}">{{ _('Add group') }}</button>
</form>
{% endif %}

<ul class="unstyled">
{% for group in c.pkg_dict.groups %}
<li class="dataset-item"> {{group.display_name}}
<form class="unstyled" method='post'>
{% if group.user_member %}
<button name="group_removed" value="{{group.id}}" type="submit"> <span>Remove Group</span> </button>
{% endif %}
</form>
</li>

{% endfor %}
</ul>

{% if c.pkg_dict.groups %}
<form method="post">
{% snippet 'group/snippets/group_list.html', groups=c.pkg_dict.groups %}
</form>
{% else %}
<p class="empty">{{ _('There are no groups associated with this dataset') }}</p>
{% endif %}

{% endblock %}

0 comments on commit d4cd290

Please sign in to comment.