diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbnestedcontent.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbnestedcontent.directive.js index b632471a69..8b51c384b0 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbnestedcontent.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbnestedcontent.directive.js @@ -50,8 +50,6 @@ } }); - // Some property editors need to performe an action after all property editors have reacted to the formSubmitting. - $scope.$broadcast("postFormSubmitting", { scope: $scope }); } }); diff --git a/src/Umbraco.Web.UI.Client/src/common/services/udi.service.js b/src/Umbraco.Web.UI.Client/src/common/services/udi.service.js index dd289c96a6..8c178533bd 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/udi.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/udi.service.js @@ -11,7 +11,7 @@ /** * @ngdoc method - * @name umbraco.services.udiService#parse + * @name umbraco.services.udiService#create * @methodOf umbraco.services.udiService * @function * diff --git a/src/Umbraco.Web.UI.Client/src/less/belle.less b/src/Umbraco.Web.UI.Client/src/less/belle.less index 445d87fbb9..cdccbf527b 100644 --- a/src/Umbraco.Web.UI.Client/src/less/belle.less +++ b/src/Umbraco.Web.UI.Client/src/less/belle.less @@ -200,9 +200,9 @@ // Property Editors -@import "../views/propertyeditors/blockeditor/blockcard/umb-block-card-grid.less"; -@import "../views/propertyeditors/blockeditor/blockcard/blockcard.component.less"; -@import "../views/propertyeditors/blocklist/blocklist.component.less"; +@import "../views/components/blockcard/umb-block-card-grid.less"; +@import "../views/components/blockcard/umb-block-card.less"; +@import "../views/propertyeditors/blocklist/umb-block-list-property-editor.less"; @import "../views/propertyeditors/blocklist/prevalue/blocklist.blockconfiguration.less"; @import "../views/propertyeditors/blocklist/prevalue/blocklist.blockconfiguration.overlay.less"; @import "../views/propertyeditors/notsupported/notsupported.less"; diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/blockeditor/blockeditor.content.html b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/blockeditor/blockeditor.content.html new file mode 100644 index 0000000000..15c3b9594f --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/blockeditor/blockeditor.content.html @@ -0,0 +1 @@ + diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/blockeditor/blockeditor.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/blockeditor/blockeditor.controller.js index 48522d22ff..da7ba52536 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/blockeditor/blockeditor.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/blockeditor/blockeditor.controller.js @@ -1,12 +1,9 @@ -//used for the media picker dialog angular.module("umbraco") .controller("Umbraco.Editors.BlockEditorController", function ($scope, localizationService, formHelper) { var vm = this; - // TODO: Why are we assigning content/setting separately when we already have vm.model? - vm.content = $scope.model.content; - vm.settings = $scope.model.settings; + vm.model = $scope.model; vm.model = $scope.model; vm.tabs = []; localizationService.localizeMany([ @@ -17,17 +14,16 @@ angular.module("umbraco") vm.submitLabel = data[1]; }); - if (vm.content && vm.content.variants) { + if ($scope.model.content && $scope.model.content.variants) { - var apps = vm.content.apps; + var apps = $scope.model.content.apps; vm.tabs = apps; // replace view of content app. var contentApp = apps.find(entry => entry.alias === "umbContent"); if (contentApp) { - // TODO: This is strange, why does this render a view from somewhere else and this is the only place where that view is used? - contentApp.view = "views/common/infiniteeditors/elementeditor/elementeditor.content.html"; + contentApp.view = "views/common/infiniteeditors/blockeditor/blockeditor.content.html"; if(vm.model.hideContent) { apps.splice(apps.indexOf(contentApp), 1); } else if (vm.model.openSettings !== true) { @@ -41,15 +37,14 @@ angular.module("umbraco") } - if (vm.settings && vm.settings.variants) { + if (vm.model.settings && vm.model.settings.variants) { localizationService.localize("blockEditor_tabBlockSettings").then( function (settingsName) { var settingsTab = { "name": settingsName, "alias": "settings", "icon": "icon-settings", - // TODO: This is strange, why does this render a view from somewhere else and this is the only place where that view is used? - "view": "views/common/infiniteeditors/elementeditor/elementeditor.settings.html" + "view": "views/common/infiniteeditors/blockeditor/blockeditor.settings.html" }; vm.tabs.push(settingsTab); if (vm.model.openSettings) { @@ -69,7 +64,7 @@ angular.module("umbraco") vm.close = function() { if (vm.model && vm.model.close) { - // TODO: If content has changed, we should notify user. + // TODO: check if content/settings has changed and ask user if they are sure. vm.model.close(vm.model); } } diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/elementeditor/elementeditor.settings.html b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/blockeditor/blockeditor.settings.html similarity index 100% rename from src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/elementeditor/elementeditor.settings.html rename to src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/blockeditor/blockeditor.settings.html diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/blockpicker/blockpicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/blockpicker/blockpicker.controller.js index 581460954a..2894e0bef4 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/blockpicker/blockpicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/blockpicker/blockpicker.controller.js @@ -1,4 +1,3 @@ -//used for the media picker dialog angular.module("umbraco") .controller("Umbraco.Editors.BlockPickerController", function ($scope, localizationService) { diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/elementeditor/elementeditor.content.html b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/elementeditor/elementeditor.content.html deleted file mode 100644 index 3e2aec72a3..0000000000 --- a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/elementeditor/elementeditor.content.html +++ /dev/null @@ -1,3 +0,0 @@ -
- -
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blockeditor/blockcard/umb-block-card-grid.less b/src/Umbraco.Web.UI.Client/src/views/components/blockcard/umb-block-card-grid.less similarity index 100% rename from src/Umbraco.Web.UI.Client/src/views/propertyeditors/blockeditor/blockcard/umb-block-card-grid.less rename to src/Umbraco.Web.UI.Client/src/views/components/blockcard/umb-block-card-grid.less diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blockeditor/blockcard/blockcard.component.html b/src/Umbraco.Web.UI.Client/src/views/components/blockcard/umb-block-card.html similarity index 85% rename from src/Umbraco.Web.UI.Client/src/views/propertyeditors/blockeditor/blockcard/blockcard.component.html rename to src/Umbraco.Web.UI.Client/src/views/components/blockcard/umb-block-card.html index 4ab2c18fa7..486bcbda4a 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blockeditor/blockcard/blockcard.component.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/blockcard/umb-block-card.html @@ -1,5 +1,5 @@ -
+
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blockeditor/blockcard/blockcard.component.less b/src/Umbraco.Web.UI.Client/src/views/components/blockcard/umb-block-card.less similarity index 98% rename from src/Umbraco.Web.UI.Client/src/views/propertyeditors/blockeditor/blockcard/blockcard.component.less rename to src/Umbraco.Web.UI.Client/src/views/components/blockcard/umb-block-card.less index b1260e198b..d1cde628e4 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blockeditor/blockcard/blockcard.component.less +++ b/src/Umbraco.Web.UI.Client/src/views/components/blockcard/umb-block-card.less @@ -59,6 +59,8 @@ umb-block-card { background-size: cover; background-position: 50% 50%; + background-repeat: no-repeat; + .__icon { position: absolute; width: 100%; diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blockeditor/blockcard/blockcard.component.js b/src/Umbraco.Web.UI.Client/src/views/components/blockcard/umbBlockCard.component.js similarity index 83% rename from src/Umbraco.Web.UI.Client/src/views/propertyeditors/blockeditor/blockcard/blockcard.component.js rename to src/Umbraco.Web.UI.Client/src/views/components/blockcard/umbBlockCard.component.js index f07c4f1529..876d663e09 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blockeditor/blockcard/blockcard.component.js +++ b/src/Umbraco.Web.UI.Client/src/views/components/blockcard/umbBlockCard.component.js @@ -6,7 +6,7 @@ angular .module("umbraco") .component("umbBlockCard", { - templateUrl: "views/propertyeditors/blockeditor/blockcard/blockcard.component.html", + templateUrl: "views/components/blockcard/umb-block-card.html", controller: BlockCardController, controllerAs: "vm", transclude: true, diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/elementeditor/elementEditor.content.component.html b/src/Umbraco.Web.UI.Client/src/views/components/elementeditor/umb-element-editor-content.component.html similarity index 100% rename from src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/elementeditor/elementEditor.content.component.html rename to src/Umbraco.Web.UI.Client/src/views/components/elementeditor/umb-element-editor-content.component.html diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/elementeditor/elementEditor.content.component.js b/src/Umbraco.Web.UI.Client/src/views/components/elementeditor/umbelementeditorcontent.component.js similarity index 89% rename from src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/elementeditor/elementEditor.content.component.js rename to src/Umbraco.Web.UI.Client/src/views/components/elementeditor/umbelementeditorcontent.component.js index 3ea15b37fe..9658628dfd 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/elementeditor/elementEditor.content.component.js +++ b/src/Umbraco.Web.UI.Client/src/views/components/elementeditor/umbelementeditorcontent.component.js @@ -6,7 +6,7 @@ angular .module('umbraco.directives') .component('umbElementEditorContent', { - templateUrl: 'views/common/infiniteeditors/elementeditor/elementEditor.content.component.html', + templateUrl: 'views/components/elementeditor/umb-element-editor-content.component.html', controller: ElementEditorContentComponentController, controllerAs: 'vm', bindings: { diff --git a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/numberrange.controller.js b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/numberrange.controller.js deleted file mode 100644 index 7b5f41fa8a..0000000000 --- a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/numberrange.controller.js +++ /dev/null @@ -1,9 +0,0 @@ -(function () { - - function NumberRangeController($scope) { - - } - - angular.module("umbraco").controller("Umbraco.PrevalueEditors.NumberRangeController", NumberRangeController); -})(); - diff --git a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/numberrange.html b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/numberrange.html index 5dd39ee18c..d9d8cad982 100644 --- a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/numberrange.html +++ b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/numberrange.html @@ -1,4 +1,4 @@ -
+
+ diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/prevalue/blocklist.blockconfiguration.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/prevalue/blocklist.blockconfiguration.controller.js index 3141f0418a..c439d89911 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/prevalue/blocklist.blockconfiguration.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/prevalue/blocklist.blockconfiguration.controller.js @@ -16,10 +16,11 @@ } } - function BlockConfigurationController($scope, elementTypeResource, overlayService, localizationService, editorService) { + function BlockConfigurationController($scope, elementTypeResource, overlayService, localizationService, editorService, eventsService) { + + var unsubscribe = []; var vm = this; - vm.openBlock = null; function onInit() { @@ -38,6 +39,16 @@ }); } + function updateUsedElementTypes(event, args) { + var key = args.documentType.key; + for (var i = 0; i { u(); }); + }); onInit(); diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/prevalue/blocklist.blockconfiguration.overlay.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/prevalue/blocklist.blockconfiguration.overlay.controller.js index d722a17c1a..a42784f55a 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/prevalue/blocklist.blockconfiguration.overlay.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/prevalue/blocklist.blockconfiguration.overlay.controller.js @@ -10,7 +10,9 @@ (function () { "use strict"; - function BlockConfigurationOverlayController($scope, overlayService, localizationService, editorService, elementTypeResource) { + function BlockConfigurationOverlayController($scope, overlayService, localizationService, editorService, elementTypeResource, eventsService) { + + var unsubscribe = []; var vm = this; vm.block = $scope.model.block; @@ -20,11 +22,14 @@ function loadElementTypes() { return elementTypeResource.getAll().then(function (elementTypes) { vm.elementTypes = elementTypes; + + vm.contentPreview = vm.getElementTypeByKey(vm.block.contentTypeKey); + vm.settingsPreview = vm.getElementTypeByKey(vm.block.settingsElementTypeKey); }); } vm.getElementTypeByKey = function(key) { - return _.find(vm.elementTypes, function (type) { + return vm.elementTypes.find(function (type) { return type.key === key; }); }; @@ -34,7 +39,6 @@ const editor = { id: elementTypeId, submit: function (model) { - loadElementTypes(); editorService.close(); }, close: function () { @@ -50,9 +54,7 @@ infiniteMode: true, isElement: true, submit: function (model) { - loadElementTypes().then( function () { - callback(model.documentTypeKey); - }); + callback(model.documentTypeKey); editorService.close(); }, close: function () { @@ -123,6 +125,26 @@ }; + function updateUsedElementTypes(event, args) { + var key = args.documentType.key; + for (var i = 0; i { u(); }); + }); + } angular.module("umbraco").controller("Umbraco.PropertyEditors.BlockList.BlockConfigurationOverlayController", BlockConfigurationOverlayController); diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/prevalue/blocklist.blockconfiguration.overlay.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/prevalue/blocklist.blockconfiguration.overlay.html index 8313dcf15e..ae5eb5543c 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/prevalue/blocklist.blockconfiguration.overlay.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/prevalue/blocklist.blockconfiguration.overlay.html @@ -107,8 +107,7 @@
- {{ contentPreview = vm.getElementTypeByKey(vm.block.contentTypeKey); "" }} - +
-