V8: Hide "umbContent" app if the content has no properties (#4840)

This commit is contained in:
Kenn Jacobsen
2019-04-30 21:34:00 +02:00
committed by Sebastiaan Janssen
parent 6bfcc7bb34
commit d04b967fe6
5 changed files with 25 additions and 9 deletions

View File

@@ -55,9 +55,9 @@
}
}
// if we still dont have a app, lets show the first one:
if (isAppPresent === false) {
if (isAppPresent === false && content.apps.length) {
content.apps[0].active = true;
$scope.appChanged(content.apps[0]);
}

View File

@@ -198,9 +198,11 @@
return a.alias === "umbContent";
});
//The view model for the content app is simply the index of the variant being edited
var variantIndex = vm.content.variants.indexOf(variant);
contentApp.viewModel = variantIndex;
if (contentApp) {
//The view model for the content app is simply the index of the variant being edited
var variantIndex = vm.content.variants.indexOf(variant);
contentApp.viewModel = variantIndex;
}
// make sure the same app it set to active in the new variant
if(activeAppAlias) {

View File

@@ -5,7 +5,7 @@
<div class="umb-split-view__content" ng-show="!vm.editor.loading">
<ng-form name="contentHeaderForm">
<ng-form name="contentHeaderForm" ng-if="vm.editor.content.apps.length > 0">
<umb-editor-content-header
menu="vm.page.menu"
hide-menu="vm.page.hideActionsMenu"
@@ -26,12 +26,19 @@
</umb-editor-content-header>
</ng-form>
<umb-editor-container>
<umb-editor-container ng-if="vm.editor.content.apps.length > 0">
<div class="umb-editor-sub-views">
<div ng-repeat="app in vm.editor.content.apps track by app.alias">
<umb-editor-sub-view model="app" content="vm.content" />
</div>
</div>
</umb-editor-container>
<umb-empty-state
ng-if="vm.editor.content.apps.length === 0"
position="center">
<localize key="content_noProperties"></localize>
</umb-empty-state>
</div>
</div>

View File

@@ -25,7 +25,11 @@ function ContentBlueprintEditController($scope, $routeParams, contentResource) {
var contentApp = _.find(content.apps, function (app) {
return app.alias === "umbContent";
});
content.apps = [contentApp];
if (contentApp) {
content.apps = [contentApp];
} else {
content.apps = [];
}
}
content.allowPreview = false;
content.allowedActions = ["A", "S", "C"];

View File

@@ -18,7 +18,7 @@ namespace Umbraco.Web.ContentApps
{
switch (o)
{
case IContent _:
case IContent content when content.Properties.Count > 0:
return _contentApp ?? (_contentApp = new ContentApp
{
Alias = "umbContent",
@@ -28,6 +28,9 @@ namespace Umbraco.Web.ContentApps
Weight = Weight
});
case IContent _:
return null;
case IMedia media when !media.ContentType.IsContainer || media.Properties.Count > 0:
return _mediaApp ?? (_mediaApp = new ContentApp
{