diff --git a/app/Umbraco/Umbraco.Archetype/Api/ArchetypeDataTypeController.cs b/app/Umbraco/Umbraco.Archetype/Api/ArchetypeDataTypeController.cs index a544c3a..5770d2e 100644 --- a/app/Umbraco/Umbraco.Archetype/Api/ArchetypeDataTypeController.cs +++ b/app/Umbraco/Umbraco.Archetype/Api/ArchetypeDataTypeController.cs @@ -28,7 +28,7 @@ namespace Archetype.Api return dataTypes.Select(t => new { guid = t.Key, name = t.Name }); } - public object GetByGuid(Guid guid) + public object GetByGuid(Guid guid, string contentTypeAlias, string propertyTypeAlias, string archetypeAlias, int nodeId) { var dataType = Services.DataTypeService.GetDataTypeDefinitionById(guid); if (dataType == null) @@ -36,7 +36,7 @@ namespace Archetype.Api throw new HttpResponseException(HttpStatusCode.NotFound); } var dataTypeDisplay = Mapper.Map(dataType); - return new { selectedEditor = dataTypeDisplay.SelectedEditor, preValues = dataTypeDisplay.PreValues }; + return new { selectedEditor = dataTypeDisplay.SelectedEditor, preValues = dataTypeDisplay.PreValues, contentTypeAlias = contentTypeAlias, propertyTypeAlias = propertyTypeAlias, archetypeAlias = archetypeAlias, nodeId = nodeId }; } } } diff --git a/app/directives/archetypeproperty.js b/app/directives/archetypeproperty.js index 21baea7..57cc61f 100644 --- a/app/directives/archetypeproperty.js +++ b/app/directives/archetypeproperty.js @@ -1,4 +1,4 @@ -angular.module("umbraco.directives").directive('archetypeProperty', function ($compile, $http, archetypePropertyEditorResource, umbPropEditorHelper, $timeout, $rootScope, $q) { +angular.module("umbraco.directives").directive('archetypeProperty', function ($compile, $http, archetypePropertyEditorResource, umbPropEditorHelper, $timeout, $rootScope, $q, editorState) { function getFieldsetByAlias(fieldsets, alias) { @@ -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).then(function (data) { + archetypePropertyEditorResource.getDataType(dataTypeGuid, 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) { @@ -235,6 +235,7 @@ angular.module("umbraco.directives").directive('archetypeProperty', function ($c scope: { property: '=', propertyConfigIndex: '=', + propertyEditorAlias: '=', archetypeConfig: '=', fieldset: '=', fieldsetIndex: '=', @@ -243,4 +244,4 @@ angular.module("umbraco.directives").directive('archetypeProperty', function ($c umbracoForm: '=' } } -}); \ No newline at end of file +}); diff --git a/app/resources/propertyeditor.js b/app/resources/propertyeditor.js index 13b6afb..c8bc73c 100644 --- a/app/resources/propertyeditor.js +++ b/app/resources/propertyeditor.js @@ -6,9 +6,9 @@ angular.module('umbraco.resources').factory('archetypePropertyEditorResource', f $http.get("/umbraco/backoffice/ArchetypeApi/ArchetypeDataType/GetAll"), 'Failed to retrieve datatypes from tree service' ); }, - getDataType: function(guid) { + getDataType: function (guid, contentTypeAlias, propertyTypeAlias, archetypeAlias, nodeId) { return umbRequestHelper.resourcePromise( - $http.get("/umbraco/backoffice/ArchetypeApi/ArchetypeDataType/GetByGuid?guid=" + guid), 'Failed to retrieve datatype' + $http.get("/umbraco/backoffice/ArchetypeApi/ArchetypeDataType/GetByGuid?guid=" + guid + "&contentTypeAlias=" + contentTypeAlias + "&propertyTypeAlias=" + propertyTypeAlias + "&archetypeAlias=" + archetypeAlias + "&nodeId=" + nodeId), 'Failed to retrieve datatype' ); }, getPropertyEditorMapping: function(alias) { @@ -26,4 +26,4 @@ angular.module('umbraco.resources').factory('archetypePropertyEditorResource', f }); } } -}); \ No newline at end of file +}); diff --git a/app/views/archetype.default.html b/app/views/archetype.default.html index 63a2970..3ab14c7 100644 --- a/app/views/archetype.default.html +++ b/app/views/archetype.default.html @@ -38,7 +38,7 @@
- +