Skip to content

Commit

Permalink
path resource_id to each chart field form snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
mutantsan committed Jun 19, 2024
1 parent 6c9c597 commit 4d34090
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
14 changes: 14 additions & 0 deletions ckanext/charts/templates/charts/snippets/charts_form_field.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{#- master snippet for all charts form fields -#}

{%- set form_snippet = field.form_snippet|default('repeating_subfields.html' if field.repeating_subfields else 'text.html') -%}

{%- if '/' not in form_snippet -%}
{%- set form_snippet = 'scheming/form_snippets/' + form_snippet -%}
{%- endif -%}

{%- snippet form_snippet,
field=field,
data=data,
errors=errors,
resource_id=resource_id
-%}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@
{% if tab_fields %}
<div class="tab-pane fade {{ 'show active' if tab == active_tab }}" id="pills-{{ tab }}" role="tabpanel"
aria-labelledby="pills-{{ tab }}-tab">
{% snippet 'charts/snippets/render_fields.html', fields=builder.get_fields_by_tab(tab), data=data,
errors=errors %}
{% snippet 'charts/snippets/render_fields.html',
fields=builder.get_fields_by_tab(tab),
data=data,
errors=errors,
resource_id=resource_id
%}
</div>
{% endif %}
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{% for field in fields if field.form_snippet is not none %}
{% snippet 'scheming/snippets/form_field.html', field=field, data=data, errors=errors %}
{% snippet 'charts/snippets/charts_form_field.html', field=field, data=data, errors=errors, resource_id=resource_id %}
{% endfor %}
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{#} HACK, pass resource ID more explicitly #}
{% set resource_id = data.__extras.resource_id %}

<div
class="form-group control-full control-large charts-filters"
data-module="charts-filters"
Expand Down

0 comments on commit 4d34090

Please sign in to comment.