|
1 | 1 | {% extends "bullet_admin/base.html" %} |
2 | | -{% load countries %} |
3 | | -{% load utils %} |
4 | | -{% load i18n %} |
5 | | -{% load badmin %} |
6 | | -{% load access %} |
| 2 | +{% load access badmin countries i18n utils %} |
7 | 3 | {% block title %} |
8 | 4 | {{ list_title }} |
9 | 5 | {% endblock title %} |
| 6 | + |
10 | 7 | {% block content %} |
11 | | - {% get_active_competition as competition %} |
12 | | - <div class="p-8 mx-auto max-w-7xl"> |
13 | | - {% aheader show_subtitle=subtitle is not None %} |
14 | | - {% slot title %} |
15 | | - {{ list_title }} |
16 | | - {% if count %} |
17 | | - <span class="text-gray-400 font-normal">{{ count|floatformat:"g" }}</span> |
18 | | - {% endif %} |
19 | | - {% endslot %} |
20 | | - {% slot buttons %} |
21 | | - {% query_replace next=request.get_full_path as back %} |
22 | | - {% if help_url %} |
23 | | - {% #abtn icon="mdi:help" label="Help" url=help_url|add:back %} |
24 | | - {% endif %} |
25 | | - {% if new_folder_url %} |
26 | | - {% #abtn icon="mdi:folder-plus" label="New folder" url=new_folder_url|add:back %} |
27 | | - {% endif %} |
28 | | - {% if assign_numbers_url %} |
29 | | - {% #abtn icon="mdi:numeric" label="Assign numbers" url=assign_numbers_url|add:back %} |
30 | | - {% endif %} |
31 | | - {% if export_url %} |
32 | | - {% #abtn color="blue" icon="mdi:export" label="Export" url=export_url|add:back %} |
33 | | - {% endif %} |
34 | | - {% if create_url %} |
35 | | - {% if object_name %} |
36 | | - {% #abtn color="green" icon="mdi:plus" label="New "|add:object_name url=create_url|add:back %} |
37 | | - {% else %} |
38 | | - {% #abtn color="green" icon="mdi:plus" label="New" url=create_url|add:back %} |
39 | | - {% endif %} |
40 | | - {% endif %} |
41 | | - {% if upload_url %} |
42 | | - {% #abtn color="green" icon="mdi:upload" label="Upload File" url=upload_url|add:back %} |
43 | | - {% endif %} |
44 | | - {% comment %} |
45 | | - Add buttons if needed. |
46 | | - {% endcomment %} |
47 | | - {% endslot %} |
48 | | - {{ subtitle }} |
49 | | - {% endaheader %} |
50 | | - {% block navigation %} |
51 | | - {% if countries %} |
52 | | - {% anav class="-mt-4 mb-8" %} |
53 | | - {% query_transform country="" as url %} |
54 | | - {% if not request.GET.country %} |
55 | | - {% anavitem url=url active=True %} |
56 | | - (all) |
57 | | - {% endanavitem %} |
58 | | - {% else %} |
59 | | - {% anavitem url=url active=False %} |
60 | | - (all) |
61 | | - {% endanavitem %} |
62 | | - {% endif %} |
63 | | - {% for country in countries %} |
64 | | - {% get_country country as country_info %} |
65 | | - {% query_transform country=country as url %} |
66 | | - {% if request.GET.country == country %} |
67 | | - {% anavitem url=url active=True %} |
68 | | - <div class="flex gap-2 items-center flex-wrap"> |
69 | | - <span class="iconify shrink-0 shadow-lg" |
70 | | - data-icon="flag:{{ country_info.code|lower }}-4x3"></span> |
71 | | - <span>{{ country_info.name }}</span> |
72 | | - </div> |
73 | | - {% endanavitem %} |
74 | | - {% else %} |
75 | | - {% anavitem url=url active=False %} |
76 | | - <div class="flex gap-2 items-center flex-wrap"> |
77 | | - <span class="iconify shrink-0 shadow-lg" |
78 | | - data-icon="flag:{{ country_info.code|lower }}-4x3"></span> |
79 | | - <span>{{ country_info.name }}</span> |
80 | | - </div> |
81 | | - {% endanavitem %} |
82 | | - {% endif %} |
83 | | - {% endfor %} |
84 | | - {% endanav %} |
85 | | - {% endif %} |
86 | | - {% if languages %} |
87 | | - {% anav class="-mt-4 mb-8" %} |
88 | | - {% query_transform language="" as url %} |
89 | | - {% if not request.GET.language %} |
90 | | - {% anavitem url=url active=True %} |
91 | | - (all) |
92 | | - {% endanavitem %} |
93 | | - {% else %} |
94 | | - {% anavitem url=url active=False %} |
95 | | - (all) |
96 | | - {% endanavitem %} |
97 | | - {% endif %} |
98 | | - {% for lang in languages %} |
99 | | - {% get_language_info for lang as lang_info %} |
100 | | - {% query_transform language=lang as url %} |
101 | | - {% if request.GET.language == lang %} |
102 | | - {% anavitem url=url active=True %} |
103 | | - {{ lang_info.name }} |
104 | | - {% endanavitem %} |
105 | | - {% else %} |
106 | | - {% anavitem url=url active=False %} |
107 | | - {{ lang_info.name }} |
108 | | - {% endanavitem %} |
109 | | - {% endif %} |
110 | | - {% endfor %} |
111 | | - {% endanav %} |
112 | | - {% endif %} |
113 | | - {% endblock navigation %} |
114 | | - {% block before_list %} |
115 | | - <form class="flex mb-4 items-center gap-2"> |
116 | | - {% for name, list in request.GET.lists %} |
117 | | - {% if name != "q" %} |
118 | | - <input type="hidden" |
119 | | - name="{{ name }}" |
120 | | - value="{{ list.0 }}"> |
121 | | - {% endif %} |
122 | | - {% endfor %} |
123 | | - <input type="search" |
124 | | - name="q" |
125 | | - placeholder="Search {{ list_title|lower }}" |
126 | | - class="input" |
127 | | - value="{{ request.GET.q }}"> |
128 | | - </form> |
129 | | - {% endblock before_list %} |
130 | | - <div class="overflow-x-auto"> |
131 | | - <table class="w-full text-sm"> |
132 | | - <thead class="text-left bg-gray-100 border-t border-b"> |
133 | | - <tr> |
134 | | - {% for label, field in labels %} |
135 | | - <th class="p-0 whitespace-nowrap"> |
136 | | - {% if orderby == field %} |
137 | | - {% query_transform orderby="-"|add:field as url %} |
138 | | - {% else %} |
139 | | - {% query_transform orderby=field as url %} |
140 | | - {% endif %} |
141 | | - <a href="{{ url }}" |
142 | | - class="p-3 pr-1 flex items-center hover:bg-gray-200"> |
143 | | - {{ label }} |
144 | | - {% if orderby == field %} |
145 | | - <span class="iconify w-5 h-5 shrink-0" |
146 | | - data-icon="mdi:arrow-down-drop"></span> |
147 | | - {% elif orderby == "-"|add:field %} |
148 | | - <span class="iconify w-5 h-5 shrink-0" |
149 | | - data-icon="mdi:arrow-drop-up"></span> |
150 | | - {% endif %} |
151 | | - </a> |
152 | | - </th> |
153 | | - {% endfor %} |
154 | | - <th></th> |
155 | | - </tr> |
156 | | - </thead> |
157 | | - <tbody class="divide-y"> |
158 | | - {% for object, edit_url, delete_url, view_url, download_url, generate_url in table_row %} |
159 | | - <tr class="even:bg-gray-50 relative hover:bg-gray-100"> |
160 | | - {% for item in object %} |
161 | | - <td class="p-3"> |
162 | | - {% if forloop.first %} |
163 | | - {% if view_url %} |
164 | | - <a class="link absolute inset-0" |
165 | | - href="{{ view_url }}{% query_transform next=request.get_full_path %}"></a> |
166 | | - {% elif edit_url %} |
167 | | - <a class="link absolute inset-0" |
168 | | - href="{{ edit_url }}{% query_transform next=request.get_full_path %}"></a> |
169 | | - {% elif delete_url %} |
170 | | - <a class="link absolute inset-0" |
171 | | - href="{{ delete_url }}{% query_transform next=request.get_full_path %}"></a> |
172 | | - {% endif %} |
173 | | - {% endif %} |
174 | | - {% if item or item == 0 %}{{ item }}{% endif %} |
175 | | - </td> |
176 | | - {% endfor %} |
177 | | - <td class="p-3 whitespace-nowrap z-10 relative"> |
178 | | - <div class="flex items-center justify-end gap-2"> |
179 | | - {% if edit_url %} |
180 | | - {% #alink type="edit" url=edit_url %} |
181 | | - {% endif %} |
182 | | - {% if delete_url %} |
183 | | - {% #alink type="delete" url=delete_url %} |
184 | | - {% endif %} |
185 | | - {% if view_url %} |
186 | | - {% #alink type=view_type url=view_url %} |
187 | | - {% endif %} |
188 | | - {% if download_url %} |
189 | | - {% #alink type="download" url=download_url %} |
190 | | - {% endif %} |
191 | | - {% if generate_url %} |
192 | | - {% #alink type="generate" url=generate_url %} |
193 | | - {% endif %} |
194 | | - </div> |
195 | | - </td> |
196 | | - </tr> |
197 | | - {% endfor %} |
198 | | - </tbody> |
199 | | - </table> |
200 | | - </div> |
201 | | - {% admin_paginator page_obj %} |
202 | | - </div> |
| 8 | + {% get_active_competition as competition %} |
| 9 | + <div class="p-8 mx-auto max-w-7xl"> |
| 10 | + {% aheader show_subtitle=list_subtitle is not None %} |
| 11 | + {% slot title %} |
| 12 | + {{ list_title }} |
| 13 | + |
| 14 | + {% if count %} |
| 15 | + <span class="text-gray-400 font-normal">{{ count|floatformat:"g" }}</span> |
| 16 | + {% endif %} |
| 17 | + {% endslot %} |
| 18 | + |
| 19 | + {% slot buttons %} |
| 20 | + {% query_replace next=request.get_full_path as back %} |
| 21 | + {% for link in list_links %} |
| 22 | + {% #abtn icon=link.icon label=link.label color=link.color url=link.url|add:back %} |
| 23 | + {% endfor %} |
| 24 | + {% endslot %} |
| 25 | + |
| 26 | + {{ list_subtitle }} |
| 27 | + {% endaheader %} |
| 28 | + |
| 29 | + {% block navigation %} |
| 30 | + {% if countries %} |
| 31 | + {% include "bullet_admin/generic/list_countries.html" %} |
| 32 | + {% endif %} |
| 33 | + {% if languages %} |
| 34 | + {% include "bullet_admin/generic/list_languages.html" %} |
| 35 | + {% endif %} |
| 36 | + {% endblock navigation %} |
| 37 | + |
| 38 | + {% block before_list %} |
| 39 | + <form class="flex mb-4 items-center gap-2"> |
| 40 | + {% for name, list in request.GET.lists %} |
| 41 | + {% if name != "q" %} |
| 42 | + <input type="hidden" |
| 43 | + name="{{ name }}" |
| 44 | + value="{{ list.0 }}"> |
| 45 | + {% endif %} |
| 46 | + {% endfor %} |
| 47 | + <input type="search" |
| 48 | + name="q" |
| 49 | + placeholder="Search {{ list_title|lower }}" |
| 50 | + class="input" |
| 51 | + value="{{ request.GET.q }}"> |
| 52 | + </form> |
| 53 | + {% endblock before_list %} |
| 54 | + |
| 55 | + {% include "bullet_admin/generic/list_table.html" %} |
| 56 | + {% admin_paginator page_obj %} |
| 57 | + </div> |
203 | 58 | {% endblock content %} |
0 commit comments