aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--assets/default/js/base.js27
-rw-r--r--assets/default/scss/shaarli.scss2
-rw-r--r--tpl/default/linklist.html2
-rw-r--r--tpl/default/linklist.paging.html3
4 files changed, 28 insertions, 6 deletions
diff --git a/assets/default/js/base.js b/assets/default/js/base.js
index 1b8d8c36..99e03370 100644
--- a/assets/default/js/base.js
+++ b/assets/default/js/base.js
@@ -422,12 +422,12 @@ function init(description) {
422 /** 422 /**
423 * Bulk actions 423 * Bulk actions
424 */ 424 */
425 const linkCheckboxes = document.querySelectorAll('.delete-checkbox'); 425 const linkCheckboxes = document.querySelectorAll('.link-checkbox');
426 const bar = document.getElementById('actions'); 426 const bar = document.getElementById('actions');
427 [...linkCheckboxes].forEach((checkbox) => { 427 [...linkCheckboxes].forEach((checkbox) => {
428 checkbox.style.display = 'inline-block'; 428 checkbox.style.display = 'inline-block';
429 checkbox.addEventListener('click', () => { 429 checkbox.addEventListener('change', () => {
430 const linkCheckedCheckboxes = document.querySelectorAll('.delete-checkbox:checked'); 430 const linkCheckedCheckboxes = document.querySelectorAll('.link-checkbox:checked');
431 const count = [...linkCheckedCheckboxes].length; 431 const count = [...linkCheckedCheckboxes].length;
432 if (count === 0 && bar.classList.contains('open')) { 432 if (count === 0 && bar.classList.contains('open')) {
433 bar.classList.toggle('open'); 433 bar.classList.toggle('open');
@@ -444,7 +444,7 @@ function init(description) {
444 event.preventDefault(); 444 event.preventDefault();
445 445
446 const links = []; 446 const links = [];
447 const linkCheckedCheckboxes = document.querySelectorAll('.delete-checkbox:checked'); 447 const linkCheckedCheckboxes = document.querySelectorAll('.link-checkbox:checked');
448 [...linkCheckedCheckboxes].forEach((checkbox) => { 448 [...linkCheckedCheckboxes].forEach((checkbox) => {
449 links.push({ 449 links.push({
450 id: checkbox.value, 450 id: checkbox.value,
@@ -467,6 +467,25 @@ function init(description) {
467 } 467 }
468 468
469 /** 469 /**
470 * Select all button
471 */
472 const selectAllButtons = document.querySelectorAll('.select-all-button');
473 [...selectAllButtons].forEach((selectAllButton) => {
474 selectAllButton.addEventListener('click', (e) => {
475 e.preventDefault();
476 const checked = selectAllButton.classList.contains('filter-off');
477 [...selectAllButtons].forEach((selectAllButton2) => {
478 selectAllButton2.classList.toggle('filter-off');
479 selectAllButton2.classList.toggle('filter-on');
480 });
481 [...linkCheckboxes].forEach((linkCheckbox) => {
482 linkCheckbox.checked = checked;
483 linkCheckbox.dispatchEvent(new Event('change'));
484 });
485 });
486 });
487
488 /**
470 * Tag list operations 489 * Tag list operations
471 * 490 *
472 * TODO: support error code in the backend for AJAX requests 491 * TODO: support error code in the backend for AJAX requests
diff --git a/assets/default/scss/shaarli.scss b/assets/default/scss/shaarli.scss
index 55f9f0a1..760d8d6a 100644
--- a/assets/default/scss/shaarli.scss
+++ b/assets/default/scss/shaarli.scss
@@ -740,7 +740,7 @@ body,
740 font-size: 1em; 740 font-size: 1em;
741 } 741 }
742 742
743 .delete-checkbox { 743 .link-checkbox {
744 display: none; 744 display: none;
745 } 745 }
746} 746}
diff --git a/tpl/default/linklist.html b/tpl/default/linklist.html
index aabb53ac..ed78f40a 100644
--- a/tpl/default/linklist.html
+++ b/tpl/default/linklist.html
@@ -192,7 +192,7 @@
192 {if="$is_logged_in"} 192 {if="$is_logged_in"}
193 <div class="linklist-item-infos-controls-group pure-u-0 pure-u-lg-visible"> 193 <div class="linklist-item-infos-controls-group pure-u-0 pure-u-lg-visible">
194 <span class="linklist-item-infos-controls-item ctrl-checkbox"> 194 <span class="linklist-item-infos-controls-item ctrl-checkbox">
195 <input type="checkbox" class="delete-checkbox" value="{$value.id}"> 195 <input type="checkbox" class="link-checkbox" value="{$value.id}">
196 </span> 196 </span>
197 <span class="linklist-item-infos-controls-item ctrl-edit"> 197 <span class="linklist-item-infos-controls-item ctrl-edit">
198 <a href="?edit_link={$value.id}" title="{$strEdit}"><i class="fa fa-pencil-square-o edit-link"></i></a> 198 <a href="?edit_link={$value.id}" title="{$strEdit}"><i class="fa fa-pencil-square-o edit-link"></i></a>
diff --git a/tpl/default/linklist.paging.html b/tpl/default/linklist.paging.html
index 5309e348..fe665a84 100644
--- a/tpl/default/linklist.paging.html
+++ b/tpl/default/linklist.paging.html
@@ -16,6 +16,9 @@
16 <a href="?untaggedonly" title="{'Filter untagged links'|t}" 16 <a href="?untaggedonly" title="{'Filter untagged links'|t}"
17 class={if="$untaggedonly"}"filter-on"{else}"filter-off"{/if} 17 class={if="$untaggedonly"}"filter-on"{else}"filter-off"{/if}
18 ><i class="fa fa-tag"></i></a> 18 ><i class="fa fa-tag"></i></a>
19 <a href="#" title="{'Select all'|t}"
20 class="filter-off select-all-button"
21 ><i class="fa fa-check-square-o"></i></a>
19 <a href="#" class="filter-off fold-all pure-u-lg-0" title="{'Fold all'|t}"> 22 <a href="#" class="filter-off fold-all pure-u-lg-0" title="{'Fold all'|t}">
20 <i class="fa fa-chevron-up"></i> 23 <i class="fa fa-chevron-up"></i>
21 </a> 24 </a>