aboutsummaryrefslogtreecommitdiffhomepage
path: root/assets/default/js
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2019-02-09 17:59:53 +0100
committerArthurHoaro <arthur@hoa.ro>2019-02-09 17:59:53 +0100
commit8d03f705ebbc891e216d509d4de0419842ebd317 (patch)
treebebafd238e43679e23c1f626eb7e13ee351adfe1 /assets/default/js
parent905f8675a728841b03b300d2c7dc909a1c4f7f03 (diff)
downloadShaarli-8d03f705ebbc891e216d509d4de0419842ebd317.tar.gz
Shaarli-8d03f705ebbc891e216d509d4de0419842ebd317.tar.zst
Shaarli-8d03f705ebbc891e216d509d4de0419842ebd317.zip
Bulk action: set visibility
Added 2 buttons when link checkboxes are checked to set them either public or private. Related to #572 #1160
Diffstat (limited to 'assets/default/js')
-rw-r--r--assets/default/js/base.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/assets/default/js/base.js b/assets/default/js/base.js
index 99e03370..d5c29c69 100644
--- a/assets/default/js/base.js
+++ b/assets/default/js/base.js
@@ -466,6 +466,28 @@ function init(description) {
466 }); 466 });
467 } 467 }
468 468
469 const changeVisibilityButtons = document.querySelectorAll('.actions-change-visibility');
470 if (changeVisibilityButtons != null && token != null) {
471 [...changeVisibilityButtons].forEach((button) => {
472 button.addEventListener('click', (event) => {
473 event.preventDefault();
474 const visibility = event.target.getAttribute('data-visibility');
475
476 const links = [];
477 const linkCheckedCheckboxes = document.querySelectorAll('.link-checkbox:checked');
478 [...linkCheckedCheckboxes].forEach((checkbox) => {
479 links.push({
480 id: checkbox.value,
481 title: document.querySelector(`.linklist-item[data-id="${checkbox.value}"] .linklist-link`).innerHTML,
482 });
483 });
484
485 const ids = links.map(item => item.id);
486 window.location = `?change_visibility&token=${token.value}&newVisibility=${visibility}&ids=${ids.join('+')}`;
487 });
488 });
489 }
490
469 /** 491 /**
470 * Select all button 492 * Select all button
471 */ 493 */