Skip to content

Commit

Permalink
To snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
ggcatu committed Aug 18, 2017
1 parent e932d44 commit 9639ed6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
15 changes: 1 addition & 14 deletions ckanext/datastore/templates/datastore/dictionary.html
Expand Up @@ -13,20 +13,7 @@
<form method="post" action="{{ action }}" >
{% block dictionary_form %}
{% for f in fields %}
<h3>{{ _( "Field {num}.").format(num=loop.index) }} {{ f.id }} ({{ f.type }})</h3>
{{ form.select('info__' ~ loop.index ~ '__type_override',
label=_('Type Override'), options=[
{'name': '', 'value': ''},
{'name': 'text', 'value': 'text'},
{'name': 'numeric', 'value': 'numeric'},
{'name': 'timestamp', 'value': 'timestamp'},
], selected=f.get('info', {}).get('type_override', '')) }}
{{ form.input('info__' ~ loop.index ~ '__label',
label=_('Label'), id='field-f' ~ loop.index ~ 'label',
value=f.get('info', {}).get('label', ''), classes=['control-full']) }}
{{ form.markdown('info__' ~ loop.index ~ '__notes',
label=_('Description'), id='field-d' ~ loop.index ~ 'notes',
value=f.get('info', {}).get('notes', '')) }}
{% snippet "datastore/snippets/dictionary_form.html", f=f, position=loop.index, form=form %}
{% endfor %}
{% endblock %}
<button class="btn btn-primary" name="save" type="submit">
Expand Down
@@ -0,0 +1,14 @@
<h3>{{ _( "Field {num}.").format(num=position) }} {{ f.id }} ({{ f.type }})</h3>
{{ form.select('info__' ~ position ~ '__type_override',
label=_('Type Override'), options=[
{'name': '', 'value': ''},
{'name': 'text', 'value': 'text'},
{'name': 'numeric', 'value': 'numeric'},
{'name': 'timestamp', 'value': 'timestamp'},
], selected=f.get('info', {}).get('type_override', '')) }}
{{ form.input('info__' ~ position ~ '__label',
label=_('Label'), id='field-f' ~ position ~ 'label',
value=f.get('info', {}).get('label', ''), classes=['control-full']) }}
{{ form.markdown('info__' ~ position ~ '__notes',
label=_('Description'), id='field-d' ~ position ~ 'notes',
value=f.get('info', {}).get('notes', '')) }}
8 changes: 1 addition & 7 deletions ckanext/datastore/templates/package/resource_read.html
Expand Up @@ -26,13 +26,7 @@ <h2>{{ _('Data Dictionary') }}</h2>
{% block resource_data_dictionary_data %}
{% set ddict=h.datastore_dictionary(res.id) %}
{% for f in ddict %}
<tr>
<td>{{ f.id }}</td>
<td>{{ f.type }}</td>
<td>{{ h.get_translated(f.get('info', {}), 'label') }}</td>
<td>{{ h.render_markdown(
h.get_translated(f.get('info', {}), 'notes')) }}</td>
</tr>
{% snippet "package/snippets/dictionary_table.html", f=f, h=h %}
{% endfor %}
{% endblock %}
</table>
Expand Down
@@ -0,0 +1,7 @@
<tr>
<td>sdfasdf {{ f.id }}</td>
<td>{{ f.type }}</td>
<td>{{ h.get_translated(f.get('info', {}), 'label') }}</td>
<td>{{ h.render_markdown(
h.get_translated(f.get('info', {}), 'notes')) }}</td>
</tr>

0 comments on commit 9639ed6

Please sign in to comment.