Merge pull request #160 from jazzband/admin-template

Improve html layout when using fieldsets
This commit is contained in:
Jannis Leidel 2016-09-15 09:04:19 +02:00 committed by GitHub
commit 39ea4aa32f
2 changed files with 29 additions and 28 deletions

View file

@ -1,7 +1,6 @@
{% extends "admin/base_site.html" %}
{% load admin_static admin_list i18n %}
{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/changelists.css' %}" />
@ -9,20 +8,20 @@
{{ media.css }}
<style>
#result_list .changed {
background-color: #ffc;
background-color: #ffc;
}
#changelist table thead th .text {
padding: 2px 5px;
padding: 2px 5px;
}
#changelist table tbody td:first-child {
text-align: left;
}
#changelist-form ul.errorlist {
margin: 0 !important;
margin: 0 !important;
}
.help {
font-weight: normal !important;
}
}
</style>
{% endblock %}
@ -54,17 +53,19 @@
{% if fieldsets %}
{% for fieldset in fieldsets %}
<h3>{{ fieldset.title }}</h3>
{% with config_values=fieldset.config_values %}
{% include "admin/constance/includes/results_list.html" %}
{% endwith %}
<fieldset class="module">
<h2>{{ fieldset.title }}</h2>
{% with config_values=fieldset.config_values %}
{% include "admin/constance/includes/results_list.html" %}
{% endwith %}
</fieldset>
{% endfor %}
{% else %}
{% include "admin/constance/includes/results_list.html" %}
{% endif %}
<p class="paginator">
<input type="submit" name="_save" class="default" value="{% trans 'Save' %}"/>
<input type="submit" name="_save" class="default" value="{% trans 'Save' %}"/>
</p>
</form>
</div>
@ -73,8 +74,8 @@
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
&rsaquo; <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ app_label|capfirst|escape }}</a>
&rsaquo; {{ opts.verbose_name_plural|capfirst }}
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
&rsaquo; <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ app_label|capfirst|escape }}</a>
&rsaquo; {{ opts.verbose_name_plural|capfirst }}
</div>
{% endblock %}

View file

@ -1,25 +1,25 @@
{% load admin_static admin_list i18n %}
<table cellspacing="0" id="result_list">
<table>
<thead>
<tr>
<th><div class="text">{% trans "Name" %}</div></th>
<th><div class="text">{% trans "Default" %}</div></th>
<th><div class="text">{% trans "Value" %}</div></th>
<th><div class="text">{% trans "Is modified" %}</div></th>
</tr>
<tr>
<th><div class="text">{% trans "Name" %}</div></th>
<th><div class="text">{% trans "Default" %}</div></th>
<th><div class="text">{% trans "Value" %}</div></th>
<th><div class="text">{% trans "Is modified" %}</div></th>
</tr>
</thead>
{% for item in config_values %}
<tr class="{% cycle 'row1' 'row2' %}">
<th>{{ item.name }}
<div class="help">{{ item.help_text|linebreaksbr }}</div>
<th>
{{ item.name }} <div class="help">{{ item.help_text|linebreaksbr }}</div>
</th>
<td>
{{ item.default }}
</td>
<td>
{{ item.form_field.errors }}
{{ item.form_field }}
</td>
<td>
{{ item.form_field.errors }}
{{ item.form_field }}
</td>
<td>
{% if item.modified %}
<img src="{% static 'admin/img/icon-yes.'|add:icon_type %}" alt="{{ item.modified }}" />
@ -27,6 +27,6 @@
<img src="{% static 'admin/img/icon-no.'|add:icon_type %}" alt="{{ item.modified }}" />
{% endif %}
</td>
</tr>
</tr>
{% endfor %}
</table>
</table>