1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-06 12:02:45 +03:00

Converted tag manager to be fully vue based

This commit is contained in:
Dan Brown
2017-08-13 11:50:40 +01:00
parent f338dbe3f8
commit b023699f1b
3 changed files with 13 additions and 27 deletions

View File

@@ -145,23 +145,6 @@ module.exports = function (ngApp, events) {
}]);
ngApp.controller('PageTagController', ['$scope', '$http', '$attrs',
function ($scope, $http, $attrs) {
const pageId = Number($attrs.pageId);
$scope.tags = [];
$scope.sortOptions = {
handle: '.handle',
items: '> tr',
containment: "parent",
axis: "y"
};
// TODO - Delete
}]);
ngApp.controller('PageAttachmentController', ['$scope', '$http', '$attrs',
function ($scope, $http, $attrs) {

View File

@@ -23,8 +23,7 @@ let methods = {
*/
tagChange(tag) {
let tagPos = this.tags.indexOf(tag);
if (tagPos !== this.tags.length-1 || tag.name !== '' || tag.value !== '') return;
this.addEmptyTag();
if (tagPos === this.tags.length-1 && (tag.name !== '' || tag.value !== '')) this.addEmptyTag();
},
/**
@@ -43,7 +42,11 @@ let methods = {
let tagPos = this.tags.indexOf(tag);
if (tagPos === -1) return;
this.tags.splice(tagPos, 1);
}
},
getTagFieldName(index, key) {
return `tags[${index}][${key}]`;
},
};
function mounted() {