|
62 | 62 | {% endif %}
|
63 | 63 |
|
64 | 64 | <!-- Start of drawer component -->
|
65 |
| - <div class="drawer drawer-end {% if SHOW_CHANGELIST_FILTER %} xl:drawer-open {% endif %} "> |
| 65 | + <div class="{%if FILTER_POSITION_TOP and SHOW_CHANGELIST_FILTER %} {% else %}drawer drawer-end {% endif %} {% if SHOW_CHANGELIST_FILTER %} xl:drawer-open {% endif %} "> |
66 | 66 | <input id="filter-drawer" type="checkbox" class="drawer-toggle"/>
|
| 67 | + {% if cl.has_filters %} |
| 68 | + <!-- Filter section --> |
| 69 | + <div id="changelist-filter" |
| 70 | + class="drawer-side {% if SHOW_CHANGELIST_FILTER %} mt-3 lg:ms-2 card-bordered {% endif %} !overflow-visible z-10 h-full"> |
| 71 | + <label for="filter-drawer" aria-label="close sidebar" class="drawer-overlay"></label> |
67 | 72 |
|
| 73 | + <div class="bg-base-100 h-full {% if FILTER_POSITION_TOP and SHOW_CHANGELIST_FILTER %} w-full flex flex-wrap gap-2{% else %} card-body p-3 w-80 {% endif %}"> |
| 74 | + <div class="card-header flex justify-between {% if FILTER_POSITION_TOP and SHOW_CHANGELIST_FILTER %} p-3 {% else %} p-2{% endif %}"> |
| 75 | + {% if FILTER_POSITION_TOP and SHOW_CHANGELIST_FILTER %}{% else %}<h2 class="font-bold">{% translate 'Filter' %}</h2>{% endif %} |
| 76 | + <button id="apply-filter" type="button" |
| 77 | + class="btn btn-sm btn-primary">{% trans "Filter" %}</button> |
| 78 | + </div> |
| 79 | + {% if FILTER_POSITION_TOP and SHOW_CHANGELIST_FILTER %} |
| 80 | + {% else %} |
| 81 | + {% if cl.is_facets_optional or active_filters_count %} |
| 82 | + <div id="changelist-filter-extra-actions" class="mb-2 flex justify-between"> |
| 83 | + {% if cl.is_facets_optional %} |
| 84 | + <div class="form-control"> |
| 85 | + {% if cl.add_facets %} |
| 86 | + <label class="label cursor-pointer text-sm"> |
| 87 | + <span class="label-text text-sm pe-2">{% translate "Show counts" %}</span> |
| 88 | + <input checked value="{{ cl.remove_facet_link }}" type="checkbox" |
| 89 | + class="toggle toggle-sm filter_show_count"/> |
| 90 | + </label> |
| 91 | + {% else %} |
| 92 | + <label class="label cursor-pointer"> |
| 93 | + <span class="label-text pe-2">{% translate "Show counts" %}</span> |
| 94 | + <input value="{{ cl.add_facet_link }}" type="checkbox" |
| 95 | + class="toggle toggle-sm filter_show_count"/> |
| 96 | + </label> |
| 97 | + {% endif %} |
| 98 | + </div> |
| 99 | + {% endif %} |
| 100 | + {% if active_filters_count %} |
| 101 | + <h3 class="pt-1"> |
| 102 | + <a href="?" |
| 103 | + class="link text-sm"> |
| 104 | + <i class="fa fa-times text-error"></i> |
| 105 | + {% translate "Clear all filters" %}</a> |
| 106 | + </h3> |
| 107 | + {% endif %} |
| 108 | + </div> |
| 109 | + {% endif %} |
| 110 | + {% endif %} |
| 111 | + {% for spec in cl.filter_specs %} |
| 112 | + {% admin_list_filter cl spec request %} |
| 113 | + {% endfor %} |
| 114 | + </div> |
| 115 | + </div> |
| 116 | + {% endif %} |
68 | 117 | <!-- Main content section -->
|
69 | 118 | <div class="drawer-content flex flex-col w-full h-full">
|
70 | 119 | <div id="content-main" class="overflow-hidden mt-3 w-full h-full flex">
|
|
117 | 166 |
|
118 | 167 | </div>
|
119 | 168 | </div>
|
120 |
| - {% if cl.has_filters %} |
121 |
| - <!-- Filter section --> |
122 |
| - <div id="changelist-filter" |
123 |
| - class="drawer-side {% if SHOW_CHANGELIST_FILTER %} mt-3 lg:ms-2 card-bordered {% endif %} !overflow-visible z-10 h-full"> |
124 |
| - <label for="filter-drawer" aria-label="close sidebar" class="drawer-overlay"></label> |
125 |
| - |
126 |
| - <div class="card-body p-3 bg-base-100 w-80 h-full"> |
127 |
| - <div class="card-header flex justify-between p-2"> |
128 |
| - <h2 class="font-bold">{% translate 'Filter' %}</h2> |
129 |
| - <button id="apply-filter" type="button" |
130 |
| - class="btn btn-sm btn-primary">{% trans "Filter" %}</button> |
131 |
| - </div> |
132 |
| - {% if cl.is_facets_optional or active_filters_count %} |
133 |
| - <div id="changelist-filter-extra-actions" class="mb-2 flex justify-between"> |
134 |
| - {% if cl.is_facets_optional %} |
135 |
| - <div class="form-control"> |
136 |
| - {% if cl.add_facets %} |
137 |
| - <label class="label cursor-pointer text-sm"> |
138 |
| - <span class="label-text text-sm pe-2">{% translate "Show counts" %}</span> |
139 |
| - <input checked value="{{ cl.remove_facet_link }}" type="checkbox" |
140 |
| - class="toggle toggle-sm filter_show_count"/> |
141 |
| - </label> |
142 |
| - {% else %} |
143 |
| - <label class="label cursor-pointer"> |
144 |
| - <span class="label-text pe-2">{% translate "Show counts" %}</span> |
145 |
| - <input value="{{ cl.add_facet_link }}" type="checkbox" |
146 |
| - class="toggle toggle-sm filter_show_count"/> |
147 |
| - </label> |
148 |
| - {% endif %} |
149 |
| - </div> |
150 |
| - {% endif %} |
151 |
| - {% if active_filters_count %} |
152 |
| - <h3 class="pt-1"> |
153 |
| - <a href="?" |
154 |
| - class="link text-sm"> |
155 |
| - <i class="fa fa-times text-error"></i> |
156 |
| - {% translate "Clear all filters" %}</a> |
157 |
| - </h3> |
158 |
| - {% endif %} |
159 |
| - </div> |
160 |
| - {% endif %} |
161 |
| - {% for spec in cl.filter_specs %} |
162 |
| - {% admin_list_filter cl spec request %} |
163 |
| - {% endfor %} |
164 |
| - </div> |
165 |
| - </div> |
166 |
| - {% endif %} |
167 | 169 | </div>
|
168 | 170 | <!-- End of drawer component -->
|
169 | 171 |
|
@@ -212,6 +214,12 @@ <h3 class="pt-1">
|
212 | 214 |
|
213 | 215 | $('#changelist-form .search-submit').click(submit_search_form)
|
214 | 216 |
|
| 217 | + if ('{% if FILTER_POSITION_TOP and SHOW_CHANGELIST_FILTER %}1{%endif%}') { |
| 218 | + $('.navbar-nav-link').addClass('label') |
| 219 | + $('.navbar-nav-link').parent().removeClass('card') |
| 220 | + $('.navbar-nav-link').find('b').removeClass('mb-1') |
| 221 | + $('.multi').removeClass('multi') |
| 222 | + } |
215 | 223 | })
|
216 | 224 | </script>
|
217 | 225 | {% endblock %}
|
0 commit comments