mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-26 08:39:58 +08:00
Cleaned up tag edit interface
This commit is contained in:
@ -405,6 +405,13 @@ module.exports = function (ngApp, events) {
|
||||
|
||||
const pageId = Number($attrs.pageId);
|
||||
$scope.tags = [];
|
||||
|
||||
$scope.sortOptions = {
|
||||
handle: '.handle',
|
||||
items: '> tr',
|
||||
containment: "parent",
|
||||
axis: "y"
|
||||
};
|
||||
|
||||
/**
|
||||
* Push an empty tag to the end of the scope tags.
|
||||
@ -415,6 +422,7 @@ module.exports = function (ngApp, events) {
|
||||
value: ''
|
||||
});
|
||||
}
|
||||
$scope.addEmptyTag = addEmptyTag;
|
||||
|
||||
/**
|
||||
* Get all tags for the current book and add into scope.
|
||||
@ -463,6 +471,9 @@ module.exports = function (ngApp, events) {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Save the tags to the current page.
|
||||
*/
|
||||
$scope.saveTags = function() {
|
||||
setTagOrder();
|
||||
let postData = {tags: $scope.tags};
|
||||
@ -473,6 +484,15 @@ module.exports = function (ngApp, events) {
|
||||
})
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove a tag from the current list.
|
||||
* @param tag
|
||||
*/
|
||||
$scope.removeTag = function(tag) {
|
||||
let cIndex = $scope.tags.indexOf(tag);
|
||||
$scope.tags.splice(cIndex, 1);
|
||||
};
|
||||
|
||||
}]);
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user