-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #184 from wagtail/182-deleting-the-page-deletes-it…
…s-variants Delete page variants when deleting the page
- Loading branch information
Showing
8 changed files
with
216 additions
and
7 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
src/wagtail_personalisation/migrations/0019_auto_20180526_1425.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/wagtail_personalisation/migrations/0020_rules_delete_relatedqueryname.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/wagtail_personalisation/migrations/0021_personalisablepagemetadata_canonical_protect.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Generated by Django 2.0.7 on 2018-07-05 13:25 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('wagtail_personalisation', '0020_rules_delete_relatedqueryname'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='personalisablepagemetadata', | ||
name='canonical_page', | ||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='personalisable_canonical_metadata', to='wagtailcore.Page'), | ||
), | ||
migrations.AlterField( | ||
model_name='personalisablepagemetadata', | ||
name='variant', | ||
field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='_personalisable_page_metadata', to='wagtailcore.Page'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
..._personalisation/templates/wagtailadmin/pages/wagtail_personalisation/confirm_delete.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{% extends "wagtailadmin/base.html" %} | ||
|
||
{% load i18n wagtailadmin_tags %} | ||
|
||
{% block content %} | ||
{% trans "Delete" as del_str %} | ||
{% include "wagtailadmin/shared/header.html" with title=del_str subtitle=page.get_admin_display_title icon="doc-empty-inverse" %} | ||
|
||
<div class="nice-padding"> | ||
<p> | ||
{% trans 'Are you sure you want to delete this page?' %} | ||
{% if descendant_count %} | ||
{% blocktrans count counter=descendant_count %} | ||
This will also delete one more subpage. | ||
{% plural %} | ||
This will also delete {{ descendant_count }} more subpages. | ||
{% endblocktrans %} | ||
{% endif %} | ||
</p> | ||
{% if variants %} | ||
<p> | ||
{% blocktrans count counter=variants|length %} | ||
This page is personalisable. Deleting it will delete its variant: | ||
{% plural %} | ||
This page is personalisable. Deleting it will delete all of its variants: | ||
{% endblocktrans %} | ||
</p> | ||
<ul> | ||
{% for variant in variants %} | ||
<li> | ||
<a href="{% url 'wagtailadmin_explore' variant.pk %}"> | ||
{{ variant }} | ||
</a> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
|
||
<form action="{% url 'wagtailadmin_pages:delete' page.id %}" method="POST"> | ||
{% csrf_token %} | ||
<input type="hidden" name="next" value="{{ next }}"> | ||
{% if variants %} | ||
{% trans 'Yes, delete the page and its variants' as submit_button_value %} | ||
{% else %} | ||
{% trans 'Yes, delete it' as submit_button_value %} | ||
{% endif %} | ||
<input type="submit" value="{{ submit_button_value }}" class="button serious"> | ||
<a href="{% if next %}{{ next }}{% else %}{% url 'wagtailadmin_explore' page.get_parent.id %}{% endif %}" class="button button-secondary">{% trans "No, don't delete it" %}</a> | ||
</form> | ||
|
||
{% page_permissions page as page_perms %} | ||
{% if page_perms.can_unpublish %} | ||
{% url 'wagtailadmin_pages:unpublish' page.id as unpublish_url %} | ||
<p style="margin-top: 1em">{% blocktrans %}Alternatively you can <a href="{{ unpublish_url }}">unpublish the page</a>. This removes the page from public view and you can edit or publish it again later.{% endblocktrans %}</p> | ||
{% endif %} | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters