aboutsummaryrefslogtreecommitdiffhomepage
path: root/assets/default/js
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2019-04-22 12:31:09 +0200
committerGitHub <noreply@github.com>2019-04-22 12:31:09 +0200
commit786f35f2700d83687ef494b98e3dace37d268e1c (patch)
treef18c3fbae17445c29b031a5405a2779bba314b32 /assets/default/js
parente7ffbb7ed1c9e771b40df2d8911daedd6e7c5198 (diff)
parent8d03f705ebbc891e216d509d4de0419842ebd317 (diff)
downloadShaarli-786f35f2700d83687ef494b98e3dace37d268e1c.tar.gz
Shaarli-786f35f2700d83687ef494b98e3dace37d268e1c.tar.zst
Shaarli-786f35f2700d83687ef494b98e3dace37d268e1c.zip
Merge pull request #1276 from ArthurHoaro/feature/bulk-visibility
Bulk action: set visibility
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 */