From 49132e2b7f64292ac9049b2348ee8e7e4245e794 Mon Sep 17 00:00:00 2001 From: Patrick de Mooij Date: Tue, 5 Oct 2021 22:20:27 +0200 Subject: [PATCH] 8258: Added create dictionary item button --- .../dictionary/dictionary.list.controller.js | 14 +++- .../src/views/dictionary/list.html | 82 +++++++++++-------- src/Umbraco.Web.UI/umbraco/config/lang/en.xml | 1 + .../umbraco/config/lang/en_us.xml | 1 + 4 files changed, 61 insertions(+), 37 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.list.controller.js b/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.list.controller.js index e55dfd44a1..669a0d5183 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.list.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.list.controller.js @@ -1,4 +1,4 @@ -/** +/** * @ngdoc controller * @name Umbraco.Editors.Dictionary.ListController * @function @@ -6,7 +6,7 @@ * @description * The controller for listting dictionary items */ -function DictionaryListController($scope, $location, dictionaryResource, localizationService, appState) { +function DictionaryListController($scope, $location, dictionaryResource, localizationService, appState, navigationService) { var vm = this; vm.title = "Dictionary overview"; vm.loading = false; @@ -31,7 +31,17 @@ function DictionaryListController($scope, $location, dictionaryResource, localiz $location.path("/" + currentSection + "/dictionary/edit/" + id); } + function createNewItem() { + var rootNode = appState.getTreeState("currentRootNode").root; + //We need to load the menu first before we can access the menu actions. + navigationService.showMenu({ node: rootNode }).then(function () { + const action = appState.getMenuState("menuActions").find(item => item.alias === "create"); + navigationService.executeMenuAction(action, rootNode, appState.getSectionState("currentSection")); + }); + } + vm.clickItem = clickItem; + vm.createNewItem = createNewItem; function onInit() { localizationService.localize("dictionaryItem_overviewTitle").then(function (value) { diff --git a/src/Umbraco.Web.UI.Client/src/views/dictionary/list.html b/src/Umbraco.Web.UI.Client/src/views/dictionary/list.html index 928aba0607..14c7bb4c5c 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dictionary/list.html +++ b/src/Umbraco.Web.UI.Client/src/views/dictionary/list.html @@ -1,4 +1,4 @@ -
+
@@ -13,43 +13,55 @@ - - + - - There are no dictionary items. - + + + + - - + - - - - - - - - - - - - - - -
Name{{column.displayName}}
- - - -
+ + + + + There are no dictionary items. + + + + + + + + + + + + + + + + + + + +
Name{{column.displayName}}
+ + + +
diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml index 27137c0a5e..a5b2bb5540 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml @@ -500,6 +500,7 @@ There are no dictionary items. + Create dictionary item There are no dictionary items. + Create dictionary item