mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
Added manual tag removal
This commit is contained in:
@ -45,6 +45,7 @@ App.Auth = function(_, jQuery, util, api, appState, promise) {
|
||||
editAllComments: 'editAllComments',
|
||||
deleteOwnComments: 'deleteOwnComments',
|
||||
deleteAllComments: 'deleteAllComments',
|
||||
deleteTags: 'deleteTags',
|
||||
|
||||
listTags: 'listTags',
|
||||
massTag: 'massTag',
|
||||
|
@ -83,12 +83,14 @@ App.Presenters.TagPresenter = function(
|
||||
tagCategories: JSON.parse(jQuery('head').attr('data-tag-categories')),
|
||||
}));
|
||||
$el.find('.post-list').hide();
|
||||
$el.find('form').submit(editFormSubmitted);
|
||||
$el.find('form').submit(function(e) { e.preventDefault(); });
|
||||
$el.find('form button[name=update]').click(updateButtonClicked);
|
||||
$el.find('form button[name=delete]').click(deleteButtonClicked);
|
||||
implicationsTagInput = App.Controls.TagInput($el.find('[name=implications]'));
|
||||
suggestionsTagInput = App.Controls.TagInput($el.find('[name=suggestions]'));
|
||||
}
|
||||
|
||||
function editFormSubmitted(e) {
|
||||
function updateButtonClicked(e) {
|
||||
e.preventDefault();
|
||||
var $form = $el.find('form');
|
||||
var formData = {};
|
||||
@ -121,6 +123,18 @@ App.Presenters.TagPresenter = function(
|
||||
});
|
||||
}
|
||||
|
||||
function deleteButtonClicked(e) {
|
||||
if (!window.confirm('Are you sure you want to delete this tag?')) {
|
||||
return;
|
||||
}
|
||||
promise.wait(api.delete('/tags/' + tag.name))
|
||||
.then(function(response) {
|
||||
router.navigate('#/tags');
|
||||
}).fail(function(response) {
|
||||
window.alert(response.json && response.json.error || 'An error occured.');
|
||||
});
|
||||
}
|
||||
|
||||
function renderPosts(posts) {
|
||||
var $target = $el.find('.post-list ul');
|
||||
_.each(posts, function(post) {
|
||||
|
Reference in New Issue
Block a user