|
53 | 53 | </div> |
54 | 54 | <div class="row justify-content-center justify-content-lg-between"> |
55 | 55 | <cfoutput> |
56 | | - <div id="blogsContainer" class="row mt-lg-0 mt-3 col-lg-12 col-12 h-max row-cols-lg-2 row-cols-1" |
57 | | - <cfif isDefined("params.filterType") and isDefined("params.filterValue")> |
58 | | - hx-get="/blog/list/#params.filterType#/#params.filterValue#" |
59 | | - <cfelse> |
60 | | - hx-get="/blog/list" |
| 56 | + <!-- Detect if filtering via route (e.g. blog/year/month or blog/category/tag) --> |
| 57 | + <cfset isFiltered = structKeyExists(params, "year") or structKeyExists(params, "filterType")> |
| 58 | + |
| 59 | + <!-- wrapper that triggers the HTMX call --> |
| 60 | + <cfif NOT isFiltered> |
| 61 | + <div |
| 62 | + id="hxLoader" |
| 63 | + hx-get="/blog/list" |
| 64 | + hx-trigger="load" |
| 65 | + hx-target="##blogsContainer" |
| 66 | + hx-swap="innerHTML"> |
| 67 | + </div> |
61 | 68 | </cfif> |
62 | | - hx-trigger="load" hx-target="##blogsContainer" hx-swap="innerHTML"> |
| 69 | + |
| 70 | + <!-- blog list container --> |
| 71 | + <div |
| 72 | + id="blogsContainer" |
| 73 | + class="row mt-lg-0 mt-3 col-lg-12 col-12 h-max row-cols-lg-2 row-cols-1"> |
63 | 74 | </div> |
64 | 75 | </cfoutput> |
65 | 76 | <div id="filtersContainer" class="col-lg-2 order-lg-0 order-first col-12 p-lg-0 d-none"> |
|
72 | 83 | <cfset months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]> |
73 | 84 |
|
74 | 85 | <div class="d-none bg-white p-3 text-center rounded-18 no-scrollbar h-70vh overflow-y-auto" id="Archives"> |
| 86 | + <!-- Archives Button --> |
75 | 87 | <cfoutput> |
76 | | - <cfloop index="year" from="#currentYear#" to="#startYear#" step="-1"> |
77 | | - <cfset monthLimit = (year EQ currentYear) ? currentMonth : 12> |
78 | | - <cfset startLimit = (year EQ startYear) ? startMonth : 1> |
| 88 | + <cfloop index="year" from="#currentYear#" to="#startYear#" step="-1"> |
| 89 | + <cfset monthLimit = (year EQ currentYear) ? currentMonth : 12> |
| 90 | + <cfset startLimit = (year EQ startYear) ? startMonth : 1> |
79 | 91 |
|
80 | | - <cfloop index="month" from="#monthLimit#" to="#startLimit#" step="-1"> |
81 | | - <p class="fs-14 border-bottom mb-0 py-2 cursor-pointer fw-normal text--iris" |
82 | | - hx-get="/blog/monthyear/#NumberFormat(month, '00')##year#" |
83 | | - hx-trigger="click" |
84 | | - hx-target="##blogsContainer" |
85 | | - hx-swap="innerHTML"> |
86 | | - #months[month]# #year# |
87 | | - </p> |
| 92 | + <cfloop index="month" from="#monthLimit#" to="#startLimit#" step="-1"> |
| 93 | + <p |
| 94 | + hx-get="/blog/#year#/#NumberFormat(month, '00')#" |
| 95 | + hx-target="##blogsContainer" |
| 96 | + hx-swap="innerHTML" |
| 97 | + class="fs-14 border-bottom mb-0 py-2 cursor-pointer fw-normal text--iris"> |
| 98 | + #months[month]# #year# |
| 99 | + </p> |
| 100 | + </cfloop> |
88 | 101 | </cfloop> |
89 | | - </cfloop> |
90 | 102 | </cfoutput> |
91 | 103 | </div> |
92 | 104 |
|
|
0 commit comments