|
385 | 385 | {% endif %} |
386 | 386 | </form> |
387 | 387 |
|
388 | | - <!-- View Toggle --> |
389 | | - <div class="btn-group d-none d-md-flex mb-4" role="group"> |
390 | | - <button type="button" id="grid-view-btn" class="btn btn-outline-primary active"> |
391 | | - <i class="fas fa-th-large"></i><span class="ms-1">{% translate "Grid" %}</span> |
392 | | - </button> |
393 | | - <button type="button" id="list-view-btn" class="btn btn-outline-primary"> |
394 | | - <i class="fas fa-list"></i><span class="ms-1">{% translate "List" %}</span> |
395 | | - </button> |
| 388 | + <!-- View Toggle and Page Size --> |
| 389 | + <div class="d-none d-md-flex gap-2 mb-4"> |
| 390 | + <div class="btn-group" role="group"> |
| 391 | + <button type="button" id="grid-view-btn" class="btn btn-outline-primary active"> |
| 392 | + <i class="fas fa-th-large"></i><span class="ms-1">{% translate "Grid" %}</span> |
| 393 | + </button> |
| 394 | + <button type="button" id="list-view-btn" class="btn btn-outline-primary"> |
| 395 | + <i class="fas fa-list"></i><span class="ms-1">{% translate "List" %}</span> |
| 396 | + </button> |
| 397 | + </div> |
| 398 | + <select class="form-select" style="width: auto;" id="page-size-selector" onchange="changePageSize(this.value)"> |
| 399 | + <option value="12" {% if request.GET.page_size == '12' or not request.GET.page_size %}selected{% endif %}>12</option> |
| 400 | + <option value="24" {% if request.GET.page_size == '24' %}selected{% endif %}>24</option> |
| 401 | + <option value="48" {% if request.GET.page_size == '48' %}selected{% endif %}>48</option> |
| 402 | + <option value="96" {% if request.GET.page_size == '96' %}selected{% endif %}>96</option> |
| 403 | + </select> |
396 | 404 | </div> |
397 | 405 | </div> |
398 | 406 | </div> |
@@ -1064,6 +1072,16 @@ <h4 class="text-muted">{% translate "No assets found" %}</h4> |
1064 | 1072 | updateFilters(); |
1065 | 1073 | } |
1066 | 1074 |
|
| 1075 | +/** |
| 1076 | + * Change page size |
| 1077 | + */ |
| 1078 | +function changePageSize(pageSize) { |
| 1079 | + const url = new URL(window.location); |
| 1080 | + url.searchParams.set('page_size', pageSize); |
| 1081 | + url.searchParams.delete('page'); // Reset to page 1 |
| 1082 | + window.location.href = url.toString(); |
| 1083 | +} |
| 1084 | + |
1067 | 1085 | /** |
1068 | 1086 | * Initialize page functionality |
1069 | 1087 | */ |
|
0 commit comments