Fossil SCM
add quickfilter to repolist as well
Commit
8974b306ee63eaea0d4a9a9bc7b0d72bb2b94c824835427eeb15f70c5ee6c7f6
Parent
a3fe792b2c05cbe…
1 file changed
+35
-1
+35
-1
| --- src/repolist.c | ||
| +++ src/repolist.c | ||
| @@ -162,11 +162,11 @@ | ||
| 162 | 162 | }else{ |
| 163 | 163 | Stmt q; |
| 164 | 164 | double rNow; |
| 165 | 165 | blob_append_sql(&html, |
| 166 | 166 | "<table border='0' class='sortable' data-init-sort='1'" |
| 167 | - " data-column-types='txtxkxt'><thead>\n" | |
| 167 | + " data-column-types='txtxkxt' id=\"repolist\"><thead>\n" | |
| 168 | 168 | "<tr><th>Filename<th width='20'>" |
| 169 | 169 | "<th>Project Name<th width='20'>" |
| 170 | 170 | "<th>Last Modified<th width='20'>" |
| 171 | 171 | "<th>Login Group</tr>\n" |
| 172 | 172 | "</thead><tbody>\n"); |
| @@ -312,11 +312,28 @@ | ||
| 312 | 312 | ** that repository open in g.db. Use the skin of that repository |
| 313 | 313 | ** for display. */ |
| 314 | 314 | login_check_credentials(); |
| 315 | 315 | style_set_current_feature("repolist"); |
| 316 | 316 | style_header("Repository List"); |
| 317 | + @ <input type="text" id="quickfilter" placeholder="filter repository list..." style="display: none"> | |
| 317 | 318 | @ %s(blob_str(&html)) |
| 319 | + @ <script nonce="%h(style_nonce())"> | |
| 320 | + @ const quickfilter = document.getElementById('quickfilter'); | |
| 321 | + @ const ticketlist = document.querySelectorAll('#repolist tbody tr'); | |
| 322 | + @ | |
| 323 | + @ document.addEventListener('DOMContentLoaded', function(){ | |
| 324 | + @ if (ticketlist.length > 5) quickfilter.style.display = ''; | |
| 325 | + @ }); | |
| 326 | + @ | |
| 327 | + @ quickfilter.addEventListener('input', function (){ | |
| 328 | + @ const filter = quickfilter.value.toLowerCase().trim(); | |
| 329 | + @ ticketlist.forEach(function(row){ | |
| 330 | + @ const rowText = row.textContent.toLowerCase().trim(); | |
| 331 | + @ row.style.display = rowText.includes(filter) ? 'table-row' : 'none'; | |
| 332 | + @ }); | |
| 333 | + @ }); | |
| 334 | + @ </script> | |
| 318 | 335 | style_table_sorter(); |
| 319 | 336 | style_finish_page(); |
| 320 | 337 | }else{ |
| 321 | 338 | const char *zTitle = PD("FOSSIL_REPOLIST_TITLE","Repository List"); |
| 322 | 339 | /* If no repositories were found that had the "repolist_skin" |
| @@ -327,12 +344,29 @@ | ||
| 327 | 344 | @ <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 328 | 345 | @ <title>%h(zTitle)</title> |
| 329 | 346 | @ </head> |
| 330 | 347 | @ <body> |
| 331 | 348 | @ <h1 align="center">%h(zTitle)</h1> |
| 349 | + @ <input type="text" id="quickfilter" placeholder="filter repository list..." style="display: none"> | |
| 332 | 350 | @ %s(blob_str(&html)) |
| 333 | 351 | @ <script>%s(builtin_text("sorttable.js"))</script> |
| 352 | + @ <script> | |
| 353 | + @ const quickfilter = document.getElementById('quickfilter'); | |
| 354 | + @ const ticketlist = document.querySelectorAll('#repolist tbody tr'); | |
| 355 | + @ | |
| 356 | + @ document.addEventListener('DOMContentLoaded', function(){ | |
| 357 | + @ if (ticketlist.length > 5) quickfilter.style.display = ''; | |
| 358 | + @ }); | |
| 359 | + @ | |
| 360 | + @ quickfilter.addEventListener('input', function (){ | |
| 361 | + @ const filter = quickfilter.value.toLowerCase().trim(); | |
| 362 | + @ ticketlist.forEach(function(row){ | |
| 363 | + @ const rowText = row.textContent.toLowerCase().trim(); | |
| 364 | + @ row.style.display = rowText.includes(filter) ? 'table-row' : 'none'; | |
| 365 | + @ }); | |
| 366 | + @ }); | |
| 367 | + @ </script> | |
| 334 | 368 | @ </body> |
| 335 | 369 | @ </html> |
| 336 | 370 | } |
| 337 | 371 | blob_reset(&html); |
| 338 | 372 | cgi_reply(); |
| 339 | 373 |
| --- src/repolist.c | |
| +++ src/repolist.c | |
| @@ -162,11 +162,11 @@ | |
| 162 | }else{ |
| 163 | Stmt q; |
| 164 | double rNow; |
| 165 | blob_append_sql(&html, |
| 166 | "<table border='0' class='sortable' data-init-sort='1'" |
| 167 | " data-column-types='txtxkxt'><thead>\n" |
| 168 | "<tr><th>Filename<th width='20'>" |
| 169 | "<th>Project Name<th width='20'>" |
| 170 | "<th>Last Modified<th width='20'>" |
| 171 | "<th>Login Group</tr>\n" |
| 172 | "</thead><tbody>\n"); |
| @@ -312,11 +312,28 @@ | |
| 312 | ** that repository open in g.db. Use the skin of that repository |
| 313 | ** for display. */ |
| 314 | login_check_credentials(); |
| 315 | style_set_current_feature("repolist"); |
| 316 | style_header("Repository List"); |
| 317 | @ %s(blob_str(&html)) |
| 318 | style_table_sorter(); |
| 319 | style_finish_page(); |
| 320 | }else{ |
| 321 | const char *zTitle = PD("FOSSIL_REPOLIST_TITLE","Repository List"); |
| 322 | /* If no repositories were found that had the "repolist_skin" |
| @@ -327,12 +344,29 @@ | |
| 327 | @ <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 328 | @ <title>%h(zTitle)</title> |
| 329 | @ </head> |
| 330 | @ <body> |
| 331 | @ <h1 align="center">%h(zTitle)</h1> |
| 332 | @ %s(blob_str(&html)) |
| 333 | @ <script>%s(builtin_text("sorttable.js"))</script> |
| 334 | @ </body> |
| 335 | @ </html> |
| 336 | } |
| 337 | blob_reset(&html); |
| 338 | cgi_reply(); |
| 339 |
| --- src/repolist.c | |
| +++ src/repolist.c | |
| @@ -162,11 +162,11 @@ | |
| 162 | }else{ |
| 163 | Stmt q; |
| 164 | double rNow; |
| 165 | blob_append_sql(&html, |
| 166 | "<table border='0' class='sortable' data-init-sort='1'" |
| 167 | " data-column-types='txtxkxt' id=\"repolist\"><thead>\n" |
| 168 | "<tr><th>Filename<th width='20'>" |
| 169 | "<th>Project Name<th width='20'>" |
| 170 | "<th>Last Modified<th width='20'>" |
| 171 | "<th>Login Group</tr>\n" |
| 172 | "</thead><tbody>\n"); |
| @@ -312,11 +312,28 @@ | |
| 312 | ** that repository open in g.db. Use the skin of that repository |
| 313 | ** for display. */ |
| 314 | login_check_credentials(); |
| 315 | style_set_current_feature("repolist"); |
| 316 | style_header("Repository List"); |
| 317 | @ <input type="text" id="quickfilter" placeholder="filter repository list..." style="display: none"> |
| 318 | @ %s(blob_str(&html)) |
| 319 | @ <script nonce="%h(style_nonce())"> |
| 320 | @ const quickfilter = document.getElementById('quickfilter'); |
| 321 | @ const ticketlist = document.querySelectorAll('#repolist tbody tr'); |
| 322 | @ |
| 323 | @ document.addEventListener('DOMContentLoaded', function(){ |
| 324 | @ if (ticketlist.length > 5) quickfilter.style.display = ''; |
| 325 | @ }); |
| 326 | @ |
| 327 | @ quickfilter.addEventListener('input', function (){ |
| 328 | @ const filter = quickfilter.value.toLowerCase().trim(); |
| 329 | @ ticketlist.forEach(function(row){ |
| 330 | @ const rowText = row.textContent.toLowerCase().trim(); |
| 331 | @ row.style.display = rowText.includes(filter) ? 'table-row' : 'none'; |
| 332 | @ }); |
| 333 | @ }); |
| 334 | @ </script> |
| 335 | style_table_sorter(); |
| 336 | style_finish_page(); |
| 337 | }else{ |
| 338 | const char *zTitle = PD("FOSSIL_REPOLIST_TITLE","Repository List"); |
| 339 | /* If no repositories were found that had the "repolist_skin" |
| @@ -327,12 +344,29 @@ | |
| 344 | @ <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 345 | @ <title>%h(zTitle)</title> |
| 346 | @ </head> |
| 347 | @ <body> |
| 348 | @ <h1 align="center">%h(zTitle)</h1> |
| 349 | @ <input type="text" id="quickfilter" placeholder="filter repository list..." style="display: none"> |
| 350 | @ %s(blob_str(&html)) |
| 351 | @ <script>%s(builtin_text("sorttable.js"))</script> |
| 352 | @ <script> |
| 353 | @ const quickfilter = document.getElementById('quickfilter'); |
| 354 | @ const ticketlist = document.querySelectorAll('#repolist tbody tr'); |
| 355 | @ |
| 356 | @ document.addEventListener('DOMContentLoaded', function(){ |
| 357 | @ if (ticketlist.length > 5) quickfilter.style.display = ''; |
| 358 | @ }); |
| 359 | @ |
| 360 | @ quickfilter.addEventListener('input', function (){ |
| 361 | @ const filter = quickfilter.value.toLowerCase().trim(); |
| 362 | @ ticketlist.forEach(function(row){ |
| 363 | @ const rowText = row.textContent.toLowerCase().trim(); |
| 364 | @ row.style.display = rowText.includes(filter) ? 'table-row' : 'none'; |
| 365 | @ }); |
| 366 | @ }); |
| 367 | @ </script> |
| 368 | @ </body> |
| 369 | @ </html> |
| 370 | } |
| 371 | blob_reset(&html); |
| 372 | cgi_reply(); |
| 373 |