Fossil SCM

add quickfilter to repolist as well

jkosche 2025-03-26 13:54 quickfilter
Commit 8974b306ee63eaea0d4a9a9bc7b0d72bb2b94c824835427eeb15f70c5ee6c7f6
1 file changed +35 -1
+35 -1
--- src/repolist.c
+++ src/repolist.c
@@ -162,11 +162,11 @@
162162
}else{
163163
Stmt q;
164164
double rNow;
165165
blob_append_sql(&html,
166166
"<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"
168168
"<tr><th>Filename<th width='20'>"
169169
"<th>Project Name<th width='20'>"
170170
"<th>Last Modified<th width='20'>"
171171
"<th>Login Group</tr>\n"
172172
"</thead><tbody>\n");
@@ -312,11 +312,28 @@
312312
** that repository open in g.db. Use the skin of that repository
313313
** for display. */
314314
login_check_credentials();
315315
style_set_current_feature("repolist");
316316
style_header("Repository List");
317
+ @ <input type="text" id="quickfilter" placeholder="filter repository list..." style="display: none">
317318
@ %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>
318335
style_table_sorter();
319336
style_finish_page();
320337
}else{
321338
const char *zTitle = PD("FOSSIL_REPOLIST_TITLE","Repository List");
322339
/* If no repositories were found that had the "repolist_skin"
@@ -327,12 +344,29 @@
327344
@ <meta name="viewport" content="width=device-width, initial-scale=1.0">
328345
@ <title>%h(zTitle)</title>
329346
@ </head>
330347
@ <body>
331348
@ <h1 align="center">%h(zTitle)</h1>
349
+ @ <input type="text" id="quickfilter" placeholder="filter repository list..." style="display: none">
332350
@ %s(blob_str(&html))
333351
@ <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>
334368
@ </body>
335369
@ </html>
336370
}
337371
blob_reset(&html);
338372
cgi_reply();
339373
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button