From d8f0ff24520841a5e53a4c9fabfa16f8f986e6ca Mon Sep 17 00:00:00 2001 From: viliambalaz Date: Sun, 9 Jan 2022 14:05:11 +0100 Subject: [PATCH] #334 Create admin delete mixin templates --- chcemvediet/apps/inforequests/admin.py | 1 - .../action/delete_confirmation.html | 17 +++++++ .../action/delete_selected_confirmation.html | 17 +++++++ .../branch/delete_confirmation.html | 14 ++++++ .../branch/delete_selected_confirmation.html | 14 ++++++ .../inforequests/delete_confirmation.html | 45 ------------------- .../delete_selected_confirmation.html | 45 ------------------- .../inforequestemail/delete_confirmation.html | 11 +++++ .../delete_selected_confirmation.html | 11 +++++ ...delete_nested_inforequest_email_mixin.html | 8 ++++ .../mixins/snoozed_actions_mixin.html | 9 ++++ .../utils/admin/bulk_delete_mixin.html | 16 +++++++ 12 files changed, 117 insertions(+), 91 deletions(-) create mode 100644 chcemvediet/apps/inforequests/templates/admin/inforequests/action/delete_confirmation.html create mode 100644 chcemvediet/apps/inforequests/templates/admin/inforequests/action/delete_selected_confirmation.html create mode 100644 chcemvediet/apps/inforequests/templates/admin/inforequests/branch/delete_confirmation.html create mode 100644 chcemvediet/apps/inforequests/templates/admin/inforequests/branch/delete_selected_confirmation.html delete mode 100644 chcemvediet/apps/inforequests/templates/admin/inforequests/delete_confirmation.html delete mode 100644 chcemvediet/apps/inforequests/templates/admin/inforequests/delete_selected_confirmation.html create mode 100644 chcemvediet/apps/inforequests/templates/admin/inforequests/inforequestemail/delete_confirmation.html create mode 100644 chcemvediet/apps/inforequests/templates/admin/inforequests/inforequestemail/delete_selected_confirmation.html create mode 100644 chcemvediet/apps/inforequests/templates/admin/inforequests/mixins/delete_nested_inforequest_email_mixin.html create mode 100644 chcemvediet/apps/inforequests/templates/admin/inforequests/mixins/snoozed_actions_mixin.html create mode 100644 poleno/utils/templates/utils/admin/bulk_delete_mixin.html diff --git a/chcemvediet/apps/inforequests/admin.py b/chcemvediet/apps/inforequests/admin.py index 5ea0e89c0..bb40c40b7 100644 --- a/chcemvediet/apps/inforequests/admin.py +++ b/chcemvediet/apps/inforequests/admin.py @@ -438,7 +438,6 @@ def render_delete_form(self, request, context): context[u'ADMIN_EXTEND_SNOOZE_BY_DAYS'] = ADMIN_EXTEND_SNOOZE_BY_DAYS return super(ActionAdmin, self).render_delete_form(request, context) - @decorate(short_description=u'Delete selected actions') @transaction.atomic def delete_selected(self, request, queryset): snoozed_actions = [] diff --git a/chcemvediet/apps/inforequests/templates/admin/inforequests/action/delete_confirmation.html b/chcemvediet/apps/inforequests/templates/admin/inforequests/action/delete_confirmation.html new file mode 100644 index 000000000..a4284f5d1 --- /dev/null +++ b/chcemvediet/apps/inforequests/templates/admin/inforequests/action/delete_confirmation.html @@ -0,0 +1,17 @@ +{% extends "admin/delete_confirmation.html" %} +{% load amend prepend before after from poleno.amend %} + +{% block content %} + {% amend %} + {{ block.super }} + {% after path="./ul[last()]" %} + {% include "admin/inforequests/mixins/delete_nested_inforequest_email_mixin.html" %} + {% endafter %} + {% prepend path=".//form" %} + {% include "admin/inforequests/mixins/snoozed_actions_mixin.html" %} + {% endprepend %} + {% before path=".//form//input[@type='submit']" %} + {% include "utils/admin/bulk_delete_mixin.html" %} + {% endbefore %} + {% endamend %} +{% endblock %} diff --git a/chcemvediet/apps/inforequests/templates/admin/inforequests/action/delete_selected_confirmation.html b/chcemvediet/apps/inforequests/templates/admin/inforequests/action/delete_selected_confirmation.html new file mode 100644 index 000000000..8e71da6d1 --- /dev/null +++ b/chcemvediet/apps/inforequests/templates/admin/inforequests/action/delete_selected_confirmation.html @@ -0,0 +1,17 @@ +{% extends "admin/delete_selected_confirmation.html" %} +{% load amend prepend before after from poleno.amend %} + +{% block content %} + {% amend %} + {{ block.super }} + {% after path="./ul[last()]" %} + {% include "admin/inforequests/mixins/delete_nested_inforequest_email_mixin.html" %} + {% endafter %} + {% prepend path=".//form" %} + {% include "admin/inforequests/mixins/snoozed_actions_mixin.html" %} + {% endprepend %} + {% before path=".//form//input[@type='submit']" %} + {% include "utils/admin/bulk_delete_mixin.html" %} + {% endbefore %} + {% endamend %} +{% endblock %} diff --git a/chcemvediet/apps/inforequests/templates/admin/inforequests/branch/delete_confirmation.html b/chcemvediet/apps/inforequests/templates/admin/inforequests/branch/delete_confirmation.html new file mode 100644 index 000000000..14eb7e8f6 --- /dev/null +++ b/chcemvediet/apps/inforequests/templates/admin/inforequests/branch/delete_confirmation.html @@ -0,0 +1,14 @@ +{% extends "admin/delete_confirmation.html" %} +{% load amend before after from poleno.amend %} + +{% block content %} + {% amend %} + {{ block.super }} + {% after path="./ul[last()]" %} + {% include "admin/inforequests/mixins/delete_nested_inforequest_email_mixin.html" %} + {% endafter %} + {% before path=".//form//input[@type='submit']" %} + {% include "utils/admin/bulk_delete_mixin.html" %} + {% endbefore %} + {% endamend %} +{% endblock %} diff --git a/chcemvediet/apps/inforequests/templates/admin/inforequests/branch/delete_selected_confirmation.html b/chcemvediet/apps/inforequests/templates/admin/inforequests/branch/delete_selected_confirmation.html new file mode 100644 index 000000000..ac34c37ca --- /dev/null +++ b/chcemvediet/apps/inforequests/templates/admin/inforequests/branch/delete_selected_confirmation.html @@ -0,0 +1,14 @@ +{% extends "admin/delete_selected_confirmation.html" %} +{% load amend before after from poleno.amend %} + +{% block content %} + {% amend %} + {{ block.super }} + {% after path="./ul[last()]" %} + {% include "admin/inforequests/mixins/delete_nested_inforequest_email_mixin.html" %} + {% endafter %} + {% before path=".//form//input[@type='submit']" %} + {% include "utils/admin/bulk_delete_mixin.html" %} + {% endbefore %} + {% endamend %} +{% endblock %} diff --git a/chcemvediet/apps/inforequests/templates/admin/inforequests/delete_confirmation.html b/chcemvediet/apps/inforequests/templates/admin/inforequests/delete_confirmation.html deleted file mode 100644 index 10fd2ac01..000000000 --- a/chcemvediet/apps/inforequests/templates/admin/inforequests/delete_confirmation.html +++ /dev/null @@ -1,45 +0,0 @@ -{% extends "admin/delete_confirmation.html" %} -{% load amend prepend before after set_attributes from poleno.amend %} - -{% block content %} - {% amend %} - {{ block.super }} - {% after path="./ul[last()]" %} - {% if outbound %} -

The following outbound messages will be deleted:

- - {% endif %} - {% if inbound %} -

The following inbound messages will be marked undecided:

- - {% endif %} - {% endafter %} - {% if snoozed_actions %} - {% prepend path=".//form" %} -

- -

- - {% endprepend %} - {% endif %} - {% before path=".//form//input[@type='submit']" %} - {% if delete_warnings %} - - {% endif %} - {% if delete_constraints %} -
-

Delete not allowed.

- -
- {% set_attributes path=".//form//input[@type='submit']" disabled=True %} - {% endif %} - {% endbefore %} - {% endamend %} -{% endblock %} diff --git a/chcemvediet/apps/inforequests/templates/admin/inforequests/delete_selected_confirmation.html b/chcemvediet/apps/inforequests/templates/admin/inforequests/delete_selected_confirmation.html deleted file mode 100644 index 8be8a9cc5..000000000 --- a/chcemvediet/apps/inforequests/templates/admin/inforequests/delete_selected_confirmation.html +++ /dev/null @@ -1,45 +0,0 @@ -{% extends "admin/delete_selected_confirmation.html" %} -{% load amend prepend before after set_attributes from poleno.amend %} - -{% block content %} - {% amend %} - {{ block.super }} - {% after path="./ul[last()]" %} - {% if outbound %} -

The following outbound messages will be deleted:

- - {% endif %} - {% if inbound %} -

The following inbound messages will be marked undecided:

- - {% endif %} - {% endafter %} - {% if snoozed_actions %} - {% prepend path=".//form" %} -

- -

- - {% endprepend %} - {% endif %} - {% before path=".//form//input[@type='submit']" %} - {% if delete_warnings %} - - {% endif %} - {% if delete_constraints %} -
-

Delete not allowed.

- -
- {% set_attributes path=".//form//input[@type='submit']" disabled=True %} - {% endif %} - {% endbefore %} - {% endamend %} -{% endblock %} diff --git a/chcemvediet/apps/inforequests/templates/admin/inforequests/inforequestemail/delete_confirmation.html b/chcemvediet/apps/inforequests/templates/admin/inforequests/inforequestemail/delete_confirmation.html new file mode 100644 index 000000000..044be9b5e --- /dev/null +++ b/chcemvediet/apps/inforequests/templates/admin/inforequests/inforequestemail/delete_confirmation.html @@ -0,0 +1,11 @@ +{% extends "admin/delete_confirmation.html" %} +{% load amend before from poleno.amend %} + +{% block content %} + {% amend %} + {{ block.super }} + {% before path=".//form//input[@type='submit']" %} + {% include "utils/admin/bulk_delete_mixin.html" %} + {% endbefore %} + {% endamend %} +{% endblock %} diff --git a/chcemvediet/apps/inforequests/templates/admin/inforequests/inforequestemail/delete_selected_confirmation.html b/chcemvediet/apps/inforequests/templates/admin/inforequests/inforequestemail/delete_selected_confirmation.html new file mode 100644 index 000000000..1b7fb0b78 --- /dev/null +++ b/chcemvediet/apps/inforequests/templates/admin/inforequests/inforequestemail/delete_selected_confirmation.html @@ -0,0 +1,11 @@ +{% extends "admin/delete_selected_confirmation.html" %} +{% load amend before from poleno.amend %} + +{% block content %} + {% amend %} + {{ block.super }} + {% before path=".//form//input[@type='submit']" %} + {% include "utils/admin/bulk_delete_mixin.html" %} + {% endbefore %} + {% endamend %} +{% endblock %} diff --git a/chcemvediet/apps/inforequests/templates/admin/inforequests/mixins/delete_nested_inforequest_email_mixin.html b/chcemvediet/apps/inforequests/templates/admin/inforequests/mixins/delete_nested_inforequest_email_mixin.html new file mode 100644 index 000000000..1d8f69bff --- /dev/null +++ b/chcemvediet/apps/inforequests/templates/admin/inforequests/mixins/delete_nested_inforequest_email_mixin.html @@ -0,0 +1,8 @@ +{% if outbound %} +

The following outbound messages will be deleted:

+ +{% endif %} +{% if inbound %} +

The following inbound messages will be marked undecided:

+ +{% endif %} diff --git a/chcemvediet/apps/inforequests/templates/admin/inforequests/mixins/snoozed_actions_mixin.html b/chcemvediet/apps/inforequests/templates/admin/inforequests/mixins/snoozed_actions_mixin.html new file mode 100644 index 000000000..c20ac150a --- /dev/null +++ b/chcemvediet/apps/inforequests/templates/admin/inforequests/mixins/snoozed_actions_mixin.html @@ -0,0 +1,9 @@ +{% if snoozed_actions %} +

+ +

+ +{% endif %} diff --git a/poleno/utils/templates/utils/admin/bulk_delete_mixin.html b/poleno/utils/templates/utils/admin/bulk_delete_mixin.html new file mode 100644 index 000000000..ef989cec7 --- /dev/null +++ b/poleno/utils/templates/utils/admin/bulk_delete_mixin.html @@ -0,0 +1,16 @@ +{% load set_attributes from poleno.amend %} + +{% if delete_warnings %} + +{% endif %} +{% if delete_constraints %} +
+

Delete not allowed.

+ +
+ {% set_attributes path=".//form//input[@type='submit']" disabled=True %} +{% endif %}