Skip to content

Commit

Permalink
[#1056] Fix for 500 error on group create page
Browse files Browse the repository at this point in the history
Also fixes for:
* Group/Org edit template: added missing context in sidebar
* Group/Org new template: added missing helper text
* Small template refactors: moving group context info into snippet and also
group/org helpers into snippets
  • Loading branch information
johnmartin committed Jun 27, 2013
1 parent e99500b commit fd05521
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 67 deletions.
2 changes: 1 addition & 1 deletion ckan/templates/group/base_form_page.html
Expand Up @@ -8,7 +8,7 @@
{% endblock %}

{% block primary_content_inner %}
<h1 class="hide-heading">{% block page_heading %}{{ _('Group Form') }}{% endblock %}</h1>
<h1 class="{% block page_heading_class %}page-heading{% endblock %}">{% block page_heading %}{{ _('Group Form') }}{% endblock %}</h1>
{% block form %}
{{ c.form | safe }}
{% endblock %}
Expand Down
1 change: 1 addition & 0 deletions ckan/templates/group/edit.html
Expand Up @@ -10,4 +10,5 @@

{% block subtitle %}{{ _('Edit Group') }}{% endblock %}

{% block page_heading_class %}hide-heading{% endblock %}
{% block page_heading %}{{ _('Edit Group') }}{% endblock %}
6 changes: 5 additions & 1 deletion ckan/templates/group/edit_base.html
@@ -1,4 +1,4 @@
{% extends "group/read_base.html" %}
{% extends "page.html" %}

{% set group = c.group_dict %}

Expand All @@ -18,3 +18,7 @@
{{ h.build_nav_icon('group_edit', _('Edit'), id=c.group_dict.name) }}
{{ h.build_nav_icon('group_members', _('Members'), id=c.group_dict.name) }}
{% endblock %}

{% block secondary_content %}
{% snippet "group/snippets/info.html", group=c.group_dict, show_nums=false %}
{% endblock %}
16 changes: 1 addition & 15 deletions ckan/templates/group/index.html
Expand Up @@ -37,19 +37,5 @@ <h1 class="hide-heading">{{ _('Groups') }}</h1>
{% endblock %}

{% block secondary_content %}
<div class="module module-narrow module-shallow">
<h2 class="module-heading">
<i class="icon-info-sign"></i>
{{ _('What are Groups?') }}
</h2>
<div class="module-content">
{% trans %}
<p>Groups allow you to group together datasets under a community (for
example, Civil Liberty data) or topic (e.g. Transport, Health,
Environment) to make it easier for users to browse datasets by theme.
Datasets can be part of a group, but do not belong to the group for
editing or authorisation purposes.</p>
{% endtrans %}
</div>
</div>
{% snippet "group/snippets/helper.html" %}
{% endblock %}
7 changes: 6 additions & 1 deletion ckan/templates/group/new.html
Expand Up @@ -6,4 +6,9 @@

{% block page_heading %}{{ _('Create a Group') }}{% endblock %}

{% block actions_content %}{% endblock %}
{% block page_header %}{% endblock %}

{% block secondary_content %}
{% snippet "group/snippets/helper.html" %}
{% endblock %}

32 changes: 1 addition & 31 deletions ckan/templates/group/read_base.html
Expand Up @@ -20,37 +20,7 @@
{% endblock %}

{% block secondary_content %}
<div class="module context-info">
<section class="module-content">
<div class="image">
<a href="{{ c.group_dict.url }}">
<img src="{{ c.group_dict.image_url or h.url_for_static('/base/images/placeholder-group.png') }}" width="190" height="118" alt="{{ c.group_dict.name }}" />
</a>
</div>
<h1 class="heading">{{ c.group_dict.display_name }}</h1>
{% if c.group_dict.description %}
<p>
{{ h.markdown_extract(c.group_dict.description, 180) }}
{% link_for _('read more'), controller='group', action='about', id=c.group_dict.name %}
</p>
{% else %}
<p class="empty">{{ _('There is no description for this group') }}</p>
{% endif %}
<div class="nums">
<dl>
<dt>{{ _('Followers') }}</dt>
<dd>{{ h.SI_number_span(c.group_dict.num_followers) }}</dd>
</dl>
<dl>
<dt>{{ _('Datasets') }}</dt>
<dd>{{ h.SI_number_span(c.group_dict.packages|length) }}</dd>
</dl>
</div>
<div class="follow_button">
{{ h.follow_button('group', c.group_dict.id) }}
</div>
</section>
</div>
{% snippet "group/snippets/info.html", group=c.group_dict, show_nums=true %}
{% endblock %}

{% block links %}
Expand Down
15 changes: 15 additions & 0 deletions ckan/templates/group/snippets/helper.html
@@ -0,0 +1,15 @@
<div class="module module-narrow module-shallow">
<h2 class="module-heading">
<i class="icon-info-sign"></i>
{{ _('What are Groups?') }}
</h2>
<div class="module-content">
{% trans %}
<p>Groups allow you to group together datasets under a community (for
example, Civil Liberty data) or topic (e.g. Transport, Health,
Environment) to make it easier for users to browse datasets by theme.
Datasets can be part of a group, but do not belong to the group for
editing or authorisation purposes.</p>
{% endtrans %}
</div>
</div>
33 changes: 33 additions & 0 deletions ckan/templates/group/snippets/info.html
@@ -0,0 +1,33 @@
<div class="module context-info">
<section class="module-content">
<div class="image">
<a href="{{ group.url }}">
<img src="{{ group.image_url or h.url_for_static('/base/images/placeholder-group.png') }}" width="190" height="118" alt="{{ group.name }}" />
</a>
</div>
<h1 class="heading">{{ group.display_name }}</h1>
{% if group.description %}
<p>
{{ h.markdown_extract(group.description, 180) }}
{% link_for _('read more'), controller='group', action='about', id=group.name %}
</p>
{% else %}
<p class="empty">{{ _('There is no description for this group') }}</p>
{% endif %}
{% if show_nums %}
<div class="nums">
<dl>
<dt>{{ _('Followers') }}</dt>
<dd>{{ h.SI_number_span(group.num_followers) }}</dd>
</dl>
<dl>
<dt>{{ _('Datasets') }}</dt>
<dd>{{ h.SI_number_span(group.packages|length) }}</dd>
</dl>
</div>
<div class="follow_button">
{{ h.follow_button('group', group.id) }}
</div>
{% endif %}
</section>
</div>
18 changes: 1 addition & 17 deletions ckan/templates/organization/index.html
Expand Up @@ -37,21 +37,5 @@ <h1 class="hide-heading">{% block page_heading %}{{ _('Organizations') }}{% endb
{% endblock %}

{% block secondary_content %}
<div class="module module-narrow module-shallow">
<h2 class="module-heading">
<i class="icon-info-sign"></i>
{{ _('What are Organizations?') }}
</h2>
<div class="module-content">
{% trans %}
<p>Organizations act like publishing departments for datasets (for
example, the Department of Health). This means that datasets can be
published by and belong to a department instead of an individual
user.</p>
<p>Within organizations, admins can assign roles and authorisation its
members, giving individual users the right to publish datasets from
that particular organisation (e.g. Office of National Statistics).</p>
{% endtrans %}
</div>
</div>
{% snippet "organization/snippets/helper.html" %}
{% endblock %}
6 changes: 5 additions & 1 deletion ckan/templates/organization/new.html
Expand Up @@ -10,4 +10,8 @@

{% block breadcrumb_content_inner %}
<li class="active"><a href="#">{{ _('Create an Organization') }}</a></li>
{% endblock %}
{% endblock %}

{% block secondary_content %}
{% snippet "organization/snippets/helper.html" %}
{% endblock %}
17 changes: 17 additions & 0 deletions ckan/templates/organization/snippets/helper.html
@@ -0,0 +1,17 @@
<div class="module module-narrow module-shallow">
<h2 class="module-heading">
<i class="icon-info-sign"></i>
{{ _('What are Organizations?') }}
</h2>
<div class="module-content">
{% trans %}
<p>Organizations act like publishing departments for datasets (for
example, the Department of Health). This means that datasets can be
published by and belong to a department instead of an individual
user.</p>
<p>Within organizations, admins can assign roles and authorisation its
members, giving individual users the right to publish datasets from
that particular organisation (e.g. Office of National Statistics).</p>
{% endtrans %}
</div>
</div>

0 comments on commit fd05521

Please sign in to comment.