From ad1f11f1dac817c916298855b7da1d80d7ad2c31 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 11 Sep 2018 14:17:55 +0200 Subject: [PATCH 01/12] only show save/publish/preview on "Content" content app --- .../components/content/edit.controller.js | 33 +++++++++++++++++-- .../umbvariantcontenteditors.directive.js | 8 +++-- .../src/less/components/editor.less | 4 ++- .../src/views/components/content/edit.html | 7 ++-- 4 files changed, 42 insertions(+), 10 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js index e5ec9172c6..227cb954af 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js @@ -27,10 +27,13 @@ function init(content) { + // set first app to active + content.apps[0].active = true; + if (infiniteMode) { createInfiniteModeButtons(content); } else { - createButtons(content); + createButtons(content, content.apps[0]); } editorState.set($scope.content); @@ -135,7 +138,22 @@ } - function createButtons(content) { + /** + * Create the save/publish/preview buttons for the view + * @param {any} content the content node + * @param {any} app the active content app + */ + function createButtons(content, app) { + + // only create the save/publish/preview buttons if the + // content app is "Conent" + if(app && app.alias !== "content") { + $scope.defaultButton = null; + $scope.subButtons = null; + $scope.page.showPreviewButton = false; + return; + } + $scope.page.buttonGroupState = "init"; var buttons = contentEditingHelper.configureContentEditorButtons({ create: $scope.page.isNew, @@ -147,9 +165,10 @@ unPublish: $scope.unPublish } }); - + $scope.defaultButton = buttons.defaultButton; $scope.subButtons = buttons.subButtons; + $scope.page.showPreviewButton = true; } @@ -555,6 +574,14 @@ }); }; + /** + * Call back when a content app changes + * @param {any} app + */ + $scope.appChanged = function(app) { + createButtons($scope.content, app); + }; + function moveNode(node, target) { contentResource.move({ "parentId": target.id, "id": node.id }) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontenteditors.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontenteditors.directive.js index 7d6d5dc131..9956bf07df 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontenteditors.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontenteditors.directive.js @@ -9,7 +9,8 @@ bindings: { page: "<", content: "<", //TODO: Not sure if this should be = since we are changing the 'active' property of a variant - culture: "<" + culture: "<", + onSelectApp: "&?" }, controllerAs: 'vm', controller: umbVariantContentEditorsController @@ -39,8 +40,6 @@ /** Called when the component initializes */ function onInit() { - // set first app to active - vm.content.apps[0].active = true; prevContentDateUpdated = angular.copy(vm.content.updateDate); setActiveCulture(); } @@ -311,6 +310,9 @@ if(app && app.alias) { activeAppAlias = app.alias; } + if(vm.onSelectApp) { + vm.onSelectApp({"app": app}); + } } } diff --git a/src/Umbraco.Web.UI.Client/src/less/components/editor.less b/src/Umbraco.Web.UI.Client/src/less/components/editor.less index 2e4f106898..ec58ee0557 100644 --- a/src/Umbraco.Web.UI.Client/src/less/components/editor.less +++ b/src/Umbraco.Web.UI.Client/src/less/components/editor.less @@ -248,15 +248,17 @@ a.umb-variant-switcher__toggle { height: @editorFooterHeight; padding: 10px 20px; background: @white; - // box-shadow: 0 -1px 3px 0 rgba(0, 0, 0, 0.16); border-top: 1px solid @gray-9; z-index: 1; bottom: 0; + display: flex; + align-items: center; } .umb-editor-footer-content { display: flex; align-items: center; + flex: 1 1 auto; } .umb-editor-footer-content__right-side { diff --git a/src/Umbraco.Web.UI.Client/src/views/components/content/edit.html b/src/Umbraco.Web.UI.Client/src/views/components/content/edit.html index f7eaedf3be..ace41d7e94 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/content/edit.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/content/edit.html @@ -9,7 +9,8 @@ + culture="culture" + on-select-app="appChanged(app)"> @@ -37,14 +38,14 @@ - + Date: Tue, 11 Sep 2018 14:43:07 +0200 Subject: [PATCH 02/12] Add empty state if a node has no properties --- .../src/views/components/content/umb-tabbed-content.html | 7 +++++++ src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml | 1 + 2 files changed, 8 insertions(+) diff --git a/src/Umbraco.Web.UI.Client/src/views/components/content/umb-tabbed-content.html b/src/Umbraco.Web.UI.Client/src/views/components/content/umb-tabbed-content.html index 408f640c01..b125457ab0 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/content/umb-tabbed-content.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/content/umb-tabbed-content.html @@ -14,5 +14,12 @@ + + + + + diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml index 60337ba3b1..b407f708bc 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml @@ -222,6 +222,7 @@ No date chosen Page title This media item has no link + No content can be added for this item test Properties This document is published but is not visible because the parent '%0%' is unpublished This culture is published but is not visible because it is unpublished on parent '%0%' From e8322edc84c479cd298483810a6faedbb5bb7f7e Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 11 Sep 2018 14:47:56 +0200 Subject: [PATCH 03/12] maybe test is not needed --- src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml index b407f708bc..77e37a439b 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml @@ -222,7 +222,7 @@ No date chosen Page title This media item has no link - No content can be added for this item test + No content can be added for this item Properties This document is published but is not visible because the parent '%0%' is unpublished This culture is published but is not visible because it is unpublished on parent '%0%' From 62043f7cf9edd53b26c68d2251398723c30ae077 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 11 Sep 2018 15:33:26 +0200 Subject: [PATCH 04/12] only allow changing the node name if the active content app is "Content". --- .../content/umbvariantcontent.directive.js | 17 +++++++++++ .../umbeditorcontentheader.directive.js | 2 +- .../src/less/components/editor.less | 4 +++ .../content/umb-variant-content.html | 1 + .../editor/umb-editor-content-header.html | 29 +++++++++---------- 5 files changed, 37 insertions(+), 16 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontent.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontent.directive.js index 5ad7a9079a..54db6308cf 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontent.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontent.directive.js @@ -28,12 +28,23 @@ var vm = this; + vm.$onInit = onInit; vm.$postLink = postLink; vm.$onDestroy = onDestroy; vm.selectVariant = selectVariant; vm.openSplitView = openSplitView; vm.selectApp = selectApp; + + function onInit() { + // disable the name field if the active content app is not "Content" + vm.nameDisabled = false; + angular.forEach(vm.editor.content.apps, function(app){ + if(app.active && app.alias !== "content") { + vm.nameDisabled = true; + } + }); + } /** Called when the component has linked all elements, this is when the form controller is available */ function postLink() { @@ -67,6 +78,12 @@ * @param {any} item */ function selectApp(item) { + // disable the name field if the active content app is not "Content" + vm.nameDisabled = false; + if(item && item.alias !== "content") { + vm.nameDisabled = true; + } + // call the callback if any is registered if(vm.onSelectApp) { vm.onSelectApp({"app": item}); } diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorcontentheader.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorcontentheader.directive.js index 3cdcd5b12a..0d78aab0eb 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorcontentheader.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorcontentheader.directive.js @@ -97,7 +97,7 @@ templateUrl: 'views/components/editor/umb-editor-content-header.html', scope: { name: "=", - nameLocked: "=", + nameDisabled: " -
{{ name }}
- From 9f65102916ef592234f6a1568adfc8ab9033d0ff Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 11 Sep 2018 15:36:24 +0200 Subject: [PATCH 05/12] use border color on node name input hover --- src/Umbraco.Web.UI.Client/src/less/components/editor.less | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/less/components/editor.less b/src/Umbraco.Web.UI.Client/src/less/components/editor.less index 47143f1539..f045b0adca 100644 --- a/src/Umbraco.Web.UI.Client/src/less/components/editor.less +++ b/src/Umbraco.Web.UI.Client/src/less/components/editor.less @@ -102,13 +102,15 @@ input.umb-editor-header__name-input { background: @white; border: 1px solid @gray-8; &:hover { - background-color: @gray-10; - border: 1px solid @gray-8; + border-color: @turquoise-d1; } } input.umb-editor-header__name-input:disabled { background-color: @gray-10; + &:hover{ + border-color: @gray-8; + } } .umb-editor-header__actions-menu { From cdf9260f023ea4aa62b3750db72fa5c3b2daf9f3 Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Fri, 14 Sep 2018 09:20:05 +0100 Subject: [PATCH 06/12] Update the hard coded content app aliases until this gets moved into a package.manifest or similar?! --- src/Umbraco.Web/Models/Mapping/ContentAppResolver.cs | 4 ++-- .../Models/Mapping/ContentAppResolverExtensions.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web/Models/Mapping/ContentAppResolver.cs b/src/Umbraco.Web/Models/Mapping/ContentAppResolver.cs index 3821a56129..cebbe81500 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentAppResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentAppResolver.cs @@ -13,7 +13,7 @@ namespace Umbraco.Web.Models.Mapping { private readonly ContentApp _contentApp = new ContentApp { - Alias = "content", + Alias = "umbContent", Name = "Content", Icon = "icon-document", View = "views/content/apps/content/content.html" @@ -21,7 +21,7 @@ namespace Umbraco.Web.Models.Mapping private readonly ContentApp _infoApp = new ContentApp { - Alias = "info", + Alias = "umbInfo", Name = "Info", Icon = "icon-info", View = "views/content/apps/info/info.html" diff --git a/src/Umbraco.Web/Models/Mapping/ContentAppResolverExtensions.cs b/src/Umbraco.Web/Models/Mapping/ContentAppResolverExtensions.cs index 8fc77beb6b..ad3fe041c7 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentAppResolverExtensions.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentAppResolverExtensions.cs @@ -21,7 +21,7 @@ namespace Umbraco.Web.Models.Mapping { var listViewApp = new ContentApp { - Alias = "childItems", + Alias = "umbListView", Name = "Child items", Icon = "icon-list", View = "views/content/apps/listview/listview.html" From fe60cdda5c9522b7af2ca1cde56fd5a0e6d591dd Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Fri, 14 Sep 2018 10:46:22 +0200 Subject: [PATCH 07/12] fix app aliases client side --- .../common/directives/components/content/edit.controller.js | 2 +- .../components/content/umbvariantcontent.directive.js | 6 +++--- .../content/umbvariantcontenteditors.directive.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js index 227cb954af..911b561ff3 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js @@ -147,7 +147,7 @@ // only create the save/publish/preview buttons if the // content app is "Conent" - if(app && app.alias !== "content") { + if(app && app.alias !== "umbContent" && app.alias !== "umbInfo") { $scope.defaultButton = null; $scope.subButtons = null; $scope.page.showPreviewButton = false; diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontent.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontent.directive.js index 54db6308cf..8545854992 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontent.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontent.directive.js @@ -40,7 +40,7 @@ // disable the name field if the active content app is not "Content" vm.nameDisabled = false; angular.forEach(vm.editor.content.apps, function(app){ - if(app.active && app.alias !== "content") { + if(app.active && app.alias !== "umbContent" && app.alias !== "umbInfo") { vm.nameDisabled = true; } }); @@ -78,9 +78,9 @@ * @param {any} item */ function selectApp(item) { - // disable the name field if the active content app is not "Content" + // disable the name field if the active content app is not "Content" or "Info" vm.nameDisabled = false; - if(item && item.alias !== "content") { + if(item && item.alias !== "umbContent" && item.alias !== "umbInfo") { vm.nameDisabled = true; } // call the callback if any is registered diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontenteditors.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontenteditors.directive.js index ce03a025a3..46d0a1c5c1 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontenteditors.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontenteditors.directive.js @@ -191,7 +191,7 @@ //then assign the variant to a view model to the content app var contentApp = _.find(variant.apps, function (a) { - return a.alias === "content"; + return a.alias === "umbContent"; }); contentApp.viewModel = variant; @@ -221,7 +221,7 @@ var editor = vm.editors[e]; for (var i = 0; i < editor.content.apps.length; i++) { var app = editor.content.apps[i]; - if (app.alias === "content") { + if (app.alias === "umbContent") { app.active = true; } else { From f27bded4e8bf2bb73549ce04c6011864c3e9932f Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Fri, 14 Sep 2018 10:59:25 +0200 Subject: [PATCH 08/12] fix audit trail --- .../components/content/umbcontentnodeinfo.directive.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js index 062a7e2877..7c5cdc8857 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js @@ -315,7 +315,7 @@ // load audit trail when on the info tab evts.push(eventsService.on("app.tabChange", function (event, args) { $timeout(function(){ - if (args.alias === "info") { + if (args.alias === "umbInfo") { isInfoTab = true; loadAuditTrail(); } else { From 2ef33090a9dd5ada2e854b97db2312be41726f14 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Fri, 14 Sep 2018 11:52:22 +0200 Subject: [PATCH 09/12] update alias for node with list view scaffolds --- src/Umbraco.Web/Editors/ContentController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs index b08d8826eb..f53d9d625f 100644 --- a/src/Umbraco.Web/Editors/ContentController.cs +++ b/src/Umbraco.Web/Editors/ContentController.cs @@ -359,7 +359,7 @@ namespace Umbraco.Web.Editors var mapped = MapToDisplay(emptyContent); //remove the listview app if it exists - mapped.ContentApps = mapped.ContentApps.Where(x => x.Alias != "childItems").ToList(); + mapped.ContentApps = mapped.ContentApps.Where(x => x.Alias != "umbListView").ToList(); return mapped; } From cd151ac19a3c15d1e6d6f97256c11fe1f7d7e58e Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Fri, 14 Sep 2018 10:53:12 +0100 Subject: [PATCH 10/12] Update MediaApp resolver with new aliases --- src/Umbraco.Web/Models/Mapping/MediaAppResolver.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web/Models/Mapping/MediaAppResolver.cs b/src/Umbraco.Web/Models/Mapping/MediaAppResolver.cs index 6880aff9a8..9cbc6bfeea 100644 --- a/src/Umbraco.Web/Models/Mapping/MediaAppResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/MediaAppResolver.cs @@ -12,7 +12,7 @@ namespace Umbraco.Web.Models.Mapping { private static readonly ContentApp _contentApp = new ContentApp { - Alias = "content", + Alias = "umbContent", Name = "Content", Icon = "icon-document", View = "views/media/apps/content/content.html" @@ -20,7 +20,7 @@ namespace Umbraco.Web.Models.Mapping private static readonly ContentApp _infoApp = new ContentApp { - Alias = "info", + Alias = "umbInfo", Name = "Info", Icon = "icon-info", View = "views/media/apps/info/info.html" From 41fd9afab553878cef7edaa960f5f72b339ea0e9 Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Fri, 14 Sep 2018 10:53:59 +0100 Subject: [PATCH 11/12] Update API Scaffold call to remove the List View app, now the alias has changed --- src/Umbraco.Web/Editors/ContentController.cs | 4 ++-- src/Umbraco.Web/Editors/MediaController.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs index b08d8826eb..31d0ac0640 100644 --- a/src/Umbraco.Web/Editors/ContentController.cs +++ b/src/Umbraco.Web/Editors/ContentController.cs @@ -359,7 +359,7 @@ namespace Umbraco.Web.Editors var mapped = MapToDisplay(emptyContent); //remove the listview app if it exists - mapped.ContentApps = mapped.ContentApps.Where(x => x.Alias != "childItems").ToList(); + mapped.ContentApps = mapped.ContentApps.Where(x => x.Alias != "umbListView").ToList(); return mapped; } @@ -380,7 +380,7 @@ namespace Umbraco.Web.Editors var mapped = Mapper.Map(blueprint); //remove the listview app if it exists - mapped.ContentApps = mapped.ContentApps.Where(x => x.Alias != "childItems").ToList(); + mapped.ContentApps = mapped.ContentApps.Where(x => x.Alias != "umbListView").ToList(); return mapped; } diff --git a/src/Umbraco.Web/Editors/MediaController.cs b/src/Umbraco.Web/Editors/MediaController.cs index 70aa7e4da8..e44228a022 100644 --- a/src/Umbraco.Web/Editors/MediaController.cs +++ b/src/Umbraco.Web/Editors/MediaController.cs @@ -85,7 +85,7 @@ namespace Umbraco.Web.Editors var mapped = Mapper.Map(emptyContent); //remove the listview app if it exists - mapped.ContentApps = mapped.ContentApps.Where(x => x.Alias != "childItems").ToList(); + mapped.ContentApps = mapped.ContentApps.Where(x => x.Alias != "umbListView").ToList(); return mapped; } From c9601365d6614ae4eac62c27cd05c9ba0506cde3 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Fri, 14 Sep 2018 11:56:28 +0200 Subject: [PATCH 12/12] update list view empty state --- src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml index 77e37a439b..326ff2a994 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml @@ -211,7 +211,7 @@ Last published There are no items to show There are no items to show in the list. - No content has been added + No child items have been added No members have been added Media Type Link to media item(s)