|
56 | 56 | {{ $sort_order := cond $sort_ascending "asc" "desc" }} |
57 | 57 | {{ $query = sort $query $sort_by $sort_order }} |
58 | 58 |
|
59 | | -{{/* Store total count before limiting */}} |
60 | | -{{ $total_count := len $query }} |
61 | | - |
62 | | -{{/* Limit */}} |
63 | | -{{ $count := partial "functions/coerce_int" (dict "value" (index $content "count") "default" 6 "min" 0) }} |
64 | | -{{ if gt $count 0 }} |
65 | | - {{ $query = first $count $query }} |
66 | | -{{ end }} |
67 | | - |
68 | 59 | {{/* Get filter buttons */}} |
69 | 60 | {{ $buttons_raw := index $content "buttons" }} |
70 | 61 | {{ $buttons := slice }} |
|
86 | 77 | {{ end }} |
87 | 78 | {{ end }} |
88 | 79 |
|
| 80 | +{{/* Store total count before limiting; keep full set when filtering so buttons work */}} |
| 81 | +{{ $total_count := len $query }} |
| 82 | +{{ $has_multiple_filters := gt (len $buttons) 1 }} |
| 83 | + |
| 84 | +{{/* Limit (only when not using multiple filters, since Alpine filters client-side) */}} |
| 85 | +{{ $count := partial "functions/coerce_int" (dict "value" (index $content "count") "default" 6 "min" 0) }} |
| 86 | +{{ if and (gt $count 0) (not $has_multiple_filters) }} |
| 87 | + {{ $query = first $count $query }} |
| 88 | +{{ end }} |
| 89 | +{{ $displayed_count := len $query }} |
| 90 | + |
89 | 91 | {{/* Columns */}} |
90 | 92 | {{ $columns := partial "functions/coerce_int" (dict "value" (index $design "columns") "default" 3 "min" 1 "max" 4) }} |
91 | 93 | {{ $grid_class := "md:grid-cols-2 lg:grid-cols-3" }} |
@@ -390,9 +392,7 @@ <h3 class="text-lg font-bold text-gray-900 dark:text-white mb-2 group-hover:text |
390 | 392 | {{ $archive := index $content "archive" }} |
391 | 393 | {{ if not (reflect.IsMap $archive) }}{{ $archive = dict }}{{ end }} |
392 | 394 | {{ $default_show_archive := false }} |
393 | | - {{ if gt $count 0 }} |
394 | | - {{ $default_show_archive = gt $total_count $count }} |
395 | | - {{ end }} |
| 395 | + {{ $default_show_archive = gt $total_count $displayed_count }} |
396 | 396 | {{ $show_archive_link := partial "functions/coerce_bool" (dict "value" (index $archive "enable") "default" $default_show_archive) }} |
397 | 397 | {{ if and $show_archive_link $archive_page }} |
398 | 398 | {{ $archive_link := "" }} |
|
0 commit comments