Skip to content

Commit

Permalink
fix(templates): org auto complete;
Browse files Browse the repository at this point in the history
- Minro fixes to the organization autocomplete form snippet.
  • Loading branch information
JVickery-TBS committed Oct 28, 2024
1 parent 3bcdb8a commit 3ba5fe8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
7 changes: 7 additions & 0 deletions ckanext/canada/assets/internal/canada_internal.css
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,13 @@ body ul.xloader-log li.item.failure > i::after{
#s2id_field-organizations.select2-container .select2-arrow b{
background-position-y: -100%;
}
.s2id_field-organizations_wrapper{
margin-bottom: 0 !important;
}
.s2id_field-organizations_wrapper .error-block{
margin-top: -8px;
padding-top: 8px !important;
}
/*###########################
## END ##
## CKAN Base CSS Overrides##
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@
label=h.scheming_language_text(field.label),
error=errors[field.field_name],
is_required=org_required,
classes=field.classes if 'classes' in field else ['form-group', 'control-medium'],
classes=field.classes if 'classes' in field else ['form-group', 'control-medium', 's2id_field-organizations_wrapper'],
extra_html=caller() if caller,
) %}
{% set selected_org = data.get('organization', '') if data else '' %}
{% if selected_org %}
{% set selected_org = h.split_piped_bilingual_field(selected_org.title, h.lang()) %}
{% endif %}
<div {{
form.attributes(field.form_attrs) if 'form_attrs' in field else '' }}>
<input id="field-organizations"
type="text"
name="owner_org"
value="{{ h.split_piped_bilingual_field(field.title, h.lang()) }}"
value="{{ data.get('owner_org', '') if data else '' }}"
placeholder="{{ _('Search organizations...') }}"
data-module="autocomplete"
data-module-source="/organization/autocomplete?q=?"
Expand All @@ -28,12 +32,17 @@
data-module-containerClass="org-select2-container"
data-module-tags="false"
data-module-createtags="false"
data-module-initial_value="{{ data.get('owner_org', '') if data else '' }}"
data-module-initial_label="{{ selected_org }}"
class="control-medium"
/>
{%- snippet 'scheming/form_snippets/help_text.html', field=field %}
</div>
{% endcall %}

<div class="form-group">
{%- snippet 'scheming/form_snippets/help_text.html', field=field %}
</div>

{% else %}

{% extends "scheming/form_snippets/organization.html" %}
Expand Down

0 comments on commit 3ba5fe8

Please sign in to comment.