Finish up create and edit forms, including breadcrumbs, links, etc

This commit is contained in:
amercader 2012-11-30 18:53:13 +00:00
parent 9d83322591
commit d77bf255b4
5 changed files with 52 additions and 39 deletions

View File

@ -52,9 +52,17 @@ class Harvest(p.SingletonPlugin, DefaultDatasetForm):
def package_form(self): def package_form(self):
return 'source/new_source_form.html' return 'source/new_source_form.html'
def new_template(self):
return 'source/new.html'
def edit_template(self):
return 'source/edit.html'
def setup_template_variables(self, context, data_dict): def setup_template_variables(self, context, data_dict):
harvesters_info = logic.get_action('harvesters_info_show')(context,{}) harvesters_info = logic.get_action('harvesters_info_show')(context,{})
p.toolkit.c.harvest_source = p.toolkit.c.pkg
p.toolkit.c.frequencies = [ p.toolkit.c.frequencies = [
{'text': p.toolkit._(f.title()), 'value': f} {'text': p.toolkit._(f.title()), 'value': f}
for f in UPDATE_FREQUENCIES for f in UPDATE_FREQUENCIES
@ -65,6 +73,8 @@ class Harvest(p.SingletonPlugin, DefaultDatasetForm):
] ]
p.toolkit.c.harvesters_info = harvesters_info p.toolkit.c.harvesters_info = harvesters_info
p.toolkit.c.dataset_type = DATASET_TYPE_NAME
def form_to_db_schema_options(self, options): def form_to_db_schema_options(self, options):
''' '''
Similar to form_to_db_schema but with further options to allow Similar to form_to_db_schema but with further options to allow

View File

@ -0,0 +1,27 @@
{% 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,24 +1,16 @@
{% extends "page.html" %} {% extends "source/base_form_page.html" %}
{% block title %}{{ _('Edit - Harvest Source') }} - {{ super() }}{% endblock %}
{% block breadcrumb_content %} {% block breadcrumb_content %}
<!-- TODO: link to list -->
<li>{% link_for _('Harvest Sources'), controller='package', action='search', highlight_actions = 'new index' %}</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 %} {% endblock %}
{% block styles %} {% block actions_content %}
{{ super() }} <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>
<link type="text/css" rel="stylesheet" media="all" href="/ckanext/harvest/style.css" />
{% endblock %} {% endblock %}
{% block primary %} <!-- TODO back to source -->
<article class="module">
<div class="module-content">
<div class="harvest-content">
<h2>Edit harvest source </h2>
{{ h.literal(c.form) }}
</div>
</div>
</article>
{% endblock %}
{% block sidebar %}{% endblock %} {% block subtitle %}{{ _('Edit harvest source') }}{% endblock %}

View File

@ -1,26 +1,10 @@
{% extends "page.html" %} {% extends "source/base_form_page.html" %}
{% block title %}{{ _('New - Harvest Source') }} - {{ super() }}{% endblock %}
{% block breadcrumb_content %} {% block breadcrumb_content %}
<!-- TODO: link to list -->
<li>{% link_for _('Harvest Sources'), controller='package', action='search', highlight_actions = 'new index' %}</li>
<li class="active">{{ h.nav_named_link(_('Create Harvest Source'), '{0}_new'.format(c.dataset_type)) }}</li>
{% endblock %} {% endblock %}
{% block styles %} {% block subtitle %}{{ _('Create harvest source') }}{% endblock %}
{{ super() }}
<link type="text/css" rel="stylesheet" media="all" href="/ckanext/harvest/style.css" />
{% endblock %}
{% block primary %}
<article class="module">
<div class="module-content">
<div class="harvest-content">
<h2>New harvest source </h2>
{{ h.literal(c.form) }}
</div>
</div>
</article>
{% endblock %}
{% block sidebar %}{% endblock %}

View File

@ -34,6 +34,6 @@
<div><b>TODO: state / delete</b> </div> <div><b>TODO: state / delete</b> </div>
<input id="save" name="save" value="Save" type="submit" class="btn"/> or <a href="/harvest">Return to the harvest sources list</a> <input id="save" name="save" value="Save" type="submit" class="btn"/>
</form> </form>