10718 Enables more configured Blocks in Block List Editor (#10726)
Co-authored-by: Niels Lyngsø <nsl@umbraco.com> Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>
This commit is contained in:
@@ -57,7 +57,7 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
* Do stuff...
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
@@ -691,11 +691,12 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
getScaffoldByKeys: function (parentId, scaffoldKeys) {
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
$http.post(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"contentApiBaseUrl",
|
||||
"GetEmptyByKeys",
|
||||
{ contentTypeKeys: scaffoldKeys, parentId: parentId })),
|
||||
"GetEmptyByKeys"),
|
||||
{ contentTypeKeys: scaffoldKeys, parentId: parentId }
|
||||
),
|
||||
'Failed to retrieve data for empty content items ids' + scaffoldKeys.join(", "))
|
||||
.then(function (result) {
|
||||
Object.keys(result).map(function(key) {
|
||||
@@ -804,7 +805,7 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
else if (options.orderDirection === "desc") {
|
||||
options.orderDirection = "Descending";
|
||||
}
|
||||
|
||||
|
||||
//converts the value to a js bool
|
||||
function toBool(v) {
|
||||
if (Utilities.isNumber(v)) {
|
||||
|
||||
@@ -487,7 +487,7 @@
|
||||
* @returns {Object | null} Scaffold model for the that content type. Or null if the scaffolding model dosnt exist in this context.
|
||||
*/
|
||||
getScaffoldFromKey: function (contentTypeKey) {
|
||||
return this.scaffolds.find(o => o.contentTypeKey === contentTypeKey);
|
||||
return this.scaffolds.find(o => o.contentTypeKey === contentTypeKey) || null;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -499,7 +499,7 @@
|
||||
* @returns {Object | null} Scaffold model for the that content type. Or null if the scaffolding model dosnt exist in this context.
|
||||
*/
|
||||
getScaffoldFromAlias: function (contentTypeAlias) {
|
||||
return this.scaffolds.find(o => o.contentTypeAlias === contentTypeAlias);
|
||||
return this.scaffolds.find(o => o.contentTypeAlias === contentTypeAlias) || null;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -609,10 +609,14 @@
|
||||
blockObject.settingsData = settingsData;
|
||||
|
||||
// make basics from scaffold
|
||||
blockObject.settings = Utilities.copy(settingsScaffold);
|
||||
ensureUdiAndKey(blockObject.settings, settingsUdi);
|
||||
if (settingsScaffold !== null) {// We might not have settingsScaffold
|
||||
blockObject.settings = Utilities.copy(settingsScaffold);
|
||||
ensureUdiAndKey(blockObject.settings, settingsUdi);
|
||||
|
||||
mapToElementModel(blockObject.settings, settingsData);
|
||||
mapToElementModel(blockObject.settings, settingsData);
|
||||
} else {
|
||||
blockObject.settings = null;
|
||||
}
|
||||
|
||||
// add settings content-app
|
||||
appendSettingsContentApp(blockObject.content, this.__labels.settingsName);
|
||||
|
||||
Reference in New Issue
Block a user