1
|
{% import 'macros/form.html' as form %}
|
2
|
|
3
|
<form class="dataset-form form-horizontal" method="post" data-module="basic-form" enctype="multipart/form-data">
|
4
|
{% block error_summary %}
|
5
|
{{ form.errors(error_summary) }}
|
6
|
{% endblock %}
|
7
|
|
8
|
{% block basic_fields %}
|
9
|
{% set attrs = {'data-module': 'slug-preview-target'} %}
|
10
|
{{ form.input('title', label=_('Name'), id='field-name', placeholder=_('My Organization'), value=data.title, error=errors.title, classes=['control-full'], attrs=attrs) }}
|
11
|
|
12
|
{# Perhaps these should be moved into the controller? #}
|
13
|
{% set prefix = h.url_for(controller='organization', action='read', id='') %}
|
14
|
{% set domain = h.url_for(controller='organization', action='read', id='', qualified=true) %}
|
15
|
{% set domain = domain|replace("http://", "")|replace("https://", "") %}
|
16
|
{% set attrs = {'data-module': 'slug-preview-slug', 'data-module-prefix': domain, 'data-module-placeholder': '<organization>'} %}
|
17
|
|
18
|
{{ form.prepend('name', label=_('URL'), prepend=prefix, id='field-url', placeholder=_('my-organization'), value=data.name, error=errors.name, attrs=attrs, is_required=true) }}
|
19
|
|
20
|
{{ form.markdown('description', label=_('Description'), id='field-description', placeholder=_('A little information about my organization...'), value=data.description, error=errors.description) }}
|
21
|
|
22
|
{% set is_upload = data.image_url and not data.image_url.startswith('http') %}
|
23
|
{% set is_url = data.image_url and data.image_url.startswith('http') %}
|
24
|
|
25
|
{{ form.image_upload(data, errors, is_upload_enabled=h.uploads_enabled(), is_url=is_url, is_upload=is_upload) }}
|
26
|
|
27
|
{% endblock %}
|
28
|
{% block custom_fields %}
|
29
|
{% endblock %}
|
30
|
|
31
|
{{ form.required_message() }}
|
32
|
|
33
|
<div class="form-actions">
|
34
|
{% block delete_button %}
|
35
|
{% if h.check_access('organization_delete', {'id': data.id}) %}
|
36
|
{% set locale = h.dump_json({'content': _('Are you sure you want to delete this Organization? This will delete all the public and private datasets belonging to this organization.')}) %}
|
37
|
<a class="btn btn-danger pull-left" href="{% url_for controller='organization', action='delete', id=data.id %}" data-module="confirm-action" data-module-i18n="{{ locale }}">{% block delete_button_text %}{{ _('Delete') }}{% endblock %}</a>
|
38
|
{% endif %}
|
39
|
{% endblock %}
|
40
|
<button class="btn btn-primary" name="save" type="submit">{% block save_text %}{{ _('Save Organization') }}{% endblock %}</button>
|
41
|
</div>
|
42
|
</form>
|