Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@
scope.openContentType = (contentTypeId) => {
const editor = {
id: contentTypeId,
entityType: scope.contentType,
submit: () => {
const args = { node: scope.model };
eventsService.emit("editors.documentType.reload", args);
Expand All @@ -519,17 +520,7 @@
}
};

switch (scope.contentType) {
case "documentType":
editorService.documentTypeEditor(editor);
break;
case "mediaType":
editorService.mediaTypeEditor(editor);
break;
case "memberType":
editorService.memberTypeEditor(editor);
break;
}
editorService.contentTypeEditor(editor);
};

/* ---------- TABS ---------- */
Expand Down
34 changes: 34 additions & 0 deletions src/Umbraco.Web.UI.Client/src/common/services/editor.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,39 @@ When building a custom infinite editor view you can use the same components as a
open(editor);
}

/**
* @ngdoc method
* @name umbraco.services.editorService#contentTypeEditor
* @methodOf umbraco.services.editorService
*
* @description
* Opens the content type editor in infinite editing, the submit callback returns the alias of the saved content type.
*
* @param {object} editor rendering options.
* @param {string} editor.entityType Entity type to open - default document type.
* @param {number} editor.id Indicates the ID of the content type to be edited. Alternatively the ID may be set to `-1` in combination with `create` being set to `true` to open the content type editor for creating a new content type.
* @param {boolean} editor.create Set to `true` to open the content type editor for creating a new content type.
* @param {function} editor.submit Callback function when the submit button is clicked. Returns the editor model object.
* @param {function} editor.close Callback function when the close button is clicked.
* @returns {object} editor object.
*/
function contentTypeEditor(editor) {

if (!editor.entityType) editor.entityType = "documentType";
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default to documentType to keep it consistent with: #15080


switch (editor.entityType) {
case "documentType":
documentTypeEditor(editor);
break;
case "mediaType":
mediaTypeEditor(editor);
break;
case "memberType":
memberTypeEditor(editor);
break;
}
}

/**
* @ngdoc method
* @name umbraco.services.editorService#documentTypeEditor
Expand Down Expand Up @@ -1158,6 +1191,7 @@ When building a custom infinite editor view you can use the same components as a
linkPicker: linkPicker,
mediaPicker: mediaPicker,
iconPicker: iconPicker,
contentTypeEditor: contentTypeEditor,
documentTypeEditor: documentTypeEditor,
mediaTypeEditor: mediaTypeEditor,
memberTypeEditor: memberTypeEditor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ function DataTypeInfoController($scope, $routeParams, dataTypeResource, $timeout

const editor = {
id: id,
entityType: type,
submit: function (model) {
editorService.close();
vm.view.loading = true;
Expand All @@ -71,17 +72,7 @@ function DataTypeInfoController($scope, $routeParams, dataTypeResource, $timeout
}
};

switch (type) {
case "documentType":
editorService.documentTypeEditor(editor);
break;
case "mediaType":
editorService.mediaTypeEditor(editor);
break;
case "memberType":
editorService.memberTypeEditor(editor);
break;
}
editorService.contentTypeEditor(editor);
}

loadRelations();
Expand Down