Revert "Revert "Support IContentType.IsElement""

This reverts commit a5efc25c
This commit is contained in:
Bjarke Berg
2019-01-15 15:13:10 +01:00
parent 11ffafacdf
commit 0b9705ca3f
7 changed files with 46 additions and 25 deletions

View File

@@ -64,7 +64,7 @@
var saveModel = _.pick(displayModel,
'compositeContentTypes', 'isContainer', 'allowAsRoot', 'allowedTemplates', 'allowedContentTypes',
'alias', 'description', 'thumbnail', 'name', 'id', 'icon', 'trashed',
'key', 'parentId', 'alias', 'path', 'allowCultureVariant');
'key', 'parentId', 'alias', 'path', 'allowCultureVariant', 'isElement');
//TODO: Map these
saveModel.allowedTemplates = _.map(displayModel.allowedTemplates, function (t) { return t.alias; });
@@ -262,7 +262,7 @@
saveModel[props[m]] = startId.id;
}
saveModel.parentId = -1;
saveModel.parentId = -1;
return saveModel;
},
@@ -293,7 +293,7 @@
});
saveModel.email = propEmail.value.trim();
saveModel.username = propLogin.value.trim();
saveModel.password = this.formatChangePasswordModel(propPass.value);
var selectedGroups = [];
@@ -336,7 +336,7 @@
/** formats the display model used to display the media to the model used to save the media */
formatMediaPostData: function (displayModel, action) {
//NOTE: the display model inherits from the save model so we can in theory just post up the display model but
//NOTE: the display model inherits from the save model so we can in theory just post up the display model but
// we don't want to post all of the data as it is unecessary.
var saveModel = {
id: displayModel.id,
@@ -354,7 +354,7 @@
/** formats the display model used to display the content to the model used to save the content */
formatContentPostData: function (displayModel, action) {
//NOTE: the display model inherits from the save model so we can in theory just post up the display model but
//NOTE: the display model inherits from the save model so we can in theory just post up the display model but
// we don't want to post all of the data as it is unecessary.
var saveModel = {
id: displayModel.id,
@@ -379,7 +379,7 @@
var propExpireDate = displayModel.removeDate;
var propReleaseDate = displayModel.releaseDate;
var propTemplate = displayModel.template;
saveModel.expireDate = propExpireDate ? propExpireDate : null;
saveModel.releaseDate = propReleaseDate ? propReleaseDate : null;
saveModel.templateAlias = propTemplate ? propTemplate : null;
@@ -389,8 +389,8 @@
/**
* This formats the server GET response for a content display item
* @param {} displayModel
* @returns {}
* @param {} displayModel
* @returns {}
*/
formatContentGetData: function(displayModel) {
@@ -418,7 +418,7 @@
}
});
});
//now assign this same invariant property instance to the same index of the other variants property array
for (var j = 1; j < displayModel.variants.length; j++) {

View File

@@ -25,6 +25,7 @@
vm.removeChild = removeChild;
vm.toggleAllowAsRoot = toggleAllowAsRoot;
vm.toggleAllowCultureVariants = toggleAllowCultureVariants;
vm.toggleIsElement = toggleIsElement;
/* ---------- INIT ---------- */
@@ -84,25 +85,18 @@
$scope.model.allowedContentTypes.splice(selectedChildIndex, 1);
}
/**
* Toggle the $scope.model.allowAsRoot value to either true or false
*/
function toggleAllowAsRoot(){
if($scope.model.allowAsRoot){
$scope.model.allowAsRoot = false;
return;
}
// note: "safe toggling" here ie handling cases where the value is undefined, etc
$scope.model.allowAsRoot = true;
function toggleAllowAsRoot() {
$scope.model.allowAsRoot = $scope.model.allowAsRoot ? false : true;
}
function toggleAllowCultureVariants() {
if ($scope.model.allowCultureVariant) {
$scope.model.allowCultureVariant = false;
return;
}
$scope.model.allowCultureVariant = $scope.model.allowCultureVariant ? false : true;
}
$scope.model.allowCultureVariant = true;
function toggleIsElement() {
$scope.model.isElement = $scope.model.isElement ? false : true;
}
}

View File

@@ -53,9 +53,25 @@
hotkey="alt+shift+v">
</umb-toggle>
</div>
</div>
</umb-box-content>
<div class="sub-view-columns">
<div class="sub-view-column-left">
<h5><localize key="contentTypeEditor_elementHeading" /></h5>
<small><localize key="contentTypeEditor_elementDescription" /></small>
</div>
<div class="sub-view-column-right">
<umb-toggle data-element="permissions-is-element"
checked="model.isElement"
on-click="vm.toggleIsElement()">
</umb-toggle>
</div>
</div>
</umb-box-content>
</umb-box>
</div>

View File

@@ -1518,6 +1518,8 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="variantsHeading">Allow varying by culture</key>
<key alias="variantsDescription">Allow editors to create content of this type in different languages</key>
<key alias="allowVaryByCulture">Allow varying by culture</key>
<key alias="elementHeading">Is an Element type</key>
<key alias="elementDescription">An Element type is meant to be used for instance in Nested Content, and not in the tree</key>
</area>
<area alias="modelsBuilder">
<key alias="buildingModels">Building models</key>

View File

@@ -1559,6 +1559,8 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="variantsHeading">Allow varying by culture</key>
<key alias="variantsDescription">Allow editors to create content of this type in different languages</key>
<key alias="allowVaryByCulture">Allow varying by culture</key>
<key alias="elementHeading">Is an Element type</key>
<key alias="elementDescription">An Element type is meant to be used for instance in Nested Content, and not in the tree</key>
</area>
<area alias="languages">
<key alias="addLanguage">Add language</key>

View File

@@ -26,6 +26,10 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "isContainer")]
public bool IsContainer { get; set; }
//Element
[DataMember(Name = "isElement")]
public bool IsElement { get; set; }
[DataMember(Name = "listViewEditorName")]
[ReadOnly(true)]
public string ListViewEditorName { get; set; }

View File

@@ -25,6 +25,9 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "isContainer")]
public bool IsContainer { get; set; }
[DataMember(Name = "isElement")]
public bool IsElement { get; set; }
[DataMember(Name = "allowAsRoot")]
public bool AllowAsRoot { get; set; }