Open bjarnef opened 8 years ago
It can use the same approach as the current version of Nested Content, where it use its own API controller .. or use getAll method in contentTypeResource - however I think it was added in Umbraco 7.4.0 https://github.com/umbraco/Umbraco-CMS/blob/75c2b07ad3a093b5b65b6ebd45697687c062f62a/src/Umbraco.Web.UI.Client/src/common/resources/contenttype.resource.js#L149
See also this issue created in Nested Content https://github.com/leekelleher/umbraco-nested-content/issues/78
It could use something like the following using contentTypeResource or should we just stick to its own ApiController?
angular.module('umbraco').controller("Our.Umbraco.Photon.Controllers.DocTypePickerController",
function ($scope, contentTypeResource, photonResources) {
var umbVersion = Umbraco.Sys.ServerVariables.application.version;
//if umbVersion >= 7.4.0 use contentTypeResource.getAll()
//else use photonResources.getContentTypes()
//example from Nested Content
//ncResources.getContentTypes().then(function (docTypes) {
//$scope.model.docTypes = docTypes;
//});
});
and it should probably have a method then for comparing the version number.
An example from Umbraco Forms:
var umbracoVersion = Umbraco.Sys.ServerVariables.application.version;
$scope.openMediaPicker = function() {
var compareOptions = {
zeroExtend: true
};
var versionCompare = utilityService.compareVersions(umbracoVersion, "7.4", compareOptions);
if(versionCompare === 0 || versionCompare === 1) {
$scope.mediaPickerOverlay = {
view: "mediapicker",
show: true,
submit: function(model) {
var selectedImage = model.selectedImages[0];
populateFile(selectedImage);
$scope.mediaPickerOverlay.show = false;
$scope.mediaPickerOverlay = null;
}
};
} else {
dialogService.mediaPicker({ callback: populateFile });
}
};
For the meta data doc type, can we list the available doc types - just like in Nested Content where it has a dropdown with the available doc types?