mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-11 18:21:04 +08:00
27 lines
866 B
JavaScript
27 lines
866 B
JavaScript
(function() {
|
|
function initDeleteFilterModal() {
|
|
$('.activity-filters-list').on('click', '.delete-filter', function() {
|
|
$('#deleteFilterModal').find('.description b').text(this.dataset.name);
|
|
$('#deleteFilterModal').find('#filter_id').val(this.dataset.id);
|
|
$('#deleteFilterModal').modal('show');
|
|
});
|
|
}
|
|
|
|
function initFilterInfoDropdown() {
|
|
$('.info-container').on('show.bs.dropdown', function() {
|
|
var tagsList = $(this).find('.tags-list');
|
|
if (tagsList.is(':empty')) {
|
|
$.get(this.dataset.url, function(data) {
|
|
$.each(data.filter_elements, function(i, element) {
|
|
let tag = $('<span class="filter-info-tag"></span>');
|
|
tag.text(element);
|
|
tagsList.append(tag);
|
|
});
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
initDeleteFilterModal();
|
|
initFilterInfoDropdown();
|
|
}());
|