Skip to content

Commit

Permalink
[2445] Move new related code into a template page
Browse files Browse the repository at this point in the history
This allows us to share the same code between the add and edit pages.
  • Loading branch information
aron committed Jun 5, 2012
1 parent d779add commit 7309f84
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 23 deletions.
26 changes: 3 additions & 23 deletions ckan/templates/related/new.html
@@ -1,27 +1,7 @@
{% extends "page.jinja.html" %}
{% extends "related/pages/related_form_page.html" %}

{% block title %}Create a related item - {{ super() }}{% endblock %}

{% block breadcrumb %}
{{ h.snippet('package/new_breadcrumb.html') }}
{% endblock %}
{% block breadcrumb_item %}{{ h.nav_link(_('Create Related'), controller='related', action='new', id=c.id) }}{% endblock %}

{% block primary_content %}
<section class="module">
<div class="content">
{{ c.form }}
</div>
</section>
{% endblock %}

{% block secondary_content %}
<section class="module">
<h2 class="heading"><i class="ckan-icon ckan-icon-info"></i> What are related items?</h2>
<div class="content">
<p>Related Media is any app, article, visualisation or idea related to
this dataset. For example, it could be a custom visualisation, pictograph
or bar chart, an app using all or part of the data or even a news story
that references this dataset.</p>
</div>
</section>
{% endblock %}
{% block page_heading %}{{ _('Create Related Item') }}{% endblock %}
32 changes: 32 additions & 0 deletions ckan/templates/related/pages/related_form_page.html
@@ -0,0 +1,32 @@
{% extends "page.jinja.html" %}

{% block breadcrumb %}
<ol class="breadcrumb">
<li>{{ h.nav_link(_('Datasets'), controller='package', action='search', highlight_actions = 'new index') }}</li>
{# TODO: Insert rest of breadcrumb here #}
<li class="current">{% block breadcrumb_item %}{% endblock %}</li>
</ol>
{% endblock %}

{% block primary_content %}
<section class="module">
<div class="content">
<h1 class="page-heading">{% block page_heading %}{{ _('Related Form') }}{% endblock %}</h1>
{{ c.form }}
</div>
</section>
{% endblock %}

{% block secondary_content %}
<section class="module">
<h2 class="heading"><i class="ckan-icon ckan-icon-info"></i> What are related items?</h2>
<div class="content">
<p>Related Media is any app, article, visualisation or idea related to
this dataset.</p>

<p>For example, it could be a custom visualisation, pictograph
or bar chart, an app using all or part of the data or even a news story
that references this dataset.</p>
</div>
</section>
{% endblock %}

0 comments on commit 7309f84

Please sign in to comment.