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..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 @@ -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 !== "umbContent" && app.alias !== "umbInfo") { + $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/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 { 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..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 @@ -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 !== "umbContent" && app.alias !== "umbInfo") { + 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" or "Info" + vm.nameDisabled = false; + if(item && item.alias !== "umbContent" && item.alias !== "umbInfo") { + 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/content/umbvariantcontenteditors.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontenteditors.directive.js index 4902d943a7..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 @@ -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(); } @@ -192,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; @@ -222,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 { @@ -312,6 +311,9 @@ if(app && app.alias) { activeAppAlias = app.alias; } + if(vm.onSelectApp) { + vm.onSelectApp({"app": app}); + } } } 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: " + culture="culture" + on-select-app="appChanged(app)"> @@ -37,14 +38,14 @@ - + + + + + + diff --git a/src/Umbraco.Web.UI.Client/src/views/components/content/umb-variant-content.html b/src/Umbraco.Web.UI.Client/src/views/components/content/umb-variant-content.html index 19e741ee29..c03b017a82 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/content/umb-variant-content.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/content/umb-variant-content.html @@ -10,6 +10,7 @@ menu="vm.page.menu" hide-menu="vm.page.hideActionsMenu" name="vm.editor.content.name" + name-disabled="vm.nameDisabled" navigation="vm.editor.content.apps" on-select-navigation-item="vm.selectApp(item)" variants="vm.editor.content.variants" diff --git a/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-content-header.html b/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-content-header.html index bc20745018..149fccd00a 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-content-header.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-content-header.html @@ -13,19 +13,20 @@ 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 c3d4a96a58..f750d43f94 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) @@ -222,6 +222,7 @@ No date chosen Page title This media item has no link + 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%' 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; } 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" 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"