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
c9e6b598
Commit
c9e6b598
authored
6 years ago
by
anonymous
Browse files
Options
Downloads
Patches
Plain Diff
test autocomplete for spatial uri
parent
c715b4bf
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ckanext/odsh/helpers.py
+20
-0
20 additions, 0 deletions
ckanext/odsh/helpers.py
ckanext/odsh/plugin.py
+2
-1
2 additions, 1 deletion
ckanext/odsh/plugin.py
ckanext/odsh/templates/package/snippets/package_basic_fields.html
+16
-0
16 additions, 0 deletions
...odsh/templates/package/snippets/package_basic_fields.html
with
38 additions
and
1 deletion
ckanext/odsh/helpers.py
+
20
−
0
View file @
c9e6b598
...
...
@@ -12,6 +12,8 @@ from ckan.common import config
import
urllib
import
hashlib
import
re
import
csv
import
urllib2
from
ckan.common
import
request
get_action
=
logic
.
get_action
...
...
@@ -215,3 +217,21 @@ def odsh_has_more_facets(facet, limit=None, exclude_active=False):
def
odsh_public_url
():
return
config
.
get
(
'
ckanext.odsh.public_url
'
)
def
spatial_extends_available
():
mapping_file
=
config
.
get
(
'
ckanext.odsh.spatial.mapping
'
)
try
:
mapping_file
=
urllib2
.
urlopen
(
mapping_file
)
except
Exception
:
raise
Exception
(
"
Could not load spatial mapping file!
"
)
spatial_text
=
str
()
spatial
=
str
()
cr
=
csv
.
reader
(
mapping_file
,
delimiter
=
"
\t
"
)
result
=
[]
for
row
in
cr
:
spatial_text
=
row
[
1
]
print
(
spatial_text
)
result
.
append
(
spatial_text
.
decode
(
'
UTF-8
'
))
return
result
This diff is collapsed.
Click to expand it.
ckanext/odsh/plugin.py
+
2
−
1
View file @
c9e6b598
...
...
@@ -289,7 +289,8 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
'
odsh_tracking_id
'
:
odsh_helpers
.
odsh_tracking_id
,
'
odsh_tracking_url
'
:
odsh_helpers
.
odsh_tracking_url
,
'
odsh_has_more_facets
'
:
odsh_helpers
.
odsh_has_more_facets
,
'
odsh_public_url
'
:
odsh_helpers
.
odsh_public_url
'
odsh_public_url
'
:
odsh_helpers
.
odsh_public_url
,
'
odsh_spatial_extends_available
'
:
odsh_helpers
.
spatial_extends_available
}
def
after_map
(
self
,
map
):
...
...
This diff is collapsed.
Click to expand it.
ckanext/odsh/templates/package/snippets/package_basic_fields.html
+
16
−
0
View file @
c9e6b598
...
...
@@ -210,6 +210,22 @@ is_required=true,placeholder=_('Enter title')) }}
</div>
</div>
{% set spatial_extends_available = h.odsh_spatial_extends_available() %}
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"field-{{field}}"
>
{{_('Spatial uri')}}:
<span
title=
"Dieses Feld ist erforderlich"
class=
"control-required"
>
*
</span>
</label>
<div
class=
"controls"
>
<div
class=
"row-fluid"
>
<div
class=
"span6"
>
<select
id=
"field-{{field}}"
data-module=
"autocomplete"
>
{% for extend in spatial_extends_available%}
<option
value=
"{{ extend }}"
{%
if
selected_extend
%}
selected=
"selected"
{%
endif
%}
>
{{extend}}
</option>
{% endfor %}
</select>
</div>
</div>
</div>
</div>
<!-- field private -->
<div
class=
"control-group"
>
<label
for=
"field-private"
class=
"control-label"
>
{{ _('Visibility') }}:
...
...
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