Skip to content

Commit

Permalink
[#368] Ported revision history page to new template system
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed Mar 6, 2013
1 parent c19b6ae commit f9ad67d
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ckan/templates/package/history.html
@@ -0,0 +1,12 @@
{% extends "package/read_base.html" %}

{% block subtitle %}{{ _('History') }} - {{ c.pkg_dict.title or c.pkg_dict.name }}{% endblock %}

{% block primary_content_inner %}
<section class="module-content">
<h1 class="hide-heading">{{ _('History') }}</h1>
{% block package_history_revisions %}
{% snippet "package/snippets/history_revisions.html", pkg_dict=pkg, pkg_revisions=c.pkg_revisions %}
{% endblock %}
</section>
{% endblock %}
12 changes: 12 additions & 0 deletions ckan/templates/package/snippets/history_revisions.html
@@ -0,0 +1,12 @@
{% import 'macros/form.html' as form %}

<form class="dataset-form dataset-resource-form form-horizontal" method="post" data-module="basic-form">

{{ form.errors(error_summary) }}

<input type="hidden" name="pkg_name" value="{{ pkg_dict.name }}"/>
{% snippet 'package/snippets/revisions_table.html', pkg_dict=pkg_dict, pkg_revisions=pkg_revisions %}

<button class="btn btn-primary" name="diff" value="go-resources" type="submit">{{ _('Compare') }}</button>

</form>
31 changes: 31 additions & 0 deletions ckan/templates/package/snippets/revisions_table.html
@@ -0,0 +1,31 @@
{% import 'macros/form.html' as form %}

<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th></th>
<th>{{ _('Revision') }}</th>
<th>{{ _('Timestamp') }}</th>
<th>{{ _('Author') }}</th>
<th>{{ _('Log Message') }}</th>
</tr>
</thead>
<tbody>
{% for rev in pkg_revisions %}
<tr>
<td nowrap="nowrap">
{{ h.radio('selected1', rev.id, checked=(loop.first)) }}
{{ h.radio('selected2', rev.id, checked=(loop.last)) }}
</td>
<td class="dataset-label">
<a href="{{ h.url_for(controller='revision', action='read', id=rev.id) }}">{{rev.id[:4]}}&#8230;</a>
</td>
<td class="dataset-details">
<a href="{{ h.url_for(controller='package', action='read',id='%s@%s' % (pkg_dict.name, rev.timestamp))}}" title="{{_('Read dataset as of %s') % rev.timestamp }}">{{ h.render_datetime(rev.timestamp, with_hours=True) }}</a>
</td>
<td class="dataset-details">{{ h.linked_user(rev.author) }}</td>
<td class="dataset-details">{{ rev.message }}</td>
</tr>
{% endfor %}
</tbody>
</table>

0 comments on commit f9ad67d

Please sign in to comment.