Feature: bulk creation of bookmarks

This changes creates a new form in addlink page allowing to create
multiple bookmarks at once more easily. It focuses on re-using as much
existing code and template component as  possible.

These changes includes:
  - a new form in addlink (hidden behind a button by default),
containing a text area for URL, and tags/private status to apply to
created links
  - this form displays a new template called editlink.batch, itself
including editlink template multiple times
  - User interation in this new templates are handle by a new JS script
(shaare-batch.js) making AJAX requests, and therefore does not need page
reloading
  - ManageShaareController has been split into 3 distinct controllers:
    + ShaareAdd: displays addlink template
    + ShaareManage: various operation applied on existing shaares
(change visibility, pin, deletion, etc.)
    + ShaarePublish: handles creation/edit forms and saving Shaare's
form
  - Updated translations

Fixes 
This commit is contained in:
ArthurHoaro 2020-10-10 17:40:26 +02:00
parent b8e5a253ab
commit 5d8de7587d
25 changed files with 1028 additions and 527 deletions
assets/default/js

View file

@ -634,4 +634,25 @@ function init(description) {
});
});
}
const bulkCreationButton = document.querySelector('.addlink-batch-show-more-block');
if (bulkCreationButton != null) {
const toggleBulkCreationVisibility = (showMoreBlockElement, formElement) => {
if (bulkCreationButton.classList.contains('pure-u-0')) {
showMoreBlockElement.classList.remove('pure-u-0');
formElement.classList.add('pure-u-0');
} else {
showMoreBlockElement.classList.add('pure-u-0');
formElement.classList.remove('pure-u-0');
}
};
const bulkCreationForm = document.querySelector('.addlink-batch-form-block');
toggleBulkCreationVisibility(bulkCreationButton, bulkCreationForm);
bulkCreationButton.querySelector('a').addEventListener('click', (e) => {
e.preventDefault();
toggleBulkCreationVisibility(bulkCreationButton, bulkCreationForm);
});
}
})();