8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-24 20:33:11 +00:00

Sync admin template with Django contrib code

This commit is contained in:
Alexandre Iooss 2019-02-17 18:16:42 +01:00 committed by Alexandre IOOSS
parent 69ff7a2391
commit cf586ff52e
3 changed files with 62 additions and 102 deletions

View file

@ -1,38 +1,19 @@
{% extends "admin/base_site.html" %}
{# Please keep this template in sync with django/contrib/admin one #}
{% extends "admin/index.html" %}
{% load i18n %}
{% block breadcrumbs %}
<ol class="breadcrumb">
<li class="home">
<a href="{% url 'index' %}" title="{% trans 'Home' %}">
<span class="glyphicon glyphicon-home"></span>
</a>
</li>
<li class="active">{% for app in app_list %}{{ app.name }}{% endfor %}</li>
</ol>
{% endblock %}
{% block bodyclass %}{{ block.super }} app-{{ app_label }}{% endblock %}
{% block content %}
{% if app_list %}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{% trans "Models" %}</h3>
</div>
<div class="panel-body">
<ul>
{% if not is_popup %}
{% block breadcrumbs %}
<ol class="breadcrumb"><li class="home">
<a href="{% url 'index' %}">{% trans 'Home' %}</a>
</li><li class="active">
{% for app in app_list %}
{% for model in app.models %}
<li class="model-name model-{{ model.object_name|lower }}">
<a href="{% if model.admin_url %}{{ model.admin_url }}{% else %}#{% endif %}"
{% if not model.admin_url %}class="disabled"{% endif %}>{{ model.name }}</a>
</li>
{{ app.name }}
{% endfor %}
{% endfor %}
</ul>
</div>
</div>
{% else %}
<p>{% trans "You don't have permission to edit anything." %}</p>
{% endif %}
</li></ol>
{% endblock %}
{% endif %}
{% block sidebar %}{% endblock %}

View file

@ -1,7 +1,10 @@
{# Please keep this template in sync with django/contrib/admin one #}
{% extends "users/sidebar.html" %}
{% load static %}
{% block title %}{{ title }}{% endblock %}
{% block branding %}
<h1 id="site-name"><a href="{% url 'admin:index' %}">{{ site_header|default:_('Django administration') }}</a></h1>
{% endblock %}
{% block nav-global %}{% endblock %}

View file

@ -1,70 +1,47 @@
{# Please keep this template in sync with django/contrib/admin one #}
{% extends "admin/base_site.html" %}
{% load i18n l10n admin_urls static %}
{% block extrahead %}
{{ block.super }}
{{ media }}
{# Make previous link works #}
<script type="text/javascript" src="{% static 'admin/js/cancel.js' %}"></script>
{% endblock %}
{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation delete-selected-confirmation{% endblock %}
{% block breadcrumbs %}
<ol class="breadcrumb">
<li class="home">
<a href="{% url 'index' %}" title="{% trans 'Home' %}"><span class="glyphicon glyphicon-home"></span></a>
</li>
<li>
<a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a>
</li>
<li>
<a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst|escape }}</a>
</li>
<li class="active">{% trans 'Delete multiple objects' %}</li>
</ol>
<ol class="breadcrumb"><li class="home">
<a href="{% url 'index' %}">{% trans 'Home' %}</a>
</li><li><a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a>
</li><li><a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst|escape }}</a>
</li><li class="active">{% trans 'Delete multiple objects' %}
</li></ol>
{% endblock %}
{% block content %}
{% if perms_lacking or protected %}
{% if perms_lacking %}
<div class="panel panel-default">
<div class="panel-heading">
{% 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 %}
</div>
<div class="panel-body">
<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>
</div>
</div>
{% endif %}
{% if protected %}
<div class="panel panel-default">
<div class="panel-heading">
{% blocktrans %}Deleting the selected {{ objects_name }} would require deleting the following protected related objects:{% endblocktrans %}
</div>
<div class="panel-body">
{% 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>
</div>
</div>
{% endif %}
{% else %}
<div class="panel panel-default">
<div class="panel-heading">
{% 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 %}
</div>
<div class="panel-body">
<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 %}
<hr>
<form action="" method="post">{% csrf_token %}
<form method="post">{% csrf_token %}
<div>
{% for obj in queryset %}
<input type="hidden" name="{{ action_checkbox_name }}" value="{{ obj.pk|unlocalize }}" />
@ -72,9 +49,8 @@
<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">{% trans "No, take me back" %}</a>
</div>
</form>
</div>
</div>
{% endif %}
{% endblock %}