diff --git a/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.edit.controller.js index 2f6fb2d3a8..d77273f0d9 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/dictionary/dictionary.edit.controller.js @@ -6,7 +6,7 @@ * @description * The controller for editing dictionary items */ -function DictionaryEditController($scope, $routeParams, $location, dictionaryResource, navigationService, appState, editorState, contentEditingHelper, formHelper, notificationsService, localizationService) { +function DictionaryEditController($scope, $routeParams, $location, dictionaryResource, navigationService, appState, editorState, contentEditingHelper, formHelper, notificationsService, localizationService, userService) { var vm = this; @@ -26,6 +26,7 @@ function DictionaryEditController($scope, $routeParams, $location, dictionaryRes vm.description = ""; vm.showBackButton = true; vm.maxlength = 1000; + vm.currentUser = null; vm.save = saveDictionary; vm.back = back; @@ -54,6 +55,12 @@ function DictionaryEditController($scope, $routeParams, $location, dictionaryRes } function bindDictionary(data) { + + data.translations.forEach(translation => { + const allowUpdate = vm.currentUser.allowedLanguageIds && vm.currentUser.allowedLanguageIds.length > 0 && vm.currentUser.allowedLanguageIds.includes(translation.languageId); + translation.allowUpdate = allowUpdate; + }); + localizationService.localize("dictionaryItem_description").then(function (value) { vm.description = value.replace("%0%", data.name); }); @@ -81,7 +88,14 @@ function DictionaryEditController($scope, $routeParams, $location, dictionaryRes } function onInit() { - loadDictionary(); + vm.page.loading = true; + + userService.getCurrentUser().then(user => { + vm.currentUser = user; + vm.page.loading = false; + + loadDictionary(); + }); } function saveDictionary() { diff --git a/src/Umbraco.Web.UI.Client/src/views/dictionary/edit.html b/src/Umbraco.Web.UI.Client/src/views/dictionary/edit.html index 01c3a628e9..fad9bd9026 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dictionary/edit.html +++ b/src/Umbraco.Web.UI.Client/src/views/dictionary/edit.html @@ -34,7 +34,8 @@ state="vm.page.saveButtonState" shortcut="ctrl+s" label="Save" - label-key="buttons_save"> + label-key="buttons_save" + ng-disabled="vm.page.loading"> diff --git a/src/Umbraco.Web.UI.Client/src/views/dictionary/views/content/content.html b/src/Umbraco.Web.UI.Client/src/views/dictionary/views/content/content.html index 4e97626c4f..d48cb954b2 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dictionary/views/content/content.html +++ b/src/Umbraco.Web.UI.Client/src/views/dictionary/views/content/content.html @@ -2,13 +2,13 @@

- + ng-trim="false" + ng-readonly="!translation.allowUpdate">

{{ translation.displayName }}