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
2858a621
Commit
2858a621
authored
2 years ago
by
Thorge Petersen
Browse files
Options
Downloads
Patches
Plain Diff
Added autocomplete to reference field
parent
446997c2
No related branches found
No related tags found
1 merge request
!12
Verwendung des Musterdatenkatalog und Revert "überflüssige Dateien gelöscht"
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ckanext/odsh/helpers.py
+3
-3
3 additions, 3 deletions
ckanext/odsh/helpers.py
ckanext/odsh/templates/package/snippets/package_basic_fields.html
+2
-23
2 additions, 23 deletions
...odsh/templates/package/snippets/package_basic_fields.html
with
5 additions
and
26 deletions
ckanext/odsh/helpers.py
+
3
−
3
View file @
2858a621
...
@@ -471,10 +471,10 @@ def odsh_load_mdk_sample_dataset():
...
@@ -471,10 +471,10 @@ def odsh_load_mdk_sample_dataset():
default_sample_data_file_path
=
os
.
path
.
join
(
path
,
"
../../mdk_mapping.json
"
)
default_sample_data_file_path
=
os
.
path
.
join
(
path
,
"
../../mdk_mapping.json
"
)
sample_data_file_path
=
config
.
get
(
sample_data_file_path
=
config
.
get
(
'
ckanext.odsh.sample_data_file_path
'
,
default_sample_data_file_path
)
'
ckanext.odsh.sample_data_file_path
'
,
default_sample_data_file_path
)
try
:
try
:
with
open
(
sample_data_file_path
)
as
mapping_json
:
with
open
(
sample_data_file_path
)
as
mapping_json
:
sample_dataset_mapping
=
json
.
loads
(
mapping_json
.
read
(),
object_pairs_hook
=
OrderedDict
)
MDK_MAPPING
=
json
.
loads
(
mapping_json
.
read
())
result
=
[{
'
key
'
:
key
,
'
value
'
:
MDK_MAPPING
[
key
]}
for
key
in
MDK_MAPPING
]
except
IOError
as
err
:
except
IOError
as
err
:
log
.
error
(
log
.
error
(
'
Could not load sample dataset mapping file from {}
'
'
Could not load sample dataset mapping file from {}
'
...
@@ -487,5 +487,5 @@ def odsh_load_mdk_sample_dataset():
...
@@ -487,5 +487,5 @@ def odsh_load_mdk_sample_dataset():
.
format
(
sample_data_file_path
)
.
format
(
sample_data_file_path
)
)
)
raise
raise
return
sample_dataset_mapping
return
result
This diff is collapsed.
Click to expand it.
ckanext/odsh/templates/package/snippets/package_basic_fields.html
+
2
−
23
View file @
2858a621
...
@@ -325,26 +325,5 @@ dataset_is_draft)) %}
...
@@ -325,26 +325,5 @@ dataset_is_draft)) %}
{# field reference #}
{# field reference #}
{% set field = 'reference' %}
{% set field = 'reference' %}
{% set error_reference = h.odsh_extract_error(field, errors) %}
{% set error_reference = h.odsh_extract_error(field, errors) %}
<div
class=
"control-group"
>
<label
for=
"field-reference"
class=
"control-label"
>
{{ _('Musterdatensatz') }}:
</label>
<div
class=
"controls"
>
<div
class=
"row-fluid"
>
<div
class=
"span6"
>
<select
id=
"field-reference"
name=
"reference"
>
{% set value = h.odsh_extract_value_from_extras(data.extras,field) %}
{% set value = h.odsh_extract_value_from_extras(data.extras,field) %}
{% for uri, title in h.odsh_load_mdk_sample_dataset().items() %}
{{ form.select_autocomplete(field, label=_('Musterdatensatz'), selected=value, options=h.odsh_load_mdk_sample_dataset(), error=error_reference, is_required=False, classes=['control-full', 'field-reference'])}}
<option
value=
"{{ uri }}"
{%
if
uri=
=value|trim
%}
selected=
"selected"
{%
endif
%}
>
{{
title }}
</option>
{% endfor %}
</select>
</div>
<div
class=
"span6 inline-error"
>
{% if error_reference %}
{{_(error_reference)}}
{% endif %}
</div>
</div>
</div>
</div>
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