V8: Handle element types in the content editor (#4193)

* Don't allow preview for element types

* Don't show the "save and publish" button group for element types + apply primary button state to the "save" button

* Hide templates and URLs for element types

* Fix null error

* Use same notation for negation
This commit is contained in:
Kenn Jacobsen
2019-02-14 13:13:19 +01:00
committed by Sebastiaan Janssen
parent a643f6d1f0
commit 684bacb937
4 changed files with 15 additions and 7 deletions

View File

@@ -174,8 +174,8 @@
*/
function createButtons(content) {
// for trashed items, the save button is the primary action - otherwise it's a secondary action
$scope.page.saveButtonStyle = content.trashed ? "primary" : "info";
// for trashed and element type items, the save button is the primary action - otherwise it's a secondary action
$scope.page.saveButtonStyle = content.trashed || content.isElement ? "primary" : "info";
// only create the save/publish/preview buttons if the
// content app is "Conent"

View File

@@ -64,7 +64,7 @@
setNodePublishStatus();
if (scope.currentUrls.length === 0) {
if (scope.currentUrls && scope.currentUrls.length === 0) {
if (scope.node.id > 0) {
//it's created but not published
scope.currentUrls.push({ text: labels.notPublished, isUrl: false });
@@ -104,6 +104,8 @@
loadAuditTrail();
}
// never show templates for element types (if they happen to have been created in the content tree)
scope.disableTemplates = scope.disableTemplates || scope.node.isElement;
}
scope.auditTrailPageChange = function (pageNumber) {
@@ -303,6 +305,12 @@
}
function updateCurrentUrls() {
// never show urls for element types (if they happen to have been created in the content tree)
if (scope.node.isElement) {
scope.currentUrls = null;
return;
}
// find the urls for the currently selected language
if (scope.node.variants.length > 1) {
// nodes with variants

View File

@@ -57,9 +57,9 @@
shortcut="ctrl+s"
add-ellipsis="{{page.saveButtonEllipsis}}">
</umb-button>
<umb-button-group
ng-if="defaultButton && !content.trashed && !infiniteModel.infiniteMode"
<umb-button-group
ng-if="defaultButton && !content.trashed && !content.isElement && !infiniteModel.infiniteMode"
button-style="success"
default-button="defaultButton"
sub-buttons="subButtons"

View File

@@ -2055,7 +2055,7 @@ namespace Umbraco.Web.Editors
private ContentItemDisplay MapToDisplay(IContent content)
{
var display = Mapper.Map<ContentItemDisplay>(content);
display.AllowPreview = display.AllowPreview && content.Trashed == false;
display.AllowPreview = display.AllowPreview && content.Trashed == false && content.ContentType.IsElement == false;
return display;
}