Skip to content

Commit

Permalink
Lot's of tweaks to the group, user and package read pages and new sni…
Browse files Browse the repository at this point in the history
…pper for page_header
  • Loading branch information
johnmartin committed Nov 13, 2012
1 parent 115e703 commit f561cba
Show file tree
Hide file tree
Showing 12 changed files with 321 additions and 297 deletions.
2 changes: 1 addition & 1 deletion ckan/templates/ajax_snippets/popover-context-user.html
Expand Up @@ -12,7 +12,7 @@
<i class="icon-eye-open"></i>
View Profile
</a>
</div>
</div>
<div class="nums">
<dl>
<dt>{{ _('Followers') }}</dt>
Expand Down
1 change: 1 addition & 0 deletions ckan/templates/development/primer.html
Expand Up @@ -33,6 +33,7 @@
{% snippet 'development/snippets/form.html', error=['This field has an error'] %}

<section class="module">
{% snippet 'development/snippets/page_header.html' %}
<div class="module-content">
<h1 class="page-heading">Top level heading (h1)</h1>
<h2>Some Rendered Markdown (h2)</h2>
Expand Down
3 changes: 3 additions & 0 deletions ckan/templates/development/snippets/page_header.html
@@ -0,0 +1,3 @@
{% with items=(("First tab", "#", "info-sign", true), ("Second tab", "#", "info-sign", false) ) %}
{% snippet 'snippets/page_header.html', items=items %}
{% endwith %}
87 changes: 5 additions & 82 deletions ckan/templates/group/read.html
@@ -1,87 +1,10 @@
{% extends "page.html" %}
{% extends "group/read_base.html" %}

{% block subtitle %}{{ c.group_dict.display_name }}{% endblock %}

{% block breadcrumb_content %}
<li>{% link_for _('Groups'), controller='group', action='index' %}</li>
<li class="active">{% link_for c.group_dict.display_name|truncate(35), controller='group', action='read', id=c.group_dict.name %}</li>
{% endblock %}

{% block actions_content %}
{% if h.check_access('group_update', {'id': c.group_dict.id}) %}
<li>{% link_for _('Add Dataset to Group'), controller='package', action='new', group=c.group_dict.id, class_='btn', icon='plus' %}</li>
<li>{% link_for _('Edit'), controller='group', action='edit', id=c.group_dict.name, class_='btn', icon='wrench' %}</li>
{% endif %}
<li>{{ h.follow_button('group', c.group_dict.id) }}</li>
{% endblock %}

{% block primary_content %}
<section class="module">
{% block package_header %}
<header class="module-content page-header">
<ul class="nav nav-tabs">
<li{% if c.action == 'read' %} class="active"{% endif %}>
{% link_for _('Datasets'), controller='group', action='read', id=c.group_dict.name, icon='sitemap' %}
</li>
<li{% if c.action == 'activity' %} class="active"{% endif %}>
{% link_for _('Activity Stream'), controller='group', action='activity', id=c.group_dict.name, icon='time' %}
</li>
<li{% if c.action == 'followers' %} class="active"{% endif %}>
{% link_for _('Followers'), controller='group', action='followers', id=c.group_dict.name, icon='group' %}
</li>
<li{% if c.action == 'admins' %} class="active"{% endif %}>
{% link_for _('Administrators'), controller='group', action='admins', id=c.group_dict.name, icon='cog' %}
</li>
<li{% if c.action == 'about' %} class="active"{% endif %}>
{% link_for _('About'), controller='group', action='about', id=c.group_dict.name, icon='info-sign' %}
</li>
</ul>
</header>
{% endblock %}
{% block primary_content_inner %}
<div class="module-content">
{% include "package/snippets/search_form.html" %}
</div>
{{ c.page.pager(q=c.q) }}
{% endblock %}
</section>
{% endblock %}

{% block secondary_content %}
<div class="module profile-info">
<section class="module-content">
<div class="avatar">
<a href="{{ c.group_dict.url }}">
<img src="{{ c.group_dict.image_url or h.url_for_static('/base/images/placeholder-group.png') }}" width="200" height="125" 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>{{ c.group_dict.num_followers }}</dd>
</dl>
<dl>
<dt>{{ _('Datasets') }}</dt>
<dd>{{ c.group_dict.packages|length }}</dd>
</dl>
</div>
</section>
{% block primary_content_inner %}
<div class="module-content">
{% include "package/snippets/search_form.html" %}
</div>

{{ h.snippet('snippets/facet_list.html', title='Tags', name='tags', extras={'id':c.group_dict.id}) }}
{{ h.snippet('snippets/facet_list.html', title='Formats', name='res_format', extras={'id':c.group_dict.id}) }}
{% endblock %}

{% block links %}
{{ super() }}
{% include "group/snippets/feeds.html" %}
{{ c.page.pager(q=c.q) }}
{% endblock %}
87 changes: 87 additions & 0 deletions ckan/templates/group/read_base.html
@@ -0,0 +1,87 @@
{% extends "page.html" %}

{% block subtitle %}{{ c.group_dict.display_name }}{% endblock %}

{% block breadcrumb_content %}
<li>{% link_for _('Groups'), controller='group', action='index' %}</li>
<li class="active">{% link_for c.group_dict.display_name|truncate(35), controller='group', action='read', id=c.group_dict.name %}</li>
{% endblock %}

{% block actions_content %}
{% if h.check_access('group_update', {'id': c.group_dict.id}) %}
<li>{% link_for _('Add Dataset to Group'), controller='package', action='new', group=c.group_dict.id, class_='btn', icon='plus' %}</li>
<li>{% link_for _('Edit'), controller='group', action='edit', id=c.group_dict.name, class_='btn', icon='wrench' %}</li>
{% endif %}
<li>{{ h.follow_button('group', c.group_dict.id) }}</li>
{% endblock %}

{% block primary_content %}
<section class="module">
{% block package_header %}
<header class="module-content page-header">
<ul class="nav nav-tabs">
<li{% if c.action == 'read' %} class="active"{% endif %}>
{% link_for _('Datasets'), controller='group', action='read', id=c.group_dict.name, icon='sitemap' %}
</li>
<li{% if c.action == 'activity' %} class="active"{% endif %}>
{% link_for _('Activity Stream'), controller='group', action='activity', id=c.group_dict.name, icon='time' %}
</li>
<li{% if c.action == 'followers' %} class="active"{% endif %}>
{% link_for _('Followers'), controller='group', action='followers', id=c.group_dict.name, icon='group' %}
</li>
<li{% if c.action == 'admins' %} class="active"{% endif %}>
{% link_for _('Administrators'), controller='group', action='admins', id=c.group_dict.name, icon='cog' %}
</li>
<li{% if c.action == 'about' %} class="active"{% endif %}>
{% link_for _('About'), controller='group', action='about', id=c.group_dict.name, icon='info-sign' %}
</li>
</ul>
</header>
{% endblock %}
{% block primary_content_inner %}
<div class="module-content">
{% include "package/snippets/search_form.html" %}
</div>
{{ c.page.pager(q=c.q) }}
{% endblock %}
</section>
{% endblock %}

{% block secondary_content %}
<div class="module profile-info">
<section class="module-content">
<div class="avatar">
<a href="{{ c.group_dict.url }}">
<img src="{{ c.group_dict.image_url or h.url_for_static('/base/images/placeholder-group.png') }}" width="200" height="125" 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>{{ c.group_dict.num_followers }}</dd>
</dl>
<dl>
<dt>{{ _('Datasets') }}</dt>
<dd>{{ c.group_dict.packages|length }}</dd>
</dl>
</div>
</section>
</div>

{{ h.snippet('snippets/facet_list.html', title='Tags', name='tags', extras={'id':c.group_dict.id}) }}
{{ h.snippet('snippets/facet_list.html', title='Formats', name='res_format', extras={'id':c.group_dict.id}) }}
{% endblock %}

{% block links %}
{{ super() }}
{% include "group/snippets/feeds.html" %}
{% endblock %}
4 changes: 2 additions & 2 deletions ckan/templates/package/followers.html
@@ -1,8 +1,8 @@
{% extends "package/read.html" %}
{% extends "package/read_base.html" %}

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

{% block package_content %}
{% block primary_content_inner %}
<section class="module-content">
<h1 class="hide-heading">{{ _('Followers') }}</h1>
{% snippet "user/snippets/followers.html", followers=c.followers %}
Expand Down
121 changes: 22 additions & 99 deletions ckan/templates/package/read.html
@@ -1,114 +1,37 @@
{% extends "page.html" %}
{% extends "package/read_base.html" %}

{% set pkg = c.pkg_dict %}

{% block subtitle %}{{ pkg.title or pkg.name }}{% endblock %}

{% block breadcrumb_content %}
{% 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 %}
{# NOTE: Not implemented in stage 1 #}
{# <li>{% link_for _('History'), controller='package', action='history', id=pkg.name, class_='btn', icon='undo' %}</li> #}
{% if h.check_access('package_update', {'id':pkg.id }) %}
<li>{% link_for _('Edit'), controller='package', action='edit', id=pkg.name, class_='btn btn-primary', icon='wrench' %}</li>
{% endif %}
<li>{{ h.follow_button('dataset', pkg.id) }}</li>
{% endblock %}

{% block primary_content %}
{% block package_revision_info %}
{% if c.pkg_revision_id %}
<div class="module info">
<p class="module-content">
{% set timestamp = h.render_datetime(c.pkg_revision_timestamp, with_hours=True) %}
{% 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 %}
{% else %}
{% trans timestamp=timestamp %}This is the current revision of this dataset, as edited at {{ timestamp }}.{% endtrans %}
{% endif %}
{% block primary_content_inner %}

{% block package_description %}
<section class="module-content">
<h1>{{ pkg.title or pkg.name }}
{% if pkg.state.startswith('draft') %}
[{{ _('Draft') }}]
{% endif %}
</h1>
{% if c.pkg_notes_formatted %}
<div class="notes embedded-content">
{{ c.pkg_notes_formatted }}
</div>
</div>
{% endif %}
{% endblock %}

<article class="module prose">

{% block package_header %}
<header class="module-content page-header">
<ul class="nav nav-tabs">
<li{% if c.action == 'read' %} class="active"{% endif %}>
{% link_for _('Dataset'), controller='package', action='read', id=pkg.name, icon='sitemap' %}
</li>
<li{% if c.action == 'followers' %} class="active"{% endif %}>
{% link_for _('Followers'), controller='package', action='followers', id=pkg.name, icon='group' %}
</li>
<li{% if c.action == 'related' %} class="active"{% endif %}>
{% link_for _('Related'), controller='related', action='list', id=pkg.name, icon='picture' %}
</li>
</ul>
</header>
{% endblock %}

{% block package_content %}

{% block package_description %}
<section class="module-content">
<h1>{{ pkg.title or pkg.name }}
{% if pkg.state.startswith('draft') %}
[{{ _('Draft') }}]
{% endif %}
</h1>
{% if c.pkg_notes_formatted %}
<div class="notes embedded-content">
{{ c.pkg_notes_formatted }}
</div>
{% endif %}
<span class="insert-comment-thread"></span>
</section>
{% endblock %}

{% block package_resources %}
{% snippet "package/snippets/resources_list.html", pkg=pkg, resources=pkg.resources %}
{% endblock %}

{% block package_tags %}
{% snippet "package/snippets/tags.html", tags=pkg.tags %}
{% endblock %}

{% block package_additional_info %}
{% snippet "package/snippets/additional_info.html", pkg_dict=pkg %}
{% endblock %}

{% endblock %}
</article>
{% endblock %}

{% block secondary_content %}

{% block secondary_help_content %}{% endblock %}

{% block package_groups %}
{% for group in pkg.groups %}
{% snippet "snippets/group.html", group=group, truncate=70 %}
{% endfor %}
{% endif %}
<span class="insert-comment-thread"></span>
</section>
{% endblock %}

{% block package_social %}
{% snippet "snippets/social.html" %}
{% block package_resources %}
{% snippet "package/snippets/resources_list.html", pkg=pkg, resources=pkg.resources %}
{% endblock %}

{% block package_related %}
{% snippet "snippets/related.html", item=c.pkg.related|last, pkg_name=pkg.name %}
{% block package_tags %}
{% snippet "package/snippets/tags.html", tags=pkg.tags %}
{% endblock %}

{% block package_license %}
{% snippet "snippets/license.html", pkg_dict=pkg %}
{% block package_additional_info %}
{% snippet "package/snippets/additional_info.html", pkg_dict=pkg %}
{% endblock %}

{% endblock %}

0 comments on commit f561cba

Please sign in to comment.