kopia lustrzana https://github.com/wagtail/wagtail
Refactor snippet create/edit headers to avoid duplication
rodzic
bd70ecf318
commit
ae7897c842
|
@ -38,14 +38,16 @@
|
|||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="right">
|
||||
{% if action_url %}
|
||||
<div class="actionbutton">
|
||||
{% with action_icon|default:'plus' as action_icon_name %}
|
||||
<a href="{{ action_url }}" class="button bicolor button--icon">{% icon name=action_icon_name wrapped=1 %}{{ action_text }}</a>
|
||||
{% endwith %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="{% block right_column_classname %}right{% endblock %}">
|
||||
{% block right_column %}
|
||||
{% if action_url %}
|
||||
<div class="actionbutton">
|
||||
{% with action_icon|default:'plus' as action_icon_name %}
|
||||
<a href="{{ action_url }}" class="button bicolor button--icon">{% icon name=action_icon_name wrapped=1 %}{{ action_text }}</a>
|
||||
{% endwith %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
{% extends "wagtailadmin/shared/header.html" %}
|
||||
|
||||
{% block right_column_classname %}right col{% endblock %}
|
||||
{% block right_column %}
|
||||
<form> {# HACK Removes list-style-type #}
|
||||
<ul class="fields row rowflush">
|
||||
{% if locale %}
|
||||
<li class="col">
|
||||
<div class="field">
|
||||
{% include 'wagtailadmin/shared/locale_selector.html' with class='c-dropdown--large' %}
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</form>
|
||||
{{ block.super }}
|
||||
{% endblock %}
|
|
@ -2,29 +2,8 @@
|
|||
{% load i18n wagtailadmin_tags %}
|
||||
{% block titletag %}{% blocktrans with snippet_type_name=model_opts.verbose_name %}New {{ snippet_type_name }}{% endblocktrans %}{% endblock %}
|
||||
{% block content %}
|
||||
<header class="merged tab-merged">
|
||||
<div class="row">
|
||||
<div class="left">
|
||||
<div class="col header-title">
|
||||
<h1>{% icon name="snippet" class_name="header-title-icon" %}
|
||||
{% trans "New" %} <span>{{ model_opts.verbose_name }}</span></h1>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right col">
|
||||
<form> {# HACK Removes list-style-type #}
|
||||
<ul class="fields row rowflush">
|
||||
{% if locale %}
|
||||
<li class="col">
|
||||
<div class="field">
|
||||
{% include 'wagtailadmin/shared/locale_selector.html' with class='c-dropdown--large' %}
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
{% trans "New" as new_str %}
|
||||
{% include "wagtailadmin/shared/header_with_locale_selector.html" with title=new_str subtitle=model_opts.verbose_name icon="snippet" tabbed=1 merged=1 %}
|
||||
|
||||
<form action="{% url 'wagtailsnippets:add' model_opts.app_label model_opts.model_name %}{% if locale %}?locale={{ locale.language_code }}{% endif %}" method="POST" novalidate{% if form.is_multipart %} enctype="multipart/form-data"{% endif %}>
|
||||
{% csrf_token %}
|
||||
|
|
|
@ -2,29 +2,8 @@
|
|||
{% load wagtailadmin_tags i18n %}
|
||||
{% block titletag %}{% blocktrans with snippet_type_name=model_opts.verbose_name %}Editing {{ snippet_type_name }} - {{ instance }}{% endblocktrans %}{% endblock %}
|
||||
{% block content %}
|
||||
<header class="merged tab-merged">
|
||||
<div class="row">
|
||||
<div class="left">
|
||||
<div class="col header-title">
|
||||
<h1>{% icon name="snippet" class_name="header-title-icon" %}
|
||||
{% trans "Editing" %} <span>{{ instance }}</span></h1>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right col">
|
||||
<form> {# HACK Removes list-style-type #}
|
||||
<ul class="fields row rowflush">
|
||||
{% if locale %}
|
||||
<li class="col">
|
||||
<div class="field">
|
||||
{% include 'wagtailadmin/shared/locale_selector.html' with class='c-dropdown--large' %}
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
{% trans "Editing" as editing_str %}
|
||||
{% include "wagtailadmin/shared/header_with_locale_selector.html" with title=editing_str subtitle=instance icon="snippet" tabbed=1 merged=1 %}
|
||||
|
||||
<div class="row row-flush">
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue