diff --git a/ckanext/canada/assets/internal/canada_internal.css b/ckanext/canada/assets/internal/canada_internal.css index a1bcb5930..37d72b49e 100644 --- a/ckanext/canada/assets/internal/canada_internal.css +++ b/ckanext/canada/assets/internal/canada_internal.css @@ -617,6 +617,33 @@ body ul.xloader-log li.item.failure > i{ body ul.xloader-log li.item.failure > i::after{ background-color: #B95252 !important; } +#s2id_field-department, +#s2id_field-organizations{ + min-height: 37px !important; +} +#s2id_field-department.select2-container, +#s2id_field-organizations.select2-container{ + vertical-align: initial !important; + width: 100% !important; +} +#s2id_field-department.select2-container, +#s2id_field-department.select2-container .select2-choice, +#s2id_field-department.select2-container .select2-chosen, +#s2id_field-organizations.select2-container, +#s2id_field-organizations.select2-container .select2-choice, +#s2id_field-organizations.select2-container .select2-chosen{ + height: 100% !important; +} +#s2id_field-department.select2-container .select2-choice, +#s2id_field-organizations.select2-container .select2-choice{ + font-size: 16px !important; + line-height: 1.4375 !important; + padding: 6px 12px !important; +} +#s2id_field-department.select2-container .select2-arrow b, +#s2id_field-organizations.select2-container .select2-arrow b{ + background-position-y: -100%; +} /*########################### ## END ## ## CKAN Base CSS Overrides## @@ -674,18 +701,21 @@ body ul.xloader-log li.item.failure > i::after{ pointer-events: none; animation: fade-opacity-in 0.5s ease-in 1s 1 normal forwards; } -.canada-pd-org-select-wrapper .recombinant-org-select-wrapper .select2-container{ +.canada-pd-org-select-wrapper .recombinant-org-select-wrapper .select2-container, +.canada-pd-org-select-wrapper .recombinant-org-select-wrapper .recombinant-org-select1-wrapper select{ vertical-align: initial !important; flex: 1; width: auto !important; } .canada-pd-org-select-wrapper .recombinant-org-select-wrapper .select2-container, .canada-pd-org-select-wrapper .recombinant-org-select-wrapper .select2-container .select2-choice, -.canada-pd-org-select-wrapper .recombinant-org-select-wrapper .select2-container .select2-chosen{ +.canada-pd-org-select-wrapper .recombinant-org-select-wrapper .select2-container .select2-chosen, +.canada-pd-org-select-wrapper .recombinant-org-select-wrapper .recombinant-org-select1-wrapper select{ height: 100% !important; border-radius: 0 !important; } -.canada-pd-org-select-wrapper .recombinant-org-select-wrapper .select2-container .select2-choice{ +.canada-pd-org-select-wrapper .recombinant-org-select-wrapper .select2-container .select2-choice, +.canada-pd-org-select-wrapper .recombinant-org-select-wrapper .recombinant-org-select1-wrapper select{ background: #335075 !important; border-color: #335075 !important; box-shadow: none !important; @@ -706,6 +736,13 @@ body ul.xloader-log li.item.failure > i::after{ transition-duration: 0.325s !important; color: white !important; } +.canada-pd-org-select-wrapper .recombinant-org-select-wrapper .recombinant-org-select1-wrapper{ + width: 100% !important; +} +.canada-pd-org-select-wrapper .recombinant-org-select-wrapper .recombinant-org-select1-wrapper select{ + color: white !important; + width: 100% !important; +} .canada-pd-org-select-wrapper .recombinant-org-select-wrapper .select2-container .select2-arrow{ border-radius: 0 !important; background: #335075 !important; diff --git a/ckanext/canada/schemas/presets.yaml b/ckanext/canada/schemas/presets.yaml index 68ba35204..0d6fb1819 100644 --- a/ckanext/canada/schemas/presets.yaml +++ b/ckanext/canada/schemas/presets.yaml @@ -173,7 +173,7 @@ presets: class: form-control form-select # copied from dataset_organization preset validators: scheming_required string_safe owner_org_validator - form_snippet: organization.html + form_snippet: organization_autocomplete.html # Field = Publisher - Organization Name at Publication (English). # {The organization Title at publication Time} diff --git a/ckanext/canada/templates/recombinant/snippets/org_select.html b/ckanext/canada/templates/recombinant/snippets/org_select.html index 35d674737..02c523421 100644 --- a/ckanext/canada/templates/recombinant/snippets/org_select.html +++ b/ckanext/canada/templates/recombinant/snippets/org_select.html @@ -9,6 +9,8 @@ {% block select_classes %}recombinant-org-select-wrapper{% endblock %} {% block select_field %} + {% set organizations_available = h.organizations_available('create_dataset') %} + {% if organizations_available|length > 12 %} + {% else %} +
{{ super() }}
+ {% endif %} {% endblock %} diff --git a/ckanext/canada/templates/scheming/form_snippets/organization_autocomplete.html b/ckanext/canada/templates/scheming/form_snippets/organization_autocomplete.html new file mode 100644 index 000000000..28bedf9ed --- /dev/null +++ b/ckanext/canada/templates/scheming/form_snippets/organization_autocomplete.html @@ -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, + ) %} +
+ + {%- snippet 'scheming/form_snippets/help_text.html', field=field %} +
+ {% endcall %} + +{% else %} + + {% extends "scheming/form_snippets/organization.html" %} + +{% endif %} diff --git a/ckanext/canada/templates/user/new_user_form.html b/ckanext/canada/templates/user/new_user_form.html index ba4d9a32f..8ad4f444d 100644 --- a/ckanext/canada/templates/user/new_user_form.html +++ b/ckanext/canada/templates/user/new_user_form.html @@ -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: joe.bloggs@tbs-sct.gc.ca')) }} {% 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 %}