-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Select2 for organization selects when more than 12 user permissions.
- Loading branch information
1 parent
ef0450d
commit 14e173f
Showing
5 changed files
with
89 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
ckanext/canada/templates/scheming/form_snippets/organization_autocomplete.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{% set organizations_available = h.organizations_available('create_dataset') %} | ||
|
||
{% if organizations_available|length > 12 %} | ||
|
||
{% import 'macros/form.html' as form %} | ||
|
||
{% set org_required = not h.check_config_permission('create_unowned_dataset') %} | ||
|
||
{% call form.input_block('field-organizations', | ||
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'], | ||
extra_html=caller() if caller, | ||
) %} | ||
<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()) }}" | ||
placeholder="{{ _('Search organizations...') }}" | ||
data-module="autocomplete" | ||
data-module-source="/organization/autocomplete?q=?" | ||
data-module-key="id" | ||
data-module-label="title" | ||
data-module-dropdownClass="org-select2-dropdown" | ||
data-module-containerClass="org-select2-container" | ||
data-module-tags="false" | ||
data-module-createtags="false" | ||
class="control-medium" | ||
/> | ||
{%- snippet 'scheming/form_snippets/help_text.html', field=field %} | ||
</div> | ||
{% endcall %} | ||
|
||
{% else %} | ||
|
||
{% extends "scheming/form_snippets/organization.html" %} | ||
|
||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,8 +14,8 @@ | |
{% call form.input("email", id="field-email", label=_("Email"), type="email", value=data.email, error=errors.email, attrs=valid_dict2, is_required=true, classes=["control-medium"]) %} | ||
{{ form.info(_('Example: [email protected]')) }} | ||
{% endcall %} | ||
{% set format_attrs={ 'oninvalid': "setCustomValidity('"+_("Please fill out this field.")+"')", 'onchange':"setCustomValidity('')", 'data-module': 'autocomplete', 'data-module-source': '/organization/autocomplete?q=?', 'data-module-key': 'title', 'class':'control-medium'} %} | ||
{{ form.input('department', id='field-department', label=_('Organization'), value=data.department, error=errors.department, attrs=format_attrs, is_required=true) }} | ||
{% set format_attrs={ 'oninvalid': "setCustomValidity('"+_("Please fill out this field.")+"')", 'onchange':"setCustomValidity('')", 'data-module': 'autocomplete', 'data-module-source': '/organization/autocomplete?q=?', 'data-module-key': 'title', 'data-module-label': 'title', 'data-module-dropdownClass': 'org-select2-dropdown', 'data-module-containerClass': 'org-select2-container', 'data-module-tags': 'false', 'data-module-createtags': 'false', 'class':'control-medium'} %} | ||
{{ form.input('department', id='field-department', label=_('Organization'), value=data.department, error=errors.department, attrs=format_attrs, is_required=true, placeholder=_('Search organizations...')) }} | ||
{% call form.input("phoneno", id="field-phoneno", label=_("Phone Number"), value=data.phoneno, error=errors.phoneno, classes=["control-medium"]) %} | ||
{{ form.info(_('Example: 000 000 0000')) }} | ||
{% endcall %} | ||
|