+ * var section = dictionaryResource.getSection(); + *+ * + * @returns string. + * + **/ + function getSection() { + var section = $location.$$path; + if (section.startsWith("/")) { + section = section.substring(1, section.length); + } + var firstSlash = section.indexOf("/"); + if (firstSlash !== -1) { + section = section.substring(0, firstSlash); + } + return section; + } + var resource = { deleteById: deleteById, create: create, getById: getById, save: save, - getList : getList + getList : getList, + getSection: getSection }; return resource; @@ -159,4 +188,4 @@ function dictionaryResource($q, $http, umbRequestHelper, umbDataFormatter) { } -angular.module("umbraco.resources").factory("dictionaryResource", dictionaryResource); \ No newline at end of file +angular.module("umbraco.resources").factory("dictionaryResource", dictionaryResource); diff --git a/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.create.controller.js b/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.create.controller.js index d55c26bc37..cd92053aea 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.create.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.create.controller.js @@ -7,37 +7,38 @@ * The controller for creating dictionary items */ function DictionaryCreateController($scope, $location, dictionaryResource, navigationService, notificationsService, formHelper) { - vm = this; + var vm = this; - vm.itemKey = ''; + vm.itemKey = ""; - function createItem() { + function createItem() { - var node = $scope.dialogOptions.currentNode; + var node = $scope.dialogOptions.currentNode; - dictionaryResource.create(node.id, vm.itemKey).then(function(data) { - navigationService.hideMenu(); + dictionaryResource.create(node.id, vm.itemKey).then(function (data) { + navigationService.hideMenu(); - // set new item as active in tree - var currPath = node.path ? node.path : "-1"; - navigationService.syncTree({ tree: "dictionary", path: currPath + "," + data, forceReload: true, activate: true }); + // set new item as active in tree + var currPath = node.path ? node.path : "-1"; + navigationService.syncTree({ tree: "dictionary", path: currPath + "," + data, forceReload: true, activate: true }); - // reset form state - formHelper.resetForm({ scope: $scope }); + // reset form state + formHelper.resetForm({ scope: $scope }); - // navigate to edit view - $location.path("/settings/dictionary/edit/" + data); + // navigate to edit view + var section = dictionaryResource.getSection(); + $location.path("/" + section + "/dictionary/edit/" + data); - - },function(err) { - if (err.data && err.data.message) { - notificationsService.error(err.data.message); - navigationService.hideMenu(); - } - }); - } - vm.createItem = createItem; + }, function (err) { + if (err.data && err.data.message) { + notificationsService.error(err.data.message); + navigationService.hideMenu(); + } + }); + } + + vm.createItem = createItem; } -angular.module("umbraco").controller("Umbraco.Editors.Dictionary.CreateController", DictionaryCreateController); \ No newline at end of file +angular.module("umbraco").controller("Umbraco.Editors.Dictionary.CreateController", DictionaryCreateController); diff --git a/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.delete.controller.js b/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.delete.controller.js index e91f57429f..56aa80d5f0 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.delete.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.delete.controller.js @@ -7,43 +7,44 @@ * The controller for deleting dictionary items */ function DictionaryDeleteController($scope, $location, dictionaryResource, treeService, navigationService) { - vm = this; + var vm = this; - function cancel() { - navigationService.hideDialog(); - } + function cancel() { + navigationService.hideDialog(); + } - function performDelete() { - // stop from firing again on double-click - if ($scope.busy) { return false; } + function performDelete() { + // stop from firing again on double-click + if ($scope.busy) { return false; } - //mark it for deletion (used in the UI) - $scope.currentNode.loading = true; - $scope.busy = true; + //mark it for deletion (used in the UI) + $scope.currentNode.loading = true; + $scope.busy = true; - dictionaryResource.deleteById($scope.currentNode.id).then(function () { - $scope.currentNode.loading = false; + dictionaryResource.deleteById($scope.currentNode.id).then(function () { + $scope.currentNode.loading = false; - // get the parent id - var parentId = $scope.currentNode.parentId; + // get the parent id + var parentId = $scope.currentNode.parentId; - treeService.removeNode($scope.currentNode); + treeService.removeNode($scope.currentNode); - navigationService.hideMenu(); + navigationService.hideMenu(); - if (parentId !== "-1") { - // set the view of the parent item - $location.path("/settings/dictionary/edit/" + parentId); - } else { - // we have no parent, so redirect to section - $location.path("/settings/"); - } - - }); - } + var section = dictionaryResource.getSection(); + if (parentId !== "-1") { + // set the view of the parent item + $location.path("/" + section + "/dictionary/edit/" + parentId); + } else { + // we have no parent, so redirect to section + $location.path("/" + section + "/"); + } - vm.cancel = cancel; - vm.performDelete = performDelete; + }); + } + + vm.cancel = cancel; + vm.performDelete = performDelete; } -angular.module("umbraco").controller("Umbraco.Editors.Dictionary.DeleteController", DictionaryDeleteController); \ No newline at end of file +angular.module("umbraco").controller("Umbraco.Editors.Dictionary.DeleteController", DictionaryDeleteController); diff --git a/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionairy.edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.edit.controller.js similarity index 92% rename from src/Umbraco.Web.UI.Client/src/views/dictionary/dictionairy.edit.controller.js rename to src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.edit.controller.js index cdb9411342..1b9d5c3f4c 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionairy.edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.edit.controller.js @@ -7,7 +7,7 @@ * The controller for editing dictionary items */ function DictionaryEditController($scope, $routeParams, dictionaryResource, treeService, navigationService, appState, editorState, contentEditingHelper, formHelper, notificationsService, localizationService) { - vm = this; + var vm = this; //setup scope vars vm.nameDirty = false; @@ -17,7 +17,7 @@ function DictionaryEditController($scope, $routeParams, dictionaryResource, tree vm.page.menu = {}; vm.page.menu.currentSection = appState.getSectionState("currentSection"); vm.page.menu.currentNode = null; - vm.description = ''; + vm.description = ""; function loadDictionary() { @@ -42,8 +42,8 @@ function DictionaryEditController($scope, $routeParams, dictionaryResource, tree } function bindDictionary(data) { - localizationService.localize('dictionaryItem_description').then(function (value) { - vm.description = value.replace('%0%', data.name); + localizationService.localize("dictionaryItem_description").then(function (value) { + vm.description = value.replace("%0%", data.name); }); // create data for umb-property displaying @@ -104,7 +104,7 @@ function DictionaryEditController($scope, $routeParams, dictionaryResource, tree $scope.$watch("vm.content.name", function (newVal, oldVal) { //when the value changes, we need to set the name dirty - if (newVal && (newVal !== oldVal) && typeof(oldVal) !== 'undefined') { + if (newVal && (newVal !== oldVal) && typeof(oldVal) !== "undefined") { vm.nameDirty = true; } }); @@ -112,4 +112,4 @@ function DictionaryEditController($scope, $routeParams, dictionaryResource, tree onInit(); } -angular.module("umbraco").controller("Umbraco.Editors.Dictionary.EditController", DictionaryEditController); \ No newline at end of file +angular.module("umbraco").controller("Umbraco.Editors.Dictionary.EditController", DictionaryEditController); 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 69c1a4be75..8fa91459aa 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 @@ -7,8 +7,8 @@ * The controller for listting dictionary items */ function DictionaryListController($scope, $location, dictionaryResource, localizationService) { - vm = this; - vm.title = 'Dictionary overview'; + var vm = this; + vm.title = "Dictionary overview"; vm.loading = false; vm.items = []; @@ -26,13 +26,14 @@ function DictionaryListController($scope, $location, dictionaryResource, localiz } function clickItem(id) { - $location.path("/settings/dictionary/edit/" + id); + var section = dictionaryResource.getSection(); + $location.path("/" + section + "/dictionary/edit/" + id); } vm.clickItem = clickItem; function onInit() { - localizationService.localize('dictionaryItem_overviewTitle').then(function (value) { + localizationService.localize("dictionaryItem_overviewTitle").then(function (value) { vm.title = value; }); @@ -43,4 +44,4 @@ function DictionaryListController($scope, $location, dictionaryResource, localiz } -angular.module("umbraco").controller("Umbraco.Editors.Dictionary.ListController", DictionaryListController); \ No newline at end of file +angular.module("umbraco").controller("Umbraco.Editors.Dictionary.ListController", DictionaryListController); diff --git a/src/Umbraco.Web.UI/config/trees.Release.config b/src/Umbraco.Web.UI/config/trees.Release.config index c0205c7db4..e4be139d22 100644 --- a/src/Umbraco.Web.UI/config/trees.Release.config +++ b/src/Umbraco.Web.UI/config/trees.Release.config @@ -16,8 +16,9 @@
" + ui.Text("dictionaryItem", "changeKey", currentUser) + "
" - }); - p.addProperty(boxChangeKey); - p.addProperty(labelChangeKey); - - - txt = new Literal(); - txt.Text = "" + ui.Text("dictionaryItem", "description", currentItem.key, currentUser) + "
" + ui.Text("dictionaryItem", "description", currentItem.key, currentUser) + "