Skip to content

Commit

Permalink
#334 Create admin delete mixin templates
Browse files Browse the repository at this point in the history
  • Loading branch information
viliambalaz committed Jan 9, 2022
1 parent 379d1f0 commit d8f0ff2
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 91 deletions.
1 change: 0 additions & 1 deletion chcemvediet/apps/inforequests/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
Original file line number Diff line number Diff line change
@@ -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 %}
Original file line number Diff line number Diff line change
@@ -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 %}
Original file line number Diff line number Diff line change
@@ -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 %}
Original file line number Diff line number Diff line change
@@ -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 %}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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 %}
Original file line number Diff line number Diff line change
@@ -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 %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% if outbound %}
<p>The following outbound messages will be deleted:</p>
<ul>{{ outbound|unordered_list }}</ul>
{% endif %}
{% if inbound %}
<p>The following inbound messages will be marked undecided:</p>
<ul>{{ inbound|unordered_list }}</ul>
{% endif %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% if snoozed_actions %}
<p>
<label><input name="snooze" type="checkbox" /> Extend snooze of previous actions by
{{ ADMIN_EXTEND_SNOOZE_BY_DAYS }} days from today? All of the following actions will be
snoozed:
</label>
</p>
<ul>{{ snoozed_actions|unordered_list }}</ul>
{% endif %}
16 changes: 16 additions & 0 deletions poleno/utils/templates/utils/admin/bulk_delete_mixin.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{% load set_attributes from poleno.amend %}

{% if delete_warnings %}
<ul class="messagelist">
{% for warning in delete_warnings %}
<li class="warning">{{ warning }}</li>
{% endfor %}
</ul>
{% endif %}
{% if delete_constraints %}
<div class="errornote">
<p>Delete not allowed.</p>
<ul>{{ delete_constraints|unordered_list }}</ul>
</div>
{% set_attributes path=".//form//input[@type='submit']" disabled=True %}
{% endif %}

0 comments on commit d8f0ff2

Please sign in to comment.