1 {% extends "admin/base_site.html" %}
8 #content-main table {margin:10px 0 20px 0;}
9 #content-main ul, #content-main li {display:inline; padding:0;}
10 #content-main label {cursor:pointer;}
12 #content-main h1 {margin:30px 0 0 0;}
13 table {border:1px solid #ddd; width:100%;}
14 th, td {border-right:1px solid #ddd; padding:5px 15px;}
15 .last {border-right:0;}
16 td.include, th.include-all, td.include-all {text-align:center; width:10px;}
17 .empty {margin-top:10px;}
18 .field {padding-top:8px;}
19 .filter select {width:140px;}
20 .options {vertical-align:middle; white-space:nowrap;}
21 .options label {margin:0 10px; font-weight:normal; vertical-align:middle;}
22 .options-div {visibility:hidden;}
23 .options select {min-width:0;}
24 .on {background:#eee;}
25 .off {background:#fff;}
26 .button {float:left !important; margin-right:10px; cursor:pointer;}
28 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
31 // Show the filter criteria fields when a filter option is selected.
32 $('.filter select').change(function() {
33 var filtering = this.selectedIndex > 0;
34 var options = $(this).parent().parent().find('.options-div');
35 options.css('visibility', filtering ? 'visible' : 'hidden');
36 // Focus the first field.
38 var input = options.find('input:first');
39 if (input.length === 1) {
42 options.find('select:first').focus();
46 // Toggle the include `All` checkboxes - grouped within table tags.
47 $('#content-main table').each(function(i, table) {
49 var all = table.find('.include-all :checkbox');
50 var others = table.find('.include :checkbox');
51 others.change(function() {
52 var len = table.find('.include :checkbox:not(:checked)').length;
53 all.attr('checked', len === 0);
55 all.change(function() {
56 others.attr('checked', !!all.attr('checked'));
59 // Add a confirmation prompt for deleting entries.
60 $('input[name="delete"]').click(function() {
61 if ( $('input[name="selected"]:checked').length === 0 ) {
62 alert('{% trans "No entries selected" %}');
65 return confirm('{% trans "Delete selected entries?" %}');
72 {% block breadcrumbs %}
73 <div class="breadcrumbs">
74 <a href="../../../../">{% trans "Home" %}</a> ›
75 <a href="../../../">{{ opts.app_label|capfirst|escape }}</a> ›
76 <a href="../../">{{ opts.verbose_name_plural|capfirst }}</a> ›
77 <a href="../">{{ original|truncatewords:"18" }}</a> ›
83 <div id="content-main">
88 <th>{% trans "Field" %}</th>
89 <th>{% trans "Include" %}</th>
90 <th class="last" colspan="2">{% trans "Filter by" %}</th>
92 {% for include_field, filter_field, filter_option_fields in entries_form %}
93 <tr class="{% cycle on,off as row %}">
94 <td class="field">{{ include_field.label_tag }}</td>
95 <td class="include">{{ include_field }}</td>
96 <td class="filter last">{{ filter_field }}</td>
97 <td class="options last">
98 <div class="options-div">
99 {% for option_field in filter_option_fields %}
100 {{ option_field.label_tag }} {{ option_field }}
106 <tr class="{% cycle row %}">
107 <td class="field" style="text-align:right;">
108 <label for="include-all">{% trans "All" %}</label>
110 <td class="include-all">
111 <input type="checkbox" id="include-all" class="include-all" checked="checked">
113 <td class="last" colspan="2"> </td>
116 <input type="submit" name="back" class="button" value="{% trans "Back to form" %}">
117 <input type="submit" class="button default" value="{% trans "View entries" %}">
118 <input type="submit" class="button default" name="export" value="{% trans "Export CSV" %}">
119 {% if xlwt_installed %}
120 <input type="submit" class="button default" name="export_xls" value="{% trans "Export XLS" %}">
124 <h1 id="entries-title">{% trans "Entries" %}</h1>
125 {% for row in entries_form.rows %}
126 {% if forloop.first %}
127 <table id="entries-table">
129 {% if can_delete_entries %}
130 <th class="include-all"><input type="checkbox"></th>
132 {% for column in entries_form.columns %}
133 <th{% if forloop.last %} class="last"{% endif %}>{{ column }}</th>
137 <tr class="{% cycle on,off %}">
138 {% if can_delete_entries %}
140 <input type="checkbox" name="selected" value="{{ row.0 }}">
143 {% for field in row %}
144 {% if not forloop.first %}
145 <td{% if forloop.last %} class="last"{% endif %}>{{ field }}</td>
149 {% if forloop.last %}
152 count is injected into the title here with the :after selector
153 to avoid calling the expensive "entries_form.rows" twice.
155 <style>#entries-title:after {content: ' ({{ forloop.counter }})';}</style>
156 {% if can_delete_entries %}
157 <input type="submit" name="back" class="button" value="{% trans "Back to form" %}">
158 <input type="submit" name="delete" class="button default" value="{% trans "Delete selected" %}">
162 <p class="empty">{% trans "No entries to display" %}</p>