Skip to content
Snippets Groups Projects
Commit d6894156 authored by anonymous's avatar anonymous
Browse files

fix display if spatial

parent c287744e
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,7 @@ import re
import csv
import urllib2
from ckan.common import request
import pdb
get_action = logic.get_action
log = logging.getLogger(__name__)
......
......@@ -199,7 +199,9 @@ is_required=true,placeholder=_('Enter title')) }}
<div class="controls">
<div class="row-fluid">
{% if not value and not error and data.state == 'active'%}
{{h.truncate(h.odsh_extract_value_from_extras(data.extras,'spatial'),22)}}
<div class="span6">
<input type='text' value="{{h.truncate(h.odsh_extract_value_from_extras(data.extras,'spatial'),20)}}" readonly />
</div>
{% else %}
<div class="span6">
{{ form.input_extra(field, value=value, index=h.odsh_create_checksum(field), type='text', placeholder=_('Enter spatial uri')) }}
......
......@@ -97,6 +97,26 @@ class TestUpload(helpers.FunctionalTestBase):
# assert
response.mustcontain('Manage Dataset')
response.mustcontain('module module-narrow dataset-map')
@odsh_test()
def test_edit_valid_dataset(self):
# arrange
dataset = self._create_dataset()
form = self._get_package_update_form(dataset['id'])
# # act
# form[self._get_field_name('spatial_uri')] = ''
# response = self._submit_form(form)
# # assert
# assert 'spatial_uri: empty not allowed' not in response
response = self._submit_and_follow_form(form)
# assert
response.mustcontain('Manage Dataset')
response.mustcontain('module module-narrow dataset-map')
@odsh_test()
def test_upload_empty_wrong_date_temporal_start(self):
......@@ -149,6 +169,7 @@ class TestUpload(helpers.FunctionalTestBase):
# assert
assert_true('resource-edit' in response.forms)
# map enabled
@odsh_test()
def test_upload_license(self):
......
......@@ -158,9 +158,12 @@ def known_spatial_uri(key, data, errors, context):
if not poly:
poly = pkg.extras.get('spatial', None)
if not poly or has_old_uri:
# pdb.set_trace()
raise toolkit.Invalid('spatial_uri: empty not allowed')
else:
if poly:
new_index = next_extra_index(data)
data[('extras', new_index+1, 'key')] = 'spatial'
data[('extras', new_index+1, 'value')] = poly
return
mapping_file = config.get('ckanext.odsh.spatial.mapping')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment