ckan / ckanext-scheming

Easy, shareable custom CKAN schemas
Other
86 stars 163 forks source link

Repeating subfield form snippet displays help text inconsistently #396

Closed themowski closed 10 months ago

themowski commented 10 months ago

My team is using release-3.0.0.

I noticed that the form_snippets/repeating_subfields.html file does not use the form_snippets/help_text.html file that other snippets use. This results in the help text being inconsistently formatted when compared to other fields that specify help text.

We applied this patch, and it seemed to fix the issue:

diff --git a/ckanext-scheming/ckanext/scheming/templates/scheming/form_snippets/repeating_subfields.html b/ckanext-scheming/ckanext/scheming/templates/scheming/form_snippets/repeating_subfields.html
index f714a16..9d5aa2b 100644
--- a/ckanext-scheming/ckanext/scheming/templates/scheming/form_snippets/repeating_subfields.html
+++ b/ckanext-scheming/ckanext/scheming/templates/scheming/form_snippets/repeating_subfields.html
@@ -77,12 +77,7 @@
          {% block add_button %}<a href="javascript:;" name="repeating-add" class="btn btn-link"
            >{% block add_button_text %}<i class="fa fa-plus" aria-hidden="true"></i> {{ _('Add') }}{% endblock %}</a>{% endblock %}

-         {% set help_text = h.scheming_language_text(field.help_text) %}
-         {% if help_text %}
-           <div class="info-block mrgn-tp-md">
-             {{ help_text }}
-           </div>
-         {% endif %}
+    {%- snippet 'scheming/form_snippets/help_text.html', field=field -%}
        </div>

        <div name="repeating-template" style="display:none">{{ repeating_panel('REPEATING-INDEX0', 'REPEATING-INDEX1') }}</div>

On an unrelated note, the repeating_subfields.html file uses a mix of tabs & spaces on the same line in multiple spots -- not sure if that's something you want to tweak as well.

wardi commented 10 months ago

@themowski sounds good, would you care to submit a PR with these changes?

themowski commented 10 months ago

Sure, I'll try to get something submitted sooner rather than later.