Skip to content

Commit

Permalink
Merge pull request #41 from liip/fix/fix-org-edit-template
Browse files Browse the repository at this point in the history
Fix/fix org edit template
  • Loading branch information
bellisk authored Jan 25, 2024
2 parents fce50ce + 5cb2ae3 commit 205090a
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ckanext/switzerland/templates/organization/edit.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% extends "organization/base_form_page.html" %}

{% block subtitle %}{{ _('Edit') }} {{ g.template_title_delimiter }} {{ super() }}{% endblock %}

{% block breadcrumb_content %}
<li>{% link_for h.humanize_entity_type('organization', group_type, 'breadcrumb') or _('Organizations'), named_route=group_type+'.index' %}</li>
{% block breadcrumb_content_inner %}
<li>{% link_for h.get_localized_value(organization.title)|truncate(35), named_route=group_type+'.read', id=organization.name %}</li>
<li class="active">{% link_for _('Manage'), named_route=group_type+'.edit', id=organization.name %}</li>
{% endblock %}
{% endblock %}

{% block page_heading_class %}hide-heading{% endblock %}
{% block page_heading %}{{ _('Edit Organization') }}{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{% import 'macros/form.html' as form %}
{% if group_type is not defined %}
{% set group_type = c.group_type %}
{% endif %}


{%- if not group_type -%}
<p>
group_type not passed to template. your version of CKAN
might not be compatible with ckanext-scheming
</p>
{%- endif -%}

<form class="dataset-form form-horizontal" method="post" data-module="basic-form" enctype="multipart/form-data">
{{ h.csrf_input() if 'csrf_input' in h }}
{%- set schema = h.scheming_get_organization_schema(group_type) -%}
{%- for field in schema['fields'] -%}
{%- if field.form_snippet is not none -%}
{%- snippet 'scheming/snippets/form_field.html',
field=field, data=data, errors=errors, licenses=licenses,
entity_type='organization', object_type=group_type -%}
{%- endif -%}
{%- endfor -%}

{{ form.required_message() }}

<div class="form-actions">
{% block delete_button %}
{% if action == 'edit' %}
{% if h.check_access('group_delete', {'id': data.id}) and action=='edit' %}
{% set locale = h.dump_json({'content': _('Are you sure you want to delete this Organization?')}) %}
<a class="btn btn-danger pull-left" href="{% url_for controller=group_type, action='delete', id=data.id %}" data-module="confirm-action" data-module-i18n="{{ locale }}">{% block delete_button_text %}{{ _('Delete') }}{% endblock %}</a>
{% endif %}
{% endif %}
{% endblock %}
<button class="btn btn-primary" name="save" type="submit">
{% block save_text %}
{%- if action == "edit" -%}
{%- if 'humanize_entity_type' in h -%}
{{ h.humanize_entity_type('organization', group_type, 'update label') or _('Update Organization') }}
{%- else -%}
{{ _('Update Organization') }}
{%- endif -%}
{%- else -%}
{%- if 'humanize_entity_type' in h -%}
{{ h.humanize_entity_type('organization', group_type, 'create label') or _('Create Organization') }}
{%- else -%}
{{ _('Create Organization') }}
{%- endif -%}
{%- endif -%}
{% endblock %}
</button>
</div>
</form>

0 comments on commit 205090a

Please sign in to comment.