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

ODPSH-81: Applies layout changes according to Mockup

parent 634e5be7
No related branches found
No related tags found
No related merge requests found
......@@ -7,8 +7,10 @@ log = logging.getLogger(__name__)
def odsh_openness_score_dataset_html(dataset):
score = 0
#dataset = json.loads(dataset)
resources = dataset.get('resources')
if resources:
if resources is None:
return 0
for resource in resources:
r_qa = resource.get('qa')
if r_qa:
......
No preview for this file type
......@@ -110,7 +110,7 @@ msgid "Beginn des Zeitraumes: Fehlender Wert"
msgstr "Bitte wählen Sie einen Beginn des Zeitraumes aus"
msgid "Ende des Zeitraumes: Fehlender Wert"
msgstr "Bitte wählen Sie ein Ende des Zeitraumes aus"
msgstr "Bitte wählen Sie einen Zeitraum aus"
msgid "Name: Fehlender Wert"
msgstr "Bitte geben Sie eine Url ein"
......@@ -121,7 +121,7 @@ msgstr "Bitte geben Sie einen Ort ein"
msgid "Tags"
msgstr "Schlagwörter"
msgid "Notes: Fehlender Wert"
msgid "Beschreibung: Fehlender Wert"
msgstr "Bitte geben Sie eine Beschreibung ein"
msgid "Namensnennung: Fehlender Wert"
......@@ -130,12 +130,24 @@ msgstr "Bitte geben Sie einen Namen ein"
msgid "Titel: Fehlender Wert"
msgstr "Bitte geben Sie einen Titel ein"
msgid "Publish date: Fehlender Wert"
msgstr "Bitte wählen Sie ein Veröffetlichungsdatum"
msgid "odsh_publish_date_error_label"
msgstr "Bitte wählen Sie ein Veröffentlichungsdatum"
msgid "odsh_spatial_extension_error_label"
msgstr "Bitte geben sie einen räumlichen Bezug an"
msgid "Tag string: Fehlender Wert"
msgstr "Bitte wählen Sie geeignete Schlagwörter"
msgid "odsh_resource_upload_error_label"
msgstr "Bitte laden Sie Ihren Datensatz hoch"
msgid "odsh_resource_name_error_label"
msgstr "Bitte geben sie einen Namen für den Datensatz ein"
msgid "odsh_resource_description_error_label"
msgstr "Bitte beschreiben Sie Ihren Datensatz"
msgid "Followers"
msgstr "Abonennten"
......
......@@ -122,7 +122,9 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
# # toolkit.get_converter('not_empty'),
# toolkit.get_converter('odsh_convert_groups_string')] })
schema['resources'].update({
'url' : [ toolkit.get_converter('not_empty') ]
'url' : [ toolkit.get_converter('not_empty') ],
'description' : [ toolkit.get_converter('not_empty') ],
'name' : [ toolkit.get_converter('not_empty') ]
})
def create_package_schema(self):
......
......@@ -361,7 +361,7 @@ label:after {
border-radius: 0;
}
.control-group.error .control-label, .control-group.error .help-block, .control-group.error .help-inline {
.control-label, .control-group.error .control-label, .control-group.error .help-block, .control-group.error .help-inline {
color: black;
}
......@@ -606,4 +606,18 @@ label:after {
}
.create-dataset-form{
width: 50%;}
\ No newline at end of file
width: 50%;
}
.primary.span12 {
width: 100%;
}
.inline-error {
color: #d4004b;
margin-top: 5px;
}
.controls select {
width: 100%;
}
......@@ -24,6 +24,25 @@ is_required=false) %}
{%- set _type = 'text' if type=='date' and not value else type -%}
{%- set onFocus = 'onfocus=(this.type=\'date\')' if type=='date' and not value else '' -%}
{% call input_block(id or name, label, error, classes, extra_html=extra_html, is_required=is_required) %}
<div class="row-fluid">
<div class="span6">
<input id="{{ id or name }}" type="{{ _type }}" name="{{ name }}" value="{{ value | empty_and_escape }}" placeholder="{{ placeholder }}"
{{ onFocus }} {{ attributes(attrs) }} />
</div>
<div class="span6 inline-error">
{{error}}
</div>
</div>
{% endcall %}
{% endmacro %}
{% macro input_raw(name, id='', label='', value='', placeholder='', type='text', error="", classes=[], attrs={},
is_required=false) %}
{%- set extra_html = caller() if caller -%}
{%- set _type = 'text' if type=='date' and not value else type -%}
{%- set onFocus = 'onfocus=(this.type=\'date\')' if type=='date' and not value else '' -%}
{% call input_block(id or name, label, error, classes, extra_html=extra_html, is_required=is_required) %}
<input id="{{ id or name }}" type="{{ _type }}" name="{{ name }}" value="{{ value | empty_and_escape }}" placeholder="{{ placeholder }}"
{{ onFocus }} {{ attributes(attrs) }} />
......@@ -137,8 +156,15 @@ options - A list/tuple of fields to be used as <options>.
{%- set extra_html = caller() if caller -%}
{% call input_block(id or name, label or name, error, classes, control_classes=["editor"],
extra_html=extra_html, is_required=is_required) %}
<div class="row-fluid">
<div class="span6">
<textarea id="{{ id or name }}" name="{{ name }}" cols="20" rows="5" placeholder="{{ placeholder }}"
{{ attributes(attrs) }}>{{ value | empty_and_escape }}</textarea>
</div>
<div class="span6 inline-error">
{{error}}
</div>
</div>
{% endcall %}
{% endmacro %}
......@@ -454,11 +480,11 @@ options - A list/tuple of fields to be used as <options>.
{% endif %}
{{ input(field_url, label=url_label, id='field-image-url', placeholder=placeholder,
value=data.get(field_url), error=errors.get(field_url), classes=['control-full']) }}
value=data.get(field_url), error='', classes=['control-full']) }}
{% if is_upload_enabled %}
{{ input(field_upload, label=upload_label, id='field-image-upload', type='file', placeholder='', value='',
error='', classes=['control-full'], is_required=true) }}
error=errors, classes=['control-full'], is_required=true) }}
{% if is_upload %}
{{ checkbox(field_clear, label=_('Clear Upload'), id='field-clear-upload', value='true', error='',
classes=['control-full']) }}
......
{% ckan_extends %}
{% block main_content %}
{% block flash %}
{{ super() }}
{% endblock %}
{% block toolbar %}
{{ super() }}
{% endblock %}
<div class="row wrapper{% block wrapper_class %}{% endblock %}{% if self.secondary()|trim == '' %} no-nav{% endif %}">
{#
The pre_primary block can be used to add content to before the
rendering of the main content columns of the page.
#}
{% block pre_primary %}
{% endblock %}
{% block secondary %}
{% endblock %}
{% block primary %}
<div class="primary span12">
{% block primary_content %}
{{ super() }}
{% endblock %}
</div>
{% endblock %}
</div>
{% endblock %}
......@@ -16,7 +16,7 @@
include_metadata=false, pkg_name=pkg_name, stage=stage, allow_upload=g.ofs_impl and logged_in,
dataset_type=dataset_type %}{% endblock %}
{% block secondary_content %}
{% block secondary %}
{% endblock %}
{% block scripts %}
......
......@@ -4,8 +4,9 @@
<!-- field title -->
{% block package_basic_fields_title %}
{% set error_string = _(_('Title') + ': '+errors.title[0]) if errors.title %}
{{ form.input('title', id='field-title', label=_('Title'), value=data.title,
error=errors.title, classes=['control-full', 'control-large'], attrs={'data-module': 'slug-preview-target'},
error=error_string, classes=['control-full'], attrs={'data-module': 'slug-preview-target'},
is_required=true,placeholder=_('Enter title')) }}
{% endblock %}
......@@ -23,23 +24,25 @@ is_required=true,placeholder=_('Enter title')) }}
<!-- field notes -->
{% block package_basic_fields_description %}
{% set error_string = _(_('Description') + ': '+errors.notes[0]) if errors.notes %}
{{ form.markdown('notes', id='field-notes', label=_('Description'), value=data.notes,
error=errors.notes, is_required=true, placeholder=_('Enter description')) }}
error=error_string, is_required=true, placeholder=_('Enter description')) }}
{% endblock %}
<!-- field license -->
<label class="control-label" for="field-license">
{{ _("License") }}:
<span title="{{ _("This field is required") }}" class="control-required">*</span>
</label>
<div class='row'>
<div class='span4'>
<div class='row-fluid'>
<div class='span3'>
{% block package_basic_fields_license %}
<div class="control-group">
{% set error = errors.license_id %}
<div class="controls">
<select id="field-license" name="license_id" class="span4">
<select id="field-license" name="license_id">
{% set existing_license_id = data.get('license_id') %}
{% for license_id, license_desc in h.license_options(existing_license_id) %}
<option value="{{ license_id }}" {% if existing_license_id==license_id %}selected="selected" {%
......@@ -50,49 +53,55 @@ is_required=true,placeholder=_('Enter title')) }}
</div>
</div>
</div>
<div class='span1'></div>
<div class='span4'>
<div class='span3'>
<!-- field Namensnennung -->
{{ form.input('access_constraints', id='field-licence-name', value=data.access_constraints,
{{ form.input_raw('access_constraints', id='field-licence-name', value=data.access_constraints,
error=errors.access_constraints,
classes=['control-full span4'],type='text',is_required=true,attrs={'disabled':true,
classes=['control-full'],type='text',is_required=true,attrs={'disabled':true,
'data-module':"odsh_form", 'data-module-licensetoggle':'true' }, placeholder=_('enter name')) }}
</div>
<div class="span6 inline-error">
{{error}}
</div>
</div>
{% endblock %}
<!-- timerange -->
<div class='row'>
{% set error_string = _(_('Temporal end') + ': '+errors.temporal_end[0]) if errors.temporal_end %}
<label for="start-end" class="control-label">{{ _('timerange') }}:
<span title="{{ _("This field is required") }}" class="control-required">*</span>
</label>
<div id='start-end' class='span4'>
<div class='row-fluid'>
<div id='start-end' class='span3'>
<!-- field temporal_start -->
{% set temporal_start_label=_('odsh_temporal_start_label') %}
{{ form.input('temporal_start', id='field-temporal-start', value=data.temporal_start,
{{ form.input_raw('temporal_start', id='field-temporal-start', value=data.temporal_start,
error=errors.temporal_start,
classes=['control-full'],type='date',is_required=true,placeholder=_('from'))
}}
</div>
<div class='span1'></div>
<div class='span4'>
<div class='span3'>
<!-- field temporal_end -->
{% set temporal_end_label='Ende des Zeitraumes' %}
{{ form.input('temporal_end', id='field-temporal-end', value=data.temporal_end,
{{ form.input_raw('temporal_end', id='field-temporal-end', value=data.temporal_end,
error=errors.temporal_end, classes=['control-full'],type='date',is_required=true, placeholder=_('to'))
}}
</div>
<div class="span6 inline-error">
{{error_string}}
</div>
</div>
<!-- field publish date -->
{% set publish_date_value=h.odsh_now() %}
{% set error_string = _('odsh_publish_date_error_label') if errors.publish_date %}
<!-- if form_style != 'edit' && !%} -->
<!-- value=data.get('extras').publish_date, -->
{% set publish_date_label='Veröffentlichungsdatum'%}
{{ form.input('publish_date', id='field-publish-date', label=publish_date_label,
value=publish_date_value,
error=errors.publish_date, classes=['control-full'],type='date',is_required=true) }}
error=error_string, classes=['control-full'],type='date',is_required=true) }}
<!-- field tags -->
......@@ -110,16 +119,20 @@ is_required=true,placeholder=_('Enter title')) }}
{% endblock %}
<!-- field spatial_extension -->
{% set error_string = _('odsh_spatial_extension_error_label') if errors.spatial_extension %}
{{ form.input('spatial_extension', id='field-spatial-extension', label=_('Spatial extension'),
value=data.spatial_extension,
error=errors.spatial_extension, classes=['control-full'],type='text',is_required=true,
error=error_string, classes=['control-full'],type='text',is_required=true,
placeholder=_('Enter spatial extension')) }}
<!-- field private -->
<div class="control-group">
<label for="field-private" class="control-label">{{ _('Visibility') }}:
<span title="{{ _("This field is required") }}" class="control-required">*</span>
</label>
<div class="controls">
<div class="row-fluid">
<div class="span6">
<select id="field-private" name="private">
{% for option in [('True', _('Private')), ('False', _('Public'))] %}
<option value="{{ option[0] }}" {% if option[0]==data.private|trim %}selected="selected" {% endif %}>{{
......@@ -128,12 +141,16 @@ is_required=true,placeholder=_('Enter title')) }}
</select>
</div>
</div>
</div>
</div>
{% if data.id and h.check_access('package_delete', {'id': data.id}) and data.state != 'active' %}
<div class="control-group">
<label for="field-state" class="control-label">{{ _('State') }}</label>
<div class="controls">
<div class="row-fluid">
<div class="span6">
<select id="field-state" name="state">
<option value="active" {% if data.get('state', 'none' )=='active' %} selected="selected" {% endif %}>{{
_('Active') }}</option>
......@@ -142,4 +159,6 @@ is_required=true,placeholder=_('Enter title')) }}
</select>
</div>
</div>
</div>
</div>
{% endif %}
......@@ -11,7 +11,7 @@ then itself be extended to add/remove blocks of functionality. #}
<input type="hidden" name="_ckan_phase" value="dataset_new_1" />
{# pkg_name used in 3 stage edit #}
<input type="hidden" name="pkg_name" value="{{ data.id }}" />
{% block errors %}{{ form.errors(error_summary) }}{% endblock %}
{# {% block errors %}{{ form.errors(error_summary) }}{% endblock %} #}
{% block basic_fields %}
{% snippet 'package/snippets/package_basic_fields.html', data=data, errors=errors, licenses=c.licenses,
......@@ -32,9 +32,12 @@ then itself be extended to add/remove blocks of functionality. #}
{% endif %}
{% endblock %}
{% block save_button %}
<div class="row-fluid">
<div class="span6">
<button class="btn btn-primary" type="submit" name="save">{% block save_button_text %}{{ _('Next: Add Data')
}}{%
endblock %}</button>
}}{% endblock %}</button>
</div>
</div>
{% endblock %}
</div>
{% endblock %}
......
......@@ -16,27 +16,31 @@
{% endif %}
{% endblock %}
{% block errors %}{{ form.errors(error_summary) }}{% endblock %}
{# {% block errors %}{{ form.errors(error_summary) }}{% endblock %} #}
<input name="id" value="{{ data.id }}" type="hidden" />
{% block basic_fields %}
{% block basic_fields_url %}
{% set is_upload = (data.url_type == 'upload') %}
{{ form.image_upload(data, errors, field_url='url', field_upload='upload', field_clear='clear_upload',
{% set error_string = _('odsh_resource_upload_error_label') if error_summary %}
{{ form.image_upload(data, error_string, field_url='url', field_upload='upload', field_clear='clear_upload',
is_upload_enabled=h.uploads_enabled(), is_url=data.url and not is_upload, is_upload=is_upload,
upload_label=_('Data-Upload'), url_label=_('URL'), placeholder=_('http://example.com/external-data.csv'),
field_name='name') }}
{% endblock %}
{% block basic_fields_name %}
{% set error_string = _('odsh_resource_name_error_label') if errors.name %}
{{ form.input('name', id='field-name', label=_('Name'), placeholder=_('Enter name of the dataset'),
value=data.name, error=errors.name, classes=['control-full'], is_required=true) }}
value=data.name, error=error_string, classes=['control-full'], is_required=true) }}
{% endblock %}
{% block basic_fields_description %}
{% set error_string = _('odsh_resource_description_error_label') if errors.description %}
{{ form.markdown('description', id='field-description', label=_('Description'),
placeholder=_('Enter description of the dataset'), value=data.description, error=errors.description,
placeholder=_('Enter description of the dataset'), value=data.description, error=error_string,
is_required=true) }}
{% endblock %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment