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

ODPSH-152: error string

parent 8944808a
Branches
Tags
No related merge requests found
...@@ -7,6 +7,7 @@ ckan.module('odsh_guessformat', function ($) ...@@ -7,6 +7,7 @@ ckan.module('odsh_guessformat', function ($)
let c = $('#field-format') let c = $('#field-format')
let onChange = function (filename) let onChange = function (filename)
{ {
console.log(known_formats)
let ext = filename.slice((filename.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase(); let ext = filename.slice((filename.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase();
if (ext !== undefined && known_formats.indexOf(ext) > -1) if (ext !== undefined && known_formats.indexOf(ext) > -1)
{ {
......
No preview for this file type
...@@ -210,6 +210,9 @@ msgstr "Bitte geben sie einen Namen für den Datensatz ein" ...@@ -210,6 +210,9 @@ msgstr "Bitte geben sie einen Namen für den Datensatz ein"
msgid "odsh_resource_description_error_label" msgid "odsh_resource_description_error_label"
msgstr "Bitte beschreiben Sie Ihren Datensatz" msgstr "Bitte beschreiben Sie Ihren Datensatz"
msgid "odsh_resource_format_error_label"
msgstr "Bitte geben Sie ein Format an"
msgid "Followers" msgid "Followers"
msgstr "Abonennten" msgstr "Abonennten"
......
...@@ -265,7 +265,8 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm ...@@ -265,7 +265,8 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
schema['tag_string'][i] = odsh_tag_string_convert schema['tag_string'][i] = odsh_tag_string_convert
schema['resources'].update({ schema['resources'].update({
'url' : [ toolkit.get_converter('not_empty') ] 'url' : [ toolkit.get_converter('not_empty') ],
'format' : [ toolkit.get_converter('not_empty') ]
}) })
def create_package_schema(self): def create_package_schema(self):
......
...@@ -27,11 +27,15 @@ is_required=false) %} ...@@ -27,11 +27,15 @@ is_required=false) %}
{% call input_block(id or name, label, error, classes, extra_html=extra_html, is_required=is_required) %} {% call input_block(id or name, label, error, classes, extra_html=extra_html, is_required=is_required) %}
<div class="row-fluid"> <div class="row-fluid">
<div class="span6"> <div class="span6">
<input id="{{ id or name }}" type="{{ _type }}" name="{{ name }}" value="{{ value | empty_and_escape }}" placeholder="{{ placeholder }}" <input id="{{ id or name }}" type="{{ _type }}" name="{{ name }}" value="{{ value | empty_and_escape }}"
{{ onFocus }} {{ attributes(attrs) }} /> placeholder="{{ placeholder }}" {{ onFocus }} {{ attributes(attrs) }} />
</div> </div>
<div class="span6 inline-error"> <div class="span6 inline-error">
{% if error is string %}
{{error}} {{error}}
{% else %}
{{error|first}}
{% endif %}
</div> </div>
</div> </div>
{% endcall %} {% endcall %}
......
{% resource 'odsh/odsh_image-upload.js' %} {% resource 'odsh/odsh_image-upload.js' %}
{% import 'macros/form.html' as form %} {% import 'macros/form.html' as form %}
...@@ -72,12 +71,9 @@ ...@@ -72,12 +71,9 @@
{% resource 'odsh/odsh_guessformat.js' %} {% resource 'odsh/odsh_guessformat.js' %}
{% set format_attrs = {'data-module': 'odsh_guessformat', 'data-module-formats':h.odsh_upload_known_formats()} %} {% set format_attrs = {'data-module': 'odsh_guessformat', 'data-module-formats':h.odsh_upload_known_formats()} %}
{% set error_string = _('odsh_resource_format_error_label') if errors.format %}
{% call form.input('format', id='field-format', label=_('Format'), placeholder=_('eg. CSV, XML or JSON'), value=data.format, error=errors.format, classes=['control-medium'],attrs=format_attrs) %} {% call form.input('format', id='field-format', label=_('Format'), placeholder=_('eg. CSV, XML or JSON'), value=data.format, error=error_string, classes=['control-medium'],attrs=format_attrs) %}
<span class="info-block info-block-small">
<i class="fa fa-info-circle"></i>
{{ _('This will be guessed automatically. Leave blank if you wish') }}
</span>
{% endcall %} {% endcall %}
{% endblock %} {% endblock %}
{% endblock %} {% endblock %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment