diff --git a/app/Umbraco/Umbraco.Archetype/Api/ArchetypeDataTypeController.cs b/app/Umbraco/Umbraco.Archetype/Api/ArchetypeDataTypeController.cs index 5770d2e..d4693a2 100644 --- a/app/Umbraco/Umbraco.Archetype/Api/ArchetypeDataTypeController.cs +++ b/app/Umbraco/Umbraco.Archetype/Api/ArchetypeDataTypeController.cs @@ -28,6 +28,17 @@ namespace Archetype.Api return dataTypes.Select(t => new { guid = t.Key, name = t.Name }); } + public object GetByGuid(Guid guid) + { + var dataType = Services.DataTypeService.GetDataTypeDefinitionById(guid); + if (dataType == null) + { + throw new HttpResponseException(HttpStatusCode.NotFound); + } + var dataTypeDisplay = Mapper.Map(dataType); + return new { selectedEditor = dataTypeDisplay.SelectedEditor, preValues = dataTypeDisplay.PreValues }; + } + public object GetByGuid(Guid guid, string contentTypeAlias, string propertyTypeAlias, string archetypeAlias, int nodeId) { var dataType = Services.DataTypeService.GetDataTypeDefinitionById(guid); diff --git a/app/Umbraco/Umbraco.Archetype/Models/ArchetypePreValue.cs b/app/Umbraco/Umbraco.Archetype/Models/ArchetypePreValue.cs index 2a8c54e..c4c162e 100644 --- a/app/Umbraco/Umbraco.Archetype/Models/ArchetypePreValue.cs +++ b/app/Umbraco/Umbraco.Archetype/Models/ArchetypePreValue.cs @@ -50,6 +50,9 @@ namespace Archetype.Models [JsonProperty("customViewPath")] public string CustomViewPath { get; set; } + [JsonProperty("enableDeepDatatypeRequests")] + public bool EnableDeepDatatypeRequests { get; set; } + [JsonProperty("developerMode")] public bool DeveloperMode { get; set; } } diff --git a/app/controllers/config.controller.js b/app/controllers/config.controller.js index 1300159..7c6bd69 100644 --- a/app/controllers/config.controller.js +++ b/app/controllers/config.controller.js @@ -6,7 +6,7 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio //define empty items var newPropertyModel = '{"alias": "", "remove": false, "collapse": false, "label": "", "helpText": "", "dataTypeGuid": "0cc0eba1-9960-42c9-bf9b-60e150b429ae", "value": ""}'; var newFieldsetModel = '{"alias": "", "remove": false, "collapse": false, "labelTemplate": "", "icon": "", "label": "", "properties": [' + newPropertyModel + ']}'; - var defaultFieldsetConfigModel = JSON.parse('{"showAdvancedOptions": false, "startWithAddButton": false, "hideFieldsetToolbar": false, "enableMultipleFieldsets": false, "hideFieldsetControls": false, "hidePropertyLabel": false, "maxFieldsets": null, "enableCollapsing": true, "enableDisabling": true, "fieldsets": [' + newFieldsetModel + ']}'); + var defaultFieldsetConfigModel = JSON.parse('{"showAdvancedOptions": false, "startWithAddButton": false, "hideFieldsetToolbar": false, "enableMultipleFieldsets": false, "hideFieldsetControls": false, "hidePropertyLabel": false, "maxFieldsets": null, "enableCollapsing": true, "enableDisabling": true, "enableDeepDatatypeRequests": true, "fieldsets": [' + newFieldsetModel + ']}'); //ini the model $scope.model.value = $scope.model.value || defaultFieldsetConfigModel; diff --git a/app/directives/archetypeproperty.js b/app/directives/archetypeproperty.js index a191ecb..09f4f21 100644 --- a/app/directives/archetypeproperty.js +++ b/app/directives/archetypeproperty.js @@ -66,7 +66,7 @@ angular.module("umbraco.directives").directive('archetypeProperty', function ($c defaultValue = jsonOrString(defaultValue, scope.archetypeConfig.developerMode, "defaultValue"); //grab info for the selected datatype, prepare for view - archetypePropertyEditorResource.getDataType(dataTypeGuid, editorState.current.contentTypeAlias, scope.propertyEditorAlias, alias, editorState.current.id).then(function (data) { + archetypePropertyEditorResource.getDataType(dataTypeGuid, scope.archetypeConfig.enableDeepDatatypeRequests, editorState.current.contentTypeAlias, scope.propertyEditorAlias, alias, editorState.current.id).then(function (data) { //transform preValues array into object expected by propertyeditor views var configObj = {}; _.each(data.preValues, function(p) { diff --git a/app/langs/da-dk.js b/app/langs/da-dk.js index dbd7fc9..72805cd 100644 --- a/app/langs/da-dk.js +++ b/app/langs/da-dk.js @@ -33,5 +33,6 @@ "select": "Vælg", "icon": "Ikon", "enableDisabling": "Aktivér fieldset-deaktivering?", - "enableDisablingDescription": "Tillad brugere at aktivere/deaktivere individuelle fieldsets." + "enableDisablingDescription": "Tillad brugere at aktivere/deaktivere individuelle fieldsets.", + "deepDatatypeRequest":"Allows for easier datatype interception at the cost of caching performance." } diff --git a/app/langs/de-de.js b/app/langs/de-de.js index 61ebcfe..86f20fa 100644 --- a/app/langs/de-de.js +++ b/app/langs/de-de.js @@ -33,5 +33,6 @@ "select": "Select", "icon": "Icon", "enableDisabling": "Enable Fieldset Disabling?", - "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled." + "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled.", + "deepDatatypeRequest":"Allows for easier datatype interception at the cost of caching performance." } diff --git a/app/langs/en-gb.js b/app/langs/en-gb.js index 454abc2..14aee0a 100644 --- a/app/langs/en-gb.js +++ b/app/langs/en-gb.js @@ -33,5 +33,6 @@ "select": "Select", "icon": "Icon", "enableDisabling": "Enable Fieldset Disabling?", - "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled." + "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled.", + "deepDatatypeRequest":"Allows for easier datatype interception at the cost of caching performance." } diff --git a/app/langs/en-us.js b/app/langs/en-us.js index 61ebcfe..86f20fa 100644 --- a/app/langs/en-us.js +++ b/app/langs/en-us.js @@ -33,5 +33,6 @@ "select": "Select", "icon": "Icon", "enableDisabling": "Enable Fieldset Disabling?", - "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled." + "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled.", + "deepDatatypeRequest":"Allows for easier datatype interception at the cost of caching performance." } diff --git a/app/langs/es-es.js b/app/langs/es-es.js index 61ebcfe..86f20fa 100644 --- a/app/langs/es-es.js +++ b/app/langs/es-es.js @@ -33,5 +33,6 @@ "select": "Select", "icon": "Icon", "enableDisabling": "Enable Fieldset Disabling?", - "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled." + "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled.", + "deepDatatypeRequest":"Allows for easier datatype interception at the cost of caching performance." } diff --git a/app/langs/fr-fr.js b/app/langs/fr-fr.js index 61ebcfe..86f20fa 100644 --- a/app/langs/fr-fr.js +++ b/app/langs/fr-fr.js @@ -33,5 +33,6 @@ "select": "Select", "icon": "Icon", "enableDisabling": "Enable Fieldset Disabling?", - "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled." + "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled.", + "deepDatatypeRequest":"Allows for easier datatype interception at the cost of caching performance." } diff --git a/app/langs/he-il.js b/app/langs/he-il.js index 61ebcfe..86f20fa 100644 --- a/app/langs/he-il.js +++ b/app/langs/he-il.js @@ -33,5 +33,6 @@ "select": "Select", "icon": "Icon", "enableDisabling": "Enable Fieldset Disabling?", - "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled." + "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled.", + "deepDatatypeRequest":"Allows for easier datatype interception at the cost of caching performance." } diff --git a/app/langs/it-it.js b/app/langs/it-it.js index 61ebcfe..86f20fa 100644 --- a/app/langs/it-it.js +++ b/app/langs/it-it.js @@ -33,5 +33,6 @@ "select": "Select", "icon": "Icon", "enableDisabling": "Enable Fieldset Disabling?", - "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled." + "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled.", + "deepDatatypeRequest":"Allows for easier datatype interception at the cost of caching performance." } diff --git a/app/langs/ja-jp.js b/app/langs/ja-jp.js index 61ebcfe..86f20fa 100644 --- a/app/langs/ja-jp.js +++ b/app/langs/ja-jp.js @@ -33,5 +33,6 @@ "select": "Select", "icon": "Icon", "enableDisabling": "Enable Fieldset Disabling?", - "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled." + "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled.", + "deepDatatypeRequest":"Allows for easier datatype interception at the cost of caching performance." } diff --git a/app/langs/ko-kr.js b/app/langs/ko-kr.js index 61ebcfe..86f20fa 100644 --- a/app/langs/ko-kr.js +++ b/app/langs/ko-kr.js @@ -33,5 +33,6 @@ "select": "Select", "icon": "Icon", "enableDisabling": "Enable Fieldset Disabling?", - "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled." + "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled.", + "deepDatatypeRequest":"Allows for easier datatype interception at the cost of caching performance." } diff --git a/app/langs/nb-no.js b/app/langs/nb-no.js index 61ebcfe..86f20fa 100644 --- a/app/langs/nb-no.js +++ b/app/langs/nb-no.js @@ -33,5 +33,6 @@ "select": "Select", "icon": "Icon", "enableDisabling": "Enable Fieldset Disabling?", - "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled." + "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled.", + "deepDatatypeRequest":"Allows for easier datatype interception at the cost of caching performance." } diff --git a/app/langs/nl-nl.js b/app/langs/nl-nl.js index 61ebcfe..86f20fa 100644 --- a/app/langs/nl-nl.js +++ b/app/langs/nl-nl.js @@ -33,5 +33,6 @@ "select": "Select", "icon": "Icon", "enableDisabling": "Enable Fieldset Disabling?", - "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled." + "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled.", + "deepDatatypeRequest":"Allows for easier datatype interception at the cost of caching performance." } diff --git a/app/langs/pl-pl.js b/app/langs/pl-pl.js index 61ebcfe..86f20fa 100644 --- a/app/langs/pl-pl.js +++ b/app/langs/pl-pl.js @@ -33,5 +33,6 @@ "select": "Select", "icon": "Icon", "enableDisabling": "Enable Fieldset Disabling?", - "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled." + "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled.", + "deepDatatypeRequest":"Allows for easier datatype interception at the cost of caching performance." } diff --git a/app/langs/pt-br.js b/app/langs/pt-br.js index 61ebcfe..86f20fa 100644 --- a/app/langs/pt-br.js +++ b/app/langs/pt-br.js @@ -33,5 +33,6 @@ "select": "Select", "icon": "Icon", "enableDisabling": "Enable Fieldset Disabling?", - "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled." + "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled.", + "deepDatatypeRequest":"Allows for easier datatype interception at the cost of caching performance." } diff --git a/app/langs/ru-ru.js b/app/langs/ru-ru.js index 61ebcfe..86f20fa 100644 --- a/app/langs/ru-ru.js +++ b/app/langs/ru-ru.js @@ -33,5 +33,6 @@ "select": "Select", "icon": "Icon", "enableDisabling": "Enable Fieldset Disabling?", - "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled." + "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled.", + "deepDatatypeRequest":"Allows for easier datatype interception at the cost of caching performance." } diff --git a/app/langs/sv-se.js b/app/langs/sv-se.js index 61ebcfe..86f20fa 100644 --- a/app/langs/sv-se.js +++ b/app/langs/sv-se.js @@ -33,5 +33,6 @@ "select": "Select", "icon": "Icon", "enableDisabling": "Enable Fieldset Disabling?", - "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled." + "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled.", + "deepDatatypeRequest":"Allows for easier datatype interception at the cost of caching performance." } diff --git a/app/langs/zh-cn.js b/app/langs/zh-cn.js index 61ebcfe..86f20fa 100644 --- a/app/langs/zh-cn.js +++ b/app/langs/zh-cn.js @@ -33,5 +33,6 @@ "select": "Select", "icon": "Icon", "enableDisabling": "Enable Fieldset Disabling?", - "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled." + "enableDisablingDescription": "Allows fieldsets to be individually enabled/disabled.", + "deepDatatypeRequest":"Allows for easier datatype interception at the cost of caching performance." } diff --git a/app/resources/propertyeditor.js b/app/resources/propertyeditor.js index 52d059c..af4312f 100644 --- a/app/resources/propertyeditor.js +++ b/app/resources/propertyeditor.js @@ -6,10 +6,17 @@ angular.module('umbraco.resources').factory('archetypePropertyEditorResource', f $http.get("/umbraco/backoffice/ArchetypeApi/ArchetypeDataType/GetAll", { cache: true }), 'Failed to retrieve datatypes from tree service' ); }, - getDataType: function (guid, contentTypeAlias, propertyTypeAlias, archetypeAlias, nodeId) { - return umbRequestHelper.resourcePromise( - $http.get("/umbraco/backoffice/ArchetypeApi/ArchetypeDataType/GetByGuid?guid=" + guid + "&contentTypeAlias=" + contentTypeAlias + "&propertyTypeAlias=" + propertyTypeAlias + "&archetypeAlias=" + archetypeAlias + "&nodeId=" + nodeId, { cache: true }), 'Failed to retrieve datatype' - ); + getDataType: function (guid, useDeepDatatypeLookup, contentTypeAlias, propertyTypeAlias, archetypeAlias, nodeId) { + if(useDeepDatatypeLookup) { + return umbRequestHelper.resourcePromise( + $http.get("/umbraco/backoffice/ArchetypeApi/ArchetypeDataType/GetByGuid?guid=" + guid + "&contentTypeAlias=" + contentTypeAlias + "&propertyTypeAlias=" + propertyTypeAlias + "&archetypeAlias=" + archetypeAlias + "&nodeId=" + nodeId), 'Failed to retrieve datatype' + ); + } + else { + return umbRequestHelper.resourcePromise( + $http.get("/umbraco/backoffice/ArchetypeApi/ArchetypeDataType/GetByGuid?guid=" + guid , { cache: true }), 'Failed to retrieve datatype' + ); + } }, getPropertyEditorMapping: function(alias) { return umbRequestHelper.resourcePromise( diff --git a/app/views/archetype.config.html b/app/views/archetype.config.html index 60f0c97..b9252e0 100644 --- a/app/views/archetype.config.html +++ b/app/views/archetype.config.html @@ -133,6 +133,10 @@ +
+ + +