From b023699f1b4b2abd151b2b763ae2d809d1aa3d45 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sun, 13 Aug 2017 11:50:40 +0100 Subject: [PATCH] Converted tag manager to be fully vue based --- resources/assets/js/controllers.js | 17 ----------------- resources/assets/js/vues/tag-manager.js | 9 ++++++--- resources/views/pages/form-toolbox.blade.php | 14 +++++++------- 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/resources/assets/js/controllers.js b/resources/assets/js/controllers.js index c317da753..132580f68 100644 --- a/resources/assets/js/controllers.js +++ b/resources/assets/js/controllers.js @@ -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) { diff --git a/resources/assets/js/vues/tag-manager.js b/resources/assets/js/vues/tag-manager.js index cf3e4d34e..d934b6266 100644 --- a/resources/assets/js/vues/tag-manager.js +++ b/resources/assets/js/vues/tag-manager.js @@ -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() { diff --git a/resources/views/pages/form-toolbox.blade.php b/resources/views/pages/form-toolbox.blade.php index 9b8cd4ed3..71a4b637e 100644 --- a/resources/views/pages/form-toolbox.blade.php +++ b/resources/views/pages/form-toolbox.blade.php @@ -18,9 +18,9 @@
-
-
@@ -86,15 +86,15 @@

{{ trans('entities.attachments_explain_link') }}

- +

- +

- + @@ -122,14 +122,14 @@
- +

- +