mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-24 12:23:11 +00:00
Simplify deletion admin templates
This commit is contained in:
parent
81afed8510
commit
f48d8c0865
6 changed files with 63 additions and 129 deletions
|
@ -39,8 +39,6 @@ class ModelUserAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
# Custom templates
|
# Custom templates
|
||||||
change_form_template = 'useradmin/change_form.html'
|
change_form_template = 'useradmin/change_form.html'
|
||||||
delete_confirmation_template = 'useradmin/delete_confirmation.html'
|
|
||||||
delete_selected_confirmation_template = 'useradmin/delete_selected_confirmation.html'
|
|
||||||
|
|
||||||
|
|
||||||
# Defines new management site
|
# Defines new management site
|
||||||
|
|
49
useradmin/static/useradmin/css/base.css
Normal file
49
useradmin/static/useradmin/css/base.css
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
/* Make admin buttons look like Bootstrap */
|
||||||
|
|
||||||
|
.button, input[type=submit] {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 6px 12px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 1.42857143;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
vertical-align: middle;
|
||||||
|
-ms-touch-action: manipulation;
|
||||||
|
touch-action: manipulation;
|
||||||
|
cursor: pointer;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 4px;
|
||||||
|
color: #333;
|
||||||
|
background: #fff none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button:hover, .button:active, .button:focus,
|
||||||
|
input[type=submit]:hover, input[type=submit]:active, input[type=submit]:focus {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #333;
|
||||||
|
background-color: #e6e6e6;
|
||||||
|
border-color: #adadad;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button:focus, input[type=submit]:focus {
|
||||||
|
border-color: #8c8c8c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button:active:focus, .button:active:hover,
|
||||||
|
input[type=submit]:active:focus, input[type=submit]:active:hover {
|
||||||
|
background-color: #d4d4d4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Object tools should be inline */
|
||||||
|
|
||||||
|
.object-tools {
|
||||||
|
padding-left: 0;
|
||||||
|
margin-left: -5px;
|
||||||
|
list-style: none;
|
||||||
|
}
|
|
@ -1,5 +1,11 @@
|
||||||
{# Please keep this template in sync with django/contrib/admin one #}
|
{# Please keep this template in sync with django/contrib/admin one #}
|
||||||
{% extends "users/sidebar.html" %}
|
{% extends "users/sidebar.html" %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% block extrastyle %}
|
||||||
|
{{ block.super }}
|
||||||
|
<link rel="stylesheet" type="text/css" href="{% static "useradmin/css/base.css" %}" />
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block title %}{{ title }}{% endblock %}
|
{% block title %}{{ title }}{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -20,18 +20,13 @@ You should have received a copy of the GNU General Public License along
|
||||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
{% load i18n admin_urls admin_modify %}
|
{% load i18n admin_urls %}
|
||||||
|
|
||||||
{% block object-tools %}
|
{# Add buttons style and icons #}
|
||||||
{% if change %}{% if not is_popup %}
|
{% block object-tools-items %}
|
||||||
<ul class="object-tools list-inline">
|
<li class="btn-group">
|
||||||
{% block object-tools-items %}
|
{% url opts|admin_urlname:'history' original.pk|admin_urlquote as history_url %}
|
||||||
<li class="btn-group">
|
<a href="{% add_preserved_filters history_url %}" class="historylink btn btn-default"><span class="glyphicon glyphicon-list-alt"></span> {% trans "History" %}</a>
|
||||||
{% url opts|admin_urlname:'history' original.pk|admin_urlquote as history_url %}
|
</li>
|
||||||
<a href="{% add_preserved_filters history_url %}" class="historylink btn btn-default"><span class="glyphicon glyphicon-list-alt"></span> {% trans "History" %}</a>
|
{% if has_absolute_url %}<li class="btn-group"><a href="{{ absolute_url }}" class="viewsitelink btn btn-default"><span class="glyphicon glyphicon-new-window"></span> {% trans "View on site" %}</a></li>{% endif %}
|
||||||
</li>
|
|
||||||
{% if has_absolute_url %}<li class="btn-group"><a href="{{ absolute_url }}" class="viewsitelink btn btn-default"><span class="glyphicon glyphicon-new-window"></span> {% trans "View on site" %}</a></li>{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
</ul>
|
|
||||||
{% endif %}{% endif %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
{% extends "admin/delete_confirmation.html" %}
|
|
||||||
{% comment %}
|
|
||||||
Re2o est un logiciel d'administration développé initiallement au rezometz. Il
|
|
||||||
se veut agnostique au réseau considéré, de manière à être installable en
|
|
||||||
quelques clics.
|
|
||||||
|
|
||||||
Copyright © 2019 Alexandre Iooss
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along
|
|
||||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
{% endcomment %}
|
|
||||||
{% load i18n admin_urls %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
{% if perms_lacking %}
|
|
||||||
<p>{% blocktrans with escaped_object=object %}Deleting the {{ object_name }} '{{ escaped_object }}' would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:{% endblocktrans %}</p>
|
|
||||||
<ul>
|
|
||||||
{% for obj in perms_lacking %}
|
|
||||||
<li>{{ obj }}</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% elif protected %}
|
|
||||||
<p>{% blocktrans with escaped_object=object %}Deleting the {{ object_name }} '{{ escaped_object }}' would require deleting the following protected related objects:{% endblocktrans %}</p>
|
|
||||||
<ul>
|
|
||||||
{% for obj in protected %}
|
|
||||||
<li>{{ obj }}</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% else %}
|
|
||||||
<p>{% blocktrans with escaped_object=object %}Are you sure you want to delete the {{ object_name }} "{{ escaped_object }}"? All of the following related items will be deleted:{% endblocktrans %}</p>
|
|
||||||
{% include "admin/includes/object_delete_summary.html" %}
|
|
||||||
<h2>{% trans "Objects" %}</h2>
|
|
||||||
<ul>{{ deleted_objects|unordered_list }}</ul>
|
|
||||||
<form method="post">{% csrf_token %}
|
|
||||||
<div>
|
|
||||||
<input type="hidden" name="post" value="yes" />
|
|
||||||
{% if is_popup %}<input type="hidden" name="{{ is_popup_var }}" value="1" />{% endif %}
|
|
||||||
{% if to_field %}<input type="hidden" name="{{ to_field_var }}" value="{{ to_field }}" />{% endif %}
|
|
||||||
<input type="submit" class="btn btn-danger" value="{% trans "Yes, I'm sure" %}" />
|
|
||||||
<a href="#" class="button cancel-link btn btn-default">{% trans "No, take me back" %}</a>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
|
@ -1,59 +0,0 @@
|
||||||
{% extends "admin/delete_selected_confirmation.html" %}
|
|
||||||
{% comment %}
|
|
||||||
Re2o est un logiciel d'administration développé initiallement au rezometz. Il
|
|
||||||
se veut agnostique au réseau considéré, de manière à être installable en
|
|
||||||
quelques clics.
|
|
||||||
|
|
||||||
Copyright © 2019 Alexandre Iooss
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along
|
|
||||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
{% endcomment %}
|
|
||||||
{% load i18n l10n admin_urls %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
{% if perms_lacking %}
|
|
||||||
<p>{% blocktrans %}Deleting the selected {{ objects_name }} would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:{% endblocktrans %}</p>
|
|
||||||
<ul>
|
|
||||||
{% for obj in perms_lacking %}
|
|
||||||
<li>{{ obj }}</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% elif protected %}
|
|
||||||
<p>{% blocktrans %}Deleting the selected {{ objects_name }} would require deleting the following protected related objects:{% endblocktrans %}</p>
|
|
||||||
<ul>
|
|
||||||
{% for obj in protected %}
|
|
||||||
<li>{{ obj }}</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% else %}
|
|
||||||
<p>{% blocktrans %}Are you sure you want to delete the selected {{ objects_name }}? All of the following objects and their related items will be deleted:{% endblocktrans %}</p>
|
|
||||||
{% include "admin/includes/object_delete_summary.html" %}
|
|
||||||
<h2>{% trans "Objects" %}</h2>
|
|
||||||
{% for deletable_object in deletable_objects %}
|
|
||||||
<ul>{{ deletable_object|unordered_list }}</ul>
|
|
||||||
{% endfor %}
|
|
||||||
<form method="post">{% csrf_token %}
|
|
||||||
<div>
|
|
||||||
{% for obj in queryset %}
|
|
||||||
<input type="hidden" name="{{ action_checkbox_name }}" value="{{ obj.pk|unlocalize }}" />
|
|
||||||
{% endfor %}
|
|
||||||
<input type="hidden" name="action" value="delete_selected" />
|
|
||||||
<input type="hidden" name="post" value="yes" />
|
|
||||||
<input type="submit" class="btn btn-danger" value="{% trans "Yes, I'm sure" %}" />
|
|
||||||
<a href="#" class="button cancel-link btn btn-default">{% trans "No, take me back" %}</a>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
Loading…
Reference in a new issue