Skip to content

Commit

Permalink
[2570] Add "Back to Dataset" buttons to relevant pages
Browse files Browse the repository at this point in the history
  • Loading branch information
aron committed Jun 19, 2012
1 parent 73fe36c commit a3939a4
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 22 deletions.
4 changes: 4 additions & 0 deletions ckan/templates/package/edit.html
Expand Up @@ -8,4 +8,8 @@
<li class="active">{% link_for _('Edit Dataset'), controller='package', action='edit', id=pkg.name %}</li>
{% endblock %}

{% block actions_content %}
{% snippet 'package/snippets/back_to_package_action.html', pkg=pkg %}
{% endblock %}

{% block stages %}{% endblock %}
34 changes: 18 additions & 16 deletions ckan/templates/package/read.html
@@ -1,17 +1,19 @@
{% extends "page.html" %}

{% block title %}{{ c.pkg_dict.title or c.pkg_dict.name }} - {{ super() }}{% endblock %}
{% set pkg = c.pkg_dict %}

{% block title %}{{ pkg.title or pkg.name }} - {{ super() }}{% endblock %}

{% block breadcrumb_content %}
{% set dataset = c.pkg_dict.title or c.pkg_dict.name %}
{% set dataset = pkg.title or pkg.name %}
<li>{% link_for _('Datasets'), controller='package', action='search', highlight_actions = 'new index' %}</li>
<li class="active"><a href="" title="{{ dataset }}">{{ dataset|truncate(35) }}</a></li>
{% endblock %}

{% block actions_content %}
<li>{% link_for _('Related'), controller='package', action='related', id=c.pkg.id, class_='btn', icon='picture' %}</li>
<li>{% link_for _('History'), controller='package', action='history', id=c.pkg.id, class_='btn', icon='undo' %}</li>
<li>{% link_for _('Edit'), controller='package', action='edit', id=c.pkg.id, class_='btn', icon='wrench', condition=h.check_access('package_update',{'id':c.pkg.id }) %}</li>
<li>{% link_for _('Related'), controller='related', action='list', id=pkg.name, class_='btn', icon='picture' %}</li>
<li>{% link_for _('History'), controller='package', action='history', id=pkg.name, class_='btn', icon='undo' %}</li>
<li>{% link_for _('Edit'), controller='package', action='edit', id=pkg.name, class_='btn', icon='wrench', condition=h.check_access('package_update',{'id':pkg.id }) %}</li>
<li><a class="btn" href=""><i class="icon-large icon-flag"></i> Report Issue</a></li>
{% endblock %}

Expand All @@ -20,7 +22,7 @@
<div class="widget info">
<p class="content">
{% set timestamp = h.render_datetime(c.pkg_revision_timestamp, with_hours=True) %}
{% set url = h.url(controller='package', action='read', id=c.pkg.name) %}
{% set url = h.url(controller='package', action='read', id=pkg.name) %}

{% if c.pkg_revision_not_latest %}
{% trans timestamp=timestamp, url=url %}This is an old revision of this dataset, as edited at {{ timestamp }}. It may differ significantly from the <a href="{{ url }}">current revision</a>.{% endtrans %}
Expand All @@ -33,7 +35,7 @@

<article class="module prose">
<section class="content">
<h1>{{ c.pkg_dict.title or c.pkg_dict.name }}</h1>
<h1>{{ pkg.title or pkg.name }}</h1>
{% if c.pkg_notes_formatted %}
<div class="notes">
{{ c.pkg_notes_formatted }}
Expand All @@ -44,39 +46,39 @@ <h1>{{ c.pkg_dict.title or c.pkg_dict.name }}</h1>

<section id="dataset-resources" class="resources content">
<h3>Data and Resources</h3>
{% if c.pkg_dict.resources %}
{% if pkg.resources %}
<ul class="resource-list">
{% for res in c.pkg_dict.resources %}
{% snippet 'package/snippets/resource_item.html', pkg=c.pkg_dict, res=res %}
{% for res in pkg.resources %}
{% snippet 'package/snippets/resource_item.html', pkg=pkg, res=res %}
{% endfor %}
</ul>
{% else %}
<p>
{% trans url=h.url_for(controller='package', action='new_resource', id=c.pkg_dict.name) %}
{% trans url=h.url_for(controller='package', action='new_resource', id=pkg.name) %}
This dataset has no data, <a href="{{ url }}">why not add some?</a>
{% endtrans %}
</p>
{% endif %}
</section>

{{ h.snippet('package/snippets/tags.html', tags=c.pkg_dict.tags) }}
{{ h.snippet('package/snippets/tags.html', tags=pkg.tags) }}

{{ h.snippet('package/snippets/additional_info.html', pkg_dict=c.pkg_dict) }}
{{ h.snippet('package/snippets/additional_info.html', pkg_dict=pkg) }}
</article>
{% endblock %}

{% block secondary_content %}
{% for group in c.pkg_dict.groups %}
{% for group in pkg.groups %}
{{ h.snippet('snippets/group.html', group=group) }}
{% endfor %}

{{ h.snippet('snippets/subscribe.html') }}

{{ h.snippet('snippets/social.html') }}

{{ h.snippet('snippets/related.html', pkg=c.pkg) }}
{{ h.snippet('snippets/related.html', pkg=pkg) }}

{{ h.snippet('snippets/license.html', pkg_dict=c.pkg_dict) }}
{{ h.snippet('snippets/license.html', pkg_dict=pkg) }}

{{ h.snippet('snippets/disqus_trackback.html') }}
{% endblock %}
10 changes: 6 additions & 4 deletions ckan/templates/package/related_list.html
@@ -1,21 +1,23 @@
{% extends "page.html" %}

{% set pkg = c.pkg %}

{% block breadcrumb_content %}
<li>{% link_for _('Datasets'), controller='package', action='search', highlight_actions = 'new index' %}</li>
<li>{% link_for h.truncate(h.dataset_display_name(c.pkg), 30), controller='package', action='read', id=c.pkg.name %}</li>
<li>{% link_for h.truncate(h.dataset_display_name(pkg), 30), controller='package', action='read', id=c.pkg.name %}</li>
<li class="active"><a href="">{{ _('Related') }}</a></li>
{% endblock %}

{% block actions_content %}
<li>{% link_for _('Back to dataset'), controller='package', action='read', id=c.pkg.name, class_='btn', icon='caret-left' %}</li>
<li>{% link_for _('Add Item'), controller='related', action='new', id=c.pkg.name, class_='btn', icon='plus' %}</li>
{% snippet 'package/snippets/back_to_package_action.html', pkg=pkg %}
<li>{% link_for _('Add Item'), controller='related', action='new', id=pkg.name, class_='btn', icon='plus' %}</li>
{% endblock %}

{% block primary_content %}
<div class="module">
<div class="content">
<h1 class="page-heading">{{ _('Related Media for {dataset}').format(dataset=h.dataset_display_name(c.pkg)) }}</h1>
{% if c.pkg.related %}
{% if pkg.related %}
{% include "related/partials/related_list.html" %}
{% else %}
<p class="empty">No related items</p>
Expand Down
7 changes: 5 additions & 2 deletions ckan/templates/package/resource_read.html
@@ -1,5 +1,7 @@
{% extends "page.html" %}

{% set pkg = c.pkg_dict %}

{% block title %}{{ h.dataset_display_name(c.package) }} - {{ h.resource_display_name(c.resource) }} - {{ super() }}{% endblock %}

{% block breadcrumb_content %}
Expand All @@ -10,6 +12,7 @@

{% block actions_content %}
{% if c.resource.url %}
{% snippet 'package/snippets/back_to_package_action.html', pkg=pkg %}
<li>
<a class="btn resource-url-analytics resource-type-{{ c.resource.resource_type }}" href="{{ c.resource.url }}">
{% if c.resource.resource_type in ('listing', 'service') %}
Expand Down Expand Up @@ -76,7 +79,7 @@ <h2>Additional Information</h2>
</tr>
<tr>
<th>Licence</th>
<td>{{ h.snippet('snippets/license.html', pkg_dict=c.pkg_dict, text_only=True) }}</td>
<td>{{ h.snippet('snippets/license.html', pkg_dict=pkg, text_only=True) }}</td>
</tr>
</tbody>
</table>
Expand All @@ -96,7 +99,7 @@ <h2 class="heading"><i class="icon-large icon-info-sign"></i> Resource Informati
<ul class="simple-list">
<li><i class="ckan-icon ckan-icon-calendar"></i> Unknown</li>
<li><i class="ckan-icon ckan-icon-file"></i> CSV</li>
<li><i class="ckan-icon ckan-icon-lock"></i> {{ h.snippet('snippets/license.html', pkg_dict=c.pkg_dict, text_only=True) }}</li>
<li><i class="ckan-icon ckan-icon-lock"></i> {{ h.snippet('snippets/license.html', pkg_dict=pkg, text_only=True) }}</li>
</ul>
</section>

Expand Down
@@ -0,0 +1 @@
<li>{% link_for _('Back to dataset'), controller='package', action='read', id=pkg.name, class_='btn', icon='caret-left' %}</li>

0 comments on commit a3939a4

Please sign in to comment.