kopia lustrzana https://github.com/wagtail/wagtail
Make generic/confirm_unpublish.html template extend generic/base.html template
rodzic
e63b42b547
commit
faa37c0068
|
@ -1,31 +1,27 @@
|
|||
{% extends "wagtailadmin/base.html" %}
|
||||
{% extends "wagtailadmin/generic/base.html" %}
|
||||
{% load i18n wagtailadmin_tags %}
|
||||
{% block titletag %}{% blocktrans trimmed with title=object_display_title %}Unpublish {{ title }}{% endblocktrans %}{% endblock %}
|
||||
{% block content %}
|
||||
{% include "wagtailadmin/shared/header.html" with title=_("Unpublish") subtitle=object_display_title icon=header_icon %}
|
||||
|
||||
<div class="nice-padding">
|
||||
{% if usage_url %}
|
||||
{% include "wagtailadmin/shared/usage_summary.html" %}
|
||||
{% endif %}
|
||||
{% block confirmation_text %}
|
||||
<p>
|
||||
{% blocktrans trimmed with model_name=model_opts.verbose_name %}
|
||||
Are you sure you want to unpublish this {{ model_name }}?
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
{% block main_content %}
|
||||
{% if usage_url %}
|
||||
{% include "wagtailadmin/shared/usage_summary.html" %}
|
||||
{% endif %}
|
||||
{% block confirmation_text %}
|
||||
<p>
|
||||
{% blocktrans trimmed with model_name=model_opts.verbose_name %}
|
||||
Are you sure you want to unpublish this {{ model_name }}?
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
||||
<form action="{{ unpublish_url }}" method="POST">
|
||||
{% csrf_token %}
|
||||
|
||||
{% block form_content %}
|
||||
{% endblock %}
|
||||
|
||||
<form action="{{ unpublish_url }}" method="POST">
|
||||
{% csrf_token %}
|
||||
|
||||
{% block form_content %}
|
||||
{% endblock %}
|
||||
|
||||
<div>
|
||||
<button class="button" type="submit">{% trans 'Yes, unpublish it' %}</button>
|
||||
<a href="{{ next_url }}" class="button button-secondary">{% trans "No, don't unpublish" %}</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<button class="button" type="submit">{% trans 'Yes, unpublish it' %}</button>
|
||||
<a href="{{ next_url }}" class="button button-secondary">{% trans "No, don't unpublish" %}</a>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1324,6 +1324,7 @@ class UnpublishView(HookResponseMixin, WagtailAdminTemplateMixin, TemplateView):
|
|||
edit_url_name = None
|
||||
unpublish_url_name = None
|
||||
usage_url_name = None
|
||||
page_title = gettext_lazy("Unpublish")
|
||||
success_message = gettext_lazy("'%(object)s' unpublished.")
|
||||
template_name = "wagtailadmin/generic/confirm_unpublish.html"
|
||||
|
||||
|
@ -1344,12 +1345,15 @@ class UnpublishView(HookResponseMixin, WagtailAdminTemplateMixin, TemplateView):
|
|||
def get_usage(self):
|
||||
return ReferenceIndex.get_grouped_references_to(self.object)
|
||||
|
||||
def get_breadcrumbs_items(self):
|
||||
return []
|
||||
|
||||
def get_objects_to_unpublish(self):
|
||||
# Hook to allow child classes to have more objects to unpublish (e.g. page descendants)
|
||||
return [self.object]
|
||||
|
||||
def get_object_display_title(self):
|
||||
return str(self.object)
|
||||
def get_page_subtitle(self):
|
||||
return get_latest_str(self.object)
|
||||
|
||||
def get_success_message(self):
|
||||
if self.success_message is None:
|
||||
|
@ -1415,7 +1419,6 @@ class UnpublishView(HookResponseMixin, WagtailAdminTemplateMixin, TemplateView):
|
|||
context = super().get_context_data(**kwargs)
|
||||
context["model_opts"] = self.object._meta
|
||||
context["object"] = self.object
|
||||
context["object_display_title"] = self.get_object_display_title()
|
||||
context["unpublish_url"] = self.get_unpublish_url()
|
||||
context["next_url"] = self.get_next_url()
|
||||
context["usage_url"] = self.get_usage_url()
|
||||
|
|
Ładowanie…
Reference in New Issue