Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ckanext-odsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open-Data
ckanext-odsh
Commits
ca85911e
Commit
ca85911e
authored
Dec 8, 2023
by
Thorge Petersen
Browse files
Options
Downloads
Patches
Plain Diff
Allow for multiple selects
parent
afb5ad34
No related branches found
No related tags found
1 merge request
!52
Added applicableLegislation and hvdCategory support
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ckanext/odsh/templates/macros/form.html
+5
-5
5 additions, 5 deletions
ckanext/odsh/templates/macros/form.html
ckanext/odsh/templates/package/snippets/package_basic_fields.html
+2
-2
2 additions, 2 deletions
...odsh/templates/package/snippets/package_basic_fields.html
with
7 additions
and
7 deletions
ckanext/odsh/templates/macros/form.html
+
5
−
5
View file @
ca85911e
...
@@ -163,10 +163,9 @@ is_required=false) %}
...
@@ -163,10 +163,9 @@ is_required=false) %}
{% endmacro %}
{% endmacro %}
{#
{# Creates a select with an input field for autocomplete #}
Creates a select with an input field for autocomplete #}
{% macro select_autocomplete(name, id='', label='', options='', selected='', error='', classes=[], attrs={},
{% macro select_autocomplete(name, id='', label='', options='', selected='', error='', classes=[], attrs={},
is_required=false) %}
is_required=false
, is_multiple=false
) %}
{% set classes = (classes|list) %}
{% set classes = (classes|list) %}
{% do classes.append('control-select') %}
{% do classes.append('control-select') %}
...
@@ -176,9 +175,9 @@ Creates a select with an input field for autocomplete #}
...
@@ -176,9 +175,9 @@ Creates a select with an input field for autocomplete #}
<div
class=
"row-fluid"
>
<div
class=
"row-fluid"
>
<div
class=
"span6"
>
<div
class=
"span6"
>
<select
id=
"{{ id or name }}"
name=
"{{ name }}"
{{
attributes
(
attrs
)
}}
data-module=
"autocomplete"
>
<select
id=
"{{ id or name }}"
name=
"{{ name }}"
{{
attributes
(
attrs
)
}}
data-module=
"autocomplete"
{%
if
is_multiple
%}
multiple
{%
endif
%}
>
{% for option in options %}
{% for option in options %}
<option
value=
"{{ option.key }}"
{%
if
option.key
=
=
selected
%}
selected
{%
endif
%}
>
{{ option.text or
<option
value=
"{{ option.key }}"
{%
if
option.key
in
selected
%}
selected
{%
endif
%}
>
{{ option.text or
option.value }}
</option>
option.value }}
</option>
{% endfor %}
{% endfor %}
</select>
</select>
...
@@ -195,6 +194,7 @@ Creates a select with an input field for autocomplete #}
...
@@ -195,6 +194,7 @@ Creates a select with an input field for autocomplete #}
{% endmacro %}
{% endmacro %}
{#
{#
Creates all the markup required for a Markdown textarea element. Handles
Creates all the markup required for a Markdown textarea element. Handles
matching labels to inputs, selected item and error messages.
matching labels to inputs, selected item and error messages.
...
...
This diff is collapsed.
Click to expand it.
ckanext/odsh/templates/package/snippets/package_basic_fields.html
+
2
−
2
View file @
ca85911e
...
@@ -352,10 +352,10 @@ dataset_is_draft)) %}
...
@@ -352,10 +352,10 @@ dataset_is_draft)) %}
{% set field = 'applicableLegislation' %}
{% set field = 'applicableLegislation' %}
{% set error_reference = h.odsh_extract_error(field, errors) %}
{% set error_reference = h.odsh_extract_error(field, errors) %}
{% set value = h.odsh_extract_value_from_extras(data.extras,field) or '' %}
{% set value = h.odsh_extract_value_from_extras(data.extras,field) or '' %}
{{ form.select_autocomplete(field, label=_('Applicable Legislation'), selected=value, options=h.odsh_load_applicable_legislations(), error=error_reference, is_required=False, classes=['control-full', 'field-applicableLegislation'])}}
{{ form.select_autocomplete(field, label=_('Applicable Legislation'), selected=value, options=h.odsh_load_applicable_legislations(), error=error_reference, is_required=False, classes=['control-full', 'field-applicableLegislation']
, is_multiple=True
)}}
{# field hvdCategory #}
{# field hvdCategory #}
{% set field = 'hvdCategory' %}
{% set field = 'hvdCategory' %}
{% set error_reference = h.odsh_extract_error(field, errors) %}
{% set error_reference = h.odsh_extract_error(field, errors) %}
{% set value = h.odsh_extract_value_from_extras(data.extras,field) or '' %}
{% set value = h.odsh_extract_value_from_extras(data.extras,field) or '' %}
{{ form.select_autocomplete(field, label=_('HVD Category'), selected=value, options=h.odsh_load_hvd_categories(), error=error_reference, is_required=False, classes=['control-full', 'field-hvdCategory'])}}
{{ form.select_autocomplete(field, label=_('HVD Category'), selected=value, options=h.odsh_load_hvd_categories(), error=error_reference, is_required=False, classes=['control-full', 'field-hvdCategory']
, is_multiple=True
)}}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment