Skip to content

Commit

Permalink
[geo] Treat extras with __ as start of key as system (hidden)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes authored and FuhuXia committed Oct 21, 2015
1 parent 7d6fcbc commit b8d7f36
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ckan/lib/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ def sorted_extras(package_extras, auto_clean=False, subs=None, exclude=None):
if extra.get('state') == 'deleted':
continue
k, v = extra['key'], extra['value']
if k in exclude:
if k in exclude or k.startswith('__'):
continue
if subs and k in subs:
k = subs[k]
Expand Down
6 changes: 6 additions & 0 deletions ckan/templates/macros/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@
{%- set extra_html = caller() if caller -%}
{%- do classes.append('control-custom') -%}

{# if the key starts with __ we hide it as it is a system setting #}
{% if (values[0] and values[0].startswith('__')) %}
<input id="{{ id or names[0] }}-key" type="hidden" name="{{ names[0] }}" value="{{ values[0] | empty_and_escape }}" />
<input id="{{ id or names[1] }}-value" type="hidden" name="{{ names[1] }}" value="{{ values[1] | empty_and_escape }}" />
{% else %}
{% call input_block(label_id, label or name, error, classes, control_classes=["editor"], extra_html=extra_html, is_required=is_required) %}
<div class="input-prepend" {{ attributes(attrs) }}>
<label for="{{ label_id }}" class="add-on">Key</label><input id="{{ id or names[0] }}-key" type="text" name="{{ names[0] }}" value="{{ values[0] | empty_and_escape }}" placeholder="{{ placeholders[0] }}" />
Expand All @@ -237,6 +242,7 @@
{% endif %}
</div>
{% endcall %}
{% endif %}
{% endmacro %}

{#
Expand Down

0 comments on commit b8d7f36

Please sign in to comment.