[#7] Admin templates now are in the correct places

This commit is contained in:
John Martin 2013-02-08 13:52:48 +00:00
parent 0aa1c1fcbc
commit 7209723856
11 changed files with 123 additions and 101 deletions

View File

@ -314,7 +314,7 @@ class ViewController(BaseController):
c.harvest_source = source_dict
c.is_last_job = is_last
return render('job/read.html')
return render('source/job/read.html')
except NotFound:
abort(404,_('Harvest job not found'))
@ -334,6 +334,16 @@ class ViewController(BaseController):
except NotAuthorized,e:
abort(401,self.not_auth_message)
def admin(self, id):
try:
context = {'model':model, 'user':c.user}
c.harvest_source = get_action('harvest_source_show')(context, {'id':id})
return render('source/admin.html')
except NotFound:
abort(404,_('Harvest source not found'))
except NotAuthorized,e:
abort(401,self.not_auth_message)
def show_last_job(self, source):
source_dict = self._get_source_for_job(source)
@ -350,7 +360,7 @@ class ViewController(BaseController):
c.harvest_source = get_action('harvest_source_show')(context, {'id': source})
c.jobs = get_action('harvest_job_list')(context, {'source_id': c.harvest_source['id']})
return render('job/list.html')
return render('source/job/list.html')
except NotFound:
abort(404,_('Harvest source not found'))

View File

@ -216,6 +216,7 @@ class Harvest(p.SingletonPlugin, DefaultDatasetForm):
map.connect('harvest_object_show', '/harvest/object/:id', controller=controller, action='show_object')
map.connect('harvest_source_admin', '/' + DATASET_TYPE_NAME + '/admin/:id', controller=controller, action='admin')
map.connect('harvest_source_about', '/' + DATASET_TYPE_NAME + '/about/:id', controller=controller, action='about')
map.connect('harvest_job_list', '/' + DATASET_TYPE_NAME + '/{source}/job', controller=controller, action='list_jobs')

View File

@ -0,0 +1,7 @@
{% extends "source/admin_base.html" %}
{% block primary_content_inner %}
<section class="module-content">
</section>
{% endblock %}

View File

@ -0,0 +1,21 @@
{% extends "source/read_base.html" %}
{% block breadcrumb_content_root_selected %}{% endblock %}
{% block breadcrumb_content %}
{{ super() }}
<li class="active"><a href="">{{ _('Admin') }}</a></li>
{% endblock %}
{% block actions_content %}
<li>{{ h.nav_named_link(_('Refresh'), 'harvesting_job_create', id=source.id, class_='btn', icon='refresh')}}</li>
<li>{{ h.nav_named_link(_('View harvest source'), '{0}_read'.format(c.dataset_type), id=source.name, class_='btn', icon='eye-open')}}</li>
{% endblock %}
{% block page_header %}
{% snippet 'snippets/page_header.html', items=[
h.build_nav_icon('{0}_admin'.format(c.dataset_type), _('Dashboard'), id=source.name),
h.build_nav_icon('harvest_job_list'.format(c.dataset_type), _('Jobs'), source=source.name),
h.build_nav_icon('{0}_edit'.format(c.dataset_type), _('Edit'), id=source.name),
] %}
{% endblock %}

View File

@ -0,0 +1,24 @@
{% extends "page.html" %}
{% set source = c.pkg_dict or c.harvest_source %}
{% set authorized_user = h.check_access('harvest_source_update', {'id':source.id }) %}
{% block subtitle %}{{ source.title or source.name }}{% endblock %}
{% block breadcrumb_content_root_selected %} class="active"{% endblock %}
{#
TODO: once #354 is merged in CKAN core we can re-adjust the truncation
lengths here (as the breadcrumbs are a little different in #354)
#}
{% block breadcrumb_content %}
{% if source.organization %}
<li>{{ h.nav_named_link(_('Organizations'), 'organizations_index') }}</li>
<li>{{ h.nav_named_link(source.organization.title or source.organization.name|truncate(10), 'organization_read', id=source.organization.name) }}</li>
<li>{{ h.nav_named_link(_('Harvest Sources'), '{0}_search'.format(c.dataset_type)) }}</li>
<li{{ self.breadcrumb_content_root_selected() }}>{{ h.nav_named_link(c.harvest_source.title|truncate(10), '{0}_read'.format(c.dataset_type), id=c.harvest_source.name) }}</li>
{% else %}
<li>{{ h.nav_named_link(_('Harvest Sources'), '{0}_search'.format(c.dataset_type)) }}</li>
<li{{ self.breadcrumb_content_root_selected() }}>{{ h.nav_named_link(c.harvest_source.title|truncate(30), '{0}_read'.format(c.dataset_type), id=c.harvest_source.name) }}</li>
{% endif %}
{% endblock %}

View File

@ -1,27 +0,0 @@
{% extends "page.html" %}
{% block primary_content %}
<section class="module">
<div class="module-content">
{% block form %}{{ c.form | safe }}{% endblock %}
</div>
</section>
{% endblock %}
{% block secondary_content %}
{% block info_module %}
<section class="module module-narrow">
<h2 class="module-heading"><i class="icon-large icon-info-sign"></i> {{ _('Harvest sources') }}</h2>
<div class="module-content">
<p>
{% trans %}
Harvest sources allow importing metadata from other catalogues
as CKAN datasets. These can be other CKAN instances or other
protocols and formats. (TODO: Review)
{% endtrans %}
</p>
</div>
</section>
{% endblock %}
{% endblock %}

View File

@ -1,15 +1,9 @@
{% extends "source/base_form_page.html" %}
{% block breadcrumb_content %}
<li>{{ h.nav_named_link(_('Harvest Sources'), '{0}_search'.format(c.dataset_type)) }}</li>
<li>{{ h.nav_named_link(c.harvest_source.title|truncate(30), '{0}_read'.format(c.dataset_type), id=c.harvest_source.name) }}</li>
<li class="active">{{ h.nav_named_link(_('Edit Harvest Source'), '{0}_edit'.format(c.dataset_type), id=c.harvest_source.name) }}</li>
{% endblock %}
{% block actions_content %}
<li>{{ h.nav_named_link(_('View harvest source'), '{0}_read'.format(c.dataset_type), id=c.harvest_source.name, class_='btn', icon='eye-open')}}</li>
{% endblock %}
<!-- TODO back to source -->
{% extends "source/admin_base.html" %}
{% block subtitle %}{{ _('Edit harvest source') }}{% endblock %}
{% block primary_content_inner %}
<div class="module-content">
{% block form %}{{ c.form | safe }}{% endblock %}
</div>
{% endblock %}

View File

@ -1,18 +1,10 @@
{% extends "page.html" %}
{% extends "source/admin_base.html" %}
{% block subtitle %}{{ _('Harvest Jobs')}}{% endblock %}
{% block breadcrumb_content %}
<li>{{ h.nav_named_link(_('Harvest Sources'), '{0}_search'.format(c.dataset_type)) }}</li>
<li>{{ h.nav_named_link(c.harvest_source.title|truncate(30), '{0}_read'.format(c.dataset_type), id=c.harvest_source.name) }}</li>
<li class="active">{{ h.nav_link(_('Jobs'), controller='ckanext.harvest.controllers.view:ViewController', action='list_jobs', source=c.harvest_source.name)}}</li>
{% endblock %}
{% block primary %}
<article class="module">
{% block primary_content_inner %}
<div class="module-content">
<h1 class="page-heading">{{ _('Harvest Jobs') }}</h1>
<h1 class="hide-heading">{{ _('Harvest Jobs') }}</h1>
{% if c.jobs|length == 0 %}
<p>{{ _('No jobs yet for this source') }}</p>
@ -50,7 +42,5 @@
</table>
{% endif %}
</div>
</article>
{% endblock %}

View File

@ -1,24 +1,15 @@
{% extends "page.html" %}
{% extends "source/admin_base.html" %}
{% block subtitle %}{{ _('Harvest Job Report')}}{% endblock %}
{% block breadcrumb_content %}
<li>{{ h.nav_named_link(_('Harvest Sources'), '{0}_search'.format(c.dataset_type)) }}</li>
<li>{{ h.nav_named_link(c.harvest_source.title|truncate(30), '{0}_read'.format(c.dataset_type), id=c.harvest_source.name) }}</li>
<li>{{ h.nav_link(_('Jobs'), controller='ckanext.harvest.controllers.view:ViewController', action='list_jobs', source=c.harvest_source.name)}}</li>
{% if c.is_last_job %}
<li class="active">{{ h.nav_link(_('Last'), controller='ckanext.harvest.controllers.view:ViewController', action='show_last_job', source=c.harvest_source.name)}}</li>
{% else %}
<li class="active">{{ h.nav_link(c.job.id|truncate(30), controller='ckanext.harvest.controllers.view:ViewController', action='show_job', id=c.job.id, source=c.harvest_source.name)}}</li>
{% endif %}
{% endblock %}
{% block primary %}
<article class="module">
{% block primary_content_inner %}
<div class="module-content">
<h1 class="page-heading">{{ _('Harvest Job Report') }}</h1>
<p class="pull-right">
{{ h.nav_named_link(_('Back to job list'), 'harvest_job_list', source=source.name, class_='btn', icon='arrow-left')}}
</p>
<h1>{{ _('Job Report') }}</h1>
{% snippet 'snippets/job_details.html', job=c.job %}
@ -48,11 +39,8 @@
</div>
{% endfor %}
</div>
{% endfor %}
</div>
</article>
{% endblock %}
{% block styles %}

View File

@ -1,9 +1,34 @@
{% extends "source/base_form_page.html" %}
{% extends "source/admin_base.html" %}
{% block breadcrumb_content %}
<li>{{ h.nav_named_link(_('Harvest Sources'), '{0}_search'.format(c.dataset_type)) }}</li>
<li class="active">{{ h.nav_named_link(_('Create Harvest Source'), '{0}_new'.format(c.dataset_type)) }}</li>
{% endblock %}
{% block actions_content %}
{% endblock %}
{% block subtitle %}{{ _('Create harvest source') }}{% endblock %}
{% block primary_content %}
<section class="module">
<div class="module-content">
{% block form %}{{ c.form | safe }}{% endblock %}
</div>
</section>
{% endblock %}
{% block secondary_content %}
<section class="module module-narrow">
<h2 class="module-heading"><i class="icon-large icon-info-sign"></i> {{ _('Harvest sources') }}</h2>
<div class="module-content">
<p>
{% trans %}
Harvest sources allow importing metadata from other catalogues
as CKAN datasets. These can be other CKAN instances or other
protocols and formats. (TODO: Review)
{% endtrans %}
</p>
</div>
</section>
{% endblock %}

View File

@ -1,24 +1,14 @@
{% extends "package/read_base.html" %}
{% set source = c.pkg_dict or c.harvest_source %}
{% set authorized_user = h.check_access('harvest_source_update', {'id':source.id }) %}
{% block subtitle %}{{ source.title or source.name }}{% endblock %}
{% block breadcrumb_content %}
<li>{{ h.nav_named_link(_('Harvest Sources'), '{0}_search'.format(c.dataset_type)) }}</li>
<li class="active">{{ h.nav_named_link(c.harvest_source.title|truncate(30), '{0}_read'.format(c.dataset_type), id=c.harvest_source.name) }}</li>
{% endblock %}
{% extends "source/base.html" %}
{% block actions_content %}
{% if authorized_user %}
<li>{{ h.nav_named_link(_('Admin'), '{0}_admin'.format(c.dataset_type), id=c.harvest_source.name, class_='btn btn-primary', icon='wrench')}}</li>
{% endif %}
<li>{{ h.follow_button('dataset', source.id) }}</li>
{% endblock %}
{# TODO: once #354 is merged in CKAN core .profile-info doesn't exist #}
{% block secondary_content %}
<div class="module profile-info">
<div class="module context-info profile-info">
<section class="module-content">
<h1 class="heading">{{ c.harvest_source.title }}</h1>
{% if c.harvest_source.notes %}
@ -39,15 +29,14 @@
</div>
{% endblock %}
{% block primary_content %}
<article class="module prose">
{% block page_header %}
<header class="module-content page-header">
<ul class="nav nav-tabs">
<li{% if c.action == 'read' %} class="active"{% endif %}>
{{ h.nav_named_link(_('Datasets'), '{0}_read'.format(c.dataset_type), id=c.harvest_source.name, icon='sitemap') }}
</li>
<li{% if c.action == 'about' %} class="active"{% endif %}>
{{ h.nav_named_link(_('About'), '{0}_about'.format(c.dataset_type), id=c.harvest_source.name, icon='info-sign') }}
</li>
</ul>
</header>
{% snippet 'snippets/page_header.html', items=[
h.build_nav_icon('{0}_read'.format(c.dataset_type), _('Datasets'), id=source.name),
h.build_nav_icon('{0}_about'.format(c.dataset_type), _('About'), id=source.name),
] %}
{% endblock %}
{% block primary_content_inner %}{% endblock %}
</article>
{% endblock %}