translation update
[redakcja.git] / apps / forms_builder / forms / templates / admin / forms / entries.html
1 {% extends "admin/base_site.html" %}
2
3 {% load i18n %}
4
5 {% block extrahead %}
6 {{ block.super }}
7 <style>
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;}
11 h1 {margin-top:20px;}
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;}
27 </style>
28 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
29 <script>
30 $(function() {
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.
37         if (filtering) {
38             var input = options.find('input:first');
39             if (input.length === 1) {
40                 input.focus();
41             } else {
42                 options.find('select:first').focus();
43             }
44         }
45     }).change();
46     // Toggle the include `All` checkboxes - grouped within table tags.
47     $('#content-main table').each(function(i, table) {
48         table = $(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);
54         });
55         all.change(function() {
56             others.attr('checked', !!all.attr('checked'));
57         });
58     });
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" %}');
63             return false;
64         } else {
65             return confirm('{% trans "Delete selected entries?" %}');
66         }
67     });
68 });
69 </script>
70 {% endblock %}
71
72 {% block breadcrumbs %}
73 <div class="breadcrumbs">
74      <a href="../../../../">{% trans "Home" %}</a> &rsaquo;
75      <a href="../../../">{{ opts.app_label|capfirst|escape }}</a> &rsaquo;
76      <a href="../../">{{ opts.verbose_name_plural|capfirst }}</a> &rsaquo;
77      <a href="../">{{ original|truncatewords:"18" }}</a> &rsaquo;
78      {{ title }}
79 </div>
80 {% endblock %}
81
82 {% block content %}
83 <div id="content-main">
84     <form method="post">
85     {% csrf_token %}
86     <table>
87         <tr>
88             <th>{% trans "Field" %}</th>
89             <th>{% trans "Include" %}</th>
90             <th class="last" colspan="2">{% trans "Filter by" %}</th>
91         </tr>
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 }}
101                     {% endfor %}
102                 </div>
103             </td>
104         </tr>
105         {% endfor %}
106         <tr class="{% cycle row %}">
107             <td class="field" style="text-align:right;">
108                 <label for="include-all">{% trans "All" %}</label>
109             </td>
110             <td class="include-all">
111                 <input type="checkbox" id="include-all" class="include-all" checked="checked">
112             </td>
113             <td class="last" colspan="2">&nbsp;</td>
114         </tr>
115     </table>
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" %}">
121     {% endif %}
122     {% if submitted %}
123     <br clear="both" />
124     <h1 id="entries-title">{% trans "Entries" %}</h1>
125     {% for row in entries_form.rows %}
126     {% if forloop.first %}
127     <table id="entries-table">
128         <tr>
129             {% if can_delete_entries %}
130             <th class="include-all"><input type="checkbox"></th>
131             {% endif %}
132             {% for column in entries_form.columns %}
133             <th{% if forloop.last %} class="last"{% endif %}>{{ column }}</th>
134             {% endfor %}
135         </tr>
136     {% endif %}
137         <tr class="{% cycle on,off %}">
138             {% if can_delete_entries %}
139             <td class="include">
140                 <input type="checkbox" name="selected" value="{{ row.0 }}">
141             </td>
142             {% endif %}
143             {% for field in row %}
144             {% if not forloop.first %}
145             <td{% if forloop.last %} class="last"{% endif %}>{{ field }}</td>
146             {% endif %}
147             {% endfor %}
148         </tr>
149     {% if forloop.last %}
150     </table>
151     <!--
152     count is injected into the title here with the :after selector
153     to avoid calling the expensive "entries_form.rows" twice.
154     -->
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" %}">
159     {% endif %}
160     {% endif %}
161     {% empty %}
162     <p class="empty">{% trans "No entries to display" %}</p>
163     {% endfor %}
164     {% endif %}
165     </form>
166 </div>
167 {% endblock %}