diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index ec6aa3f1ae..ef58c0a1bf 100644
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -928,12 +928,14 @@
+
+
diff --git a/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs b/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs
index 430172916a..ca80771965 100644
--- a/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs
+++ b/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs
@@ -286,7 +286,7 @@ namespace Umbraco.Tests.TestHelpers.Entities
{
Alias = "simple",
Name = "Simple Page",
- Description = "ContentType used for simple text pages",
+ Description = "Some member type",
Icon = ".sprTreeDoc3",
Thumbnail = "doc.png",
SortOrder = 1,
diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/membertype.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/membertype.resource.js
new file mode 100644
index 0000000000..55bfc1ede5
--- /dev/null
+++ b/src/Umbraco.Web.UI.Client/src/common/resources/membertype.resource.js
@@ -0,0 +1,23 @@
+/**
+ * @ngdoc service
+ * @name umbraco.resources.memberTypeResource
+ * @description Loads in data for member types
+ **/
+function memberTypeResource($q, $http, umbRequestHelper) {
+
+ return {
+
+ //return all member types
+ getTypes: function () {
+
+ return umbRequestHelper.resourcePromise(
+ $http.get(
+ umbRequestHelper.getApiUrl(
+ "memberTypeApiBaseUrl",
+ "GetAllTypes")),
+ 'Failed to retreive data for member types id');
+ }
+
+ };
+}
+angular.module('umbraco.resources').factory('memberTypeResource', memberTypeResource);
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI.Client/src/views/media/create.html b/src/Umbraco.Web.UI.Client/src/views/media/create.html
index c1237550e2..d24630c752 100644
--- a/src/Umbraco.Web.UI.Client/src/views/media/create.html
+++ b/src/Umbraco.Web.UI.Client/src/views/media/create.html
@@ -1,7 +1,7 @@
-
Create a page under {{currentNode.name}}
+
Create media under {{currentNode.name}}
-
diff --git a/src/Umbraco.Web.UI.Client/src/views/member/create.html b/src/Umbraco.Web.UI.Client/src/views/member/create.html
new file mode 100644
index 0000000000..652a9c07c9
--- /dev/null
+++ b/src/Umbraco.Web.UI.Client/src/views/member/create.html
@@ -0,0 +1,31 @@
+
+
+
+
Create a new member
+
+
+
+
+
+
diff --git a/src/Umbraco.Web.UI.Client/src/views/member/member.create.controller.js b/src/Umbraco.Web.UI.Client/src/views/member/member.create.controller.js
new file mode 100644
index 0000000000..adbf4dfd7f
--- /dev/null
+++ b/src/Umbraco.Web.UI.Client/src/views/member/member.create.controller.js
@@ -0,0 +1,17 @@
+/**
+ * @ngdoc controller
+ * @name Umbraco.Editors.Member.CreateController
+ * @function
+ *
+ * @description
+ * The controller for the member creation dialog
+ */
+function memberCreateController($scope, $routeParams, memberTypeResource, iconHelper) {
+
+ memberTypeResource.getTypes($scope.currentNode.id).then(function (data) {
+ $scope.allowedTypes = iconHelper.formatContentTypeIcons(data);
+ });
+
+}
+
+angular.module('umbraco').controller("Umbraco.Editors.Member.CreateController", memberCreateController);
\ No newline at end of file
diff --git a/src/Umbraco.Web/Editors/BackOfficeController.cs b/src/Umbraco.Web/Editors/BackOfficeController.cs
index 11f1b29f93..76c1fe974e 100644
--- a/src/Umbraco.Web/Editors/BackOfficeController.cs
+++ b/src/Umbraco.Web/Editors/BackOfficeController.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
@@ -7,6 +8,7 @@ using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
using Umbraco.Core.Manifest;
using Umbraco.Core;
+using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Mvc;
using Umbraco.Web.Trees;
using Umbraco.Web.UI.JavaScript;
@@ -61,24 +63,78 @@ namespace Umbraco.Web.Editors
{
{"legacyTreeJs", Url.Action("LegacyTreeJs", "BackOffice")},
//API URLs
- {"contentApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl("PostSave")},
- {"mediaApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl("GetRootMedia")},
- {"sectionApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl("GetSections")},
- {"treeApplicationApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl("GetApplicationTrees")},
- {"contentTypeApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl("GetAllowedChildren")},
- {"mediaTypeApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl("GetAllowedChildren")},
- {"macroApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl("GetMacroParameters")},
- {"authenticationApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl("PostLogin")},
- {"userApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl("GetAll")},
- {"legacyApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl("DeleteLegacyItem")},
- {"entityApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl("GetById")},
- {"dataTypeApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl("GetById")},
- {"dashboardApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl("GetDashboard")},
- {"logApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl("GetEntityLog")},
- {"memberApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl("GetByLogin")},
- {"rteApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl("GetConfiguration")},
- {"stylesheetApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl("GetAll")}
-
+ {
+ "contentApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl(
+ controller => controller.PostSave(null))
+ },
+ {
+ "mediaApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl(
+ controller => controller.GetRootMedia())
+ },
+ {
+ "sectionApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl(
+ controller => controller.GetSections())
+ },
+ {
+ "treeApplicationApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl(
+ controller => controller.GetApplicationTrees(null, null))
+ },
+ {
+ "contentTypeApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl(
+ controller => controller.GetAllowedChildren(0))
+ },
+ {
+ "mediaTypeApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl(
+ controller => controller.GetAllowedChildren(0))
+ },
+ {
+ "macroApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl(
+ controller => controller.GetMacroParameters(0))
+ },
+ {
+ "authenticationApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl(
+ controller => controller.PostLogin(null, null))
+ },
+ {
+ "userApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl(
+ controller => controller.GetAll())
+ },
+ {
+ "legacyApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl(
+ controller => controller.DeleteLegacyItem(null, null))
+ },
+ {
+ "entityApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl(
+ controller => controller.GetById(0, UmbracoEntityTypes.Media))
+ },
+ {
+ "dataTypeApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl(
+ controller => controller.GetById(0))
+ },
+ {
+ "dashboardApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl(
+ controller => controller.GetDashboard(null))
+ },
+ {
+ "logApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl(
+ controller => controller.GetEntityLog(0))
+ },
+ {
+ "memberApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl(
+ controller => controller.GetByKey(Guid.Empty))
+ },
+ {
+ "rteApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl(
+ controller => controller.GetConfiguration())
+ },
+ {
+ "stylesheetApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl(
+ controller => controller.GetAll())
+ },
+ {
+ "memberTypeApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl(
+ controller => controller.GetAllTypes())
+ },
}
},
{
@@ -86,17 +142,19 @@ namespace Umbraco.Web.Editors
{
{"umbracoPath", GlobalSettings.Path},
{"appPluginsPath", IOHelper.ResolveUrl(SystemDirectories.AppPlugins).TrimEnd('/')},
- {"imageFileTypes",
- string.Join(",",UmbracoConfig.For.UmbracoSettings().Content.ImageFileTypes)},
+ {
+ "imageFileTypes",
+ string.Join(",", UmbracoConfig.For.UmbracoSettings().Content.ImageFileTypes)
+ },
}
},
{
"umbracoPlugins", new Dictionary
{
- {"trees", GetTreePluginsMetaData()}
+ {"trees", GetTreePluginsMetaData()}
}
- },
- { "isDebuggingEnabled", HttpContext.IsDebuggingEnabled }
+ },
+ {"isDebuggingEnabled", HttpContext.IsDebuggingEnabled}
};
return JavaScript(ServerVariablesParser.Parse(d));
diff --git a/src/Umbraco.Web/Editors/ContentTypeController.cs b/src/Umbraco.Web/Editors/ContentTypeController.cs
index 284ffc80bb..daf1ca7cf0 100644
--- a/src/Umbraco.Web/Editors/ContentTypeController.cs
+++ b/src/Umbraco.Web/Editors/ContentTypeController.cs
@@ -8,13 +8,20 @@ using Umbraco.Web.Models.Mapping;
using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi;
using System.Linq;
+using Umbraco.Web.WebApi.Filters;
+using Constants = Umbraco.Core.Constants;
namespace Umbraco.Web.Editors
{
+
+ //TODO: We'll need to be careful about the security on this controller, when we start implementing
+ // methods to modify content types we'll need to enforce security on the individual methods, we
+ // cannot put security on the whole controller because things like GetAllowedChildren are required for content editing.
+
///
/// An API controller used for dealing with content types
///
- [PluginController("UmbracoApi")]
+ [PluginController("UmbracoApi")]
public class ContentTypeController : UmbracoAuthorizedJsonController
{
///
diff --git a/src/Umbraco.Web/Editors/MediaTypeController.cs b/src/Umbraco.Web/Editors/MediaTypeController.cs
index 34d4108b01..58d8012e89 100644
--- a/src/Umbraco.Web/Editors/MediaTypeController.cs
+++ b/src/Umbraco.Web/Editors/MediaTypeController.cs
@@ -11,10 +11,15 @@ using Umbraco.Web.WebApi;
namespace Umbraco.Web.Editors
{
+
+ //TODO: We'll need to be careful about the security on this controller, when we start implementing
+ // methods to modify content types we'll need to enforce security on the individual methods, we
+ // cannot put security on the whole controller because things like GetAllowedChildren are required for content editing.
+
///
- /// An API controller used for dealing with content types
+ /// An API controller used for dealing with media types
///
- [PluginController("UmbracoApi")]
+ [PluginController("UmbracoApi")]
public class MediaTypeController : UmbracoAuthorizedJsonController
{
///
diff --git a/src/Umbraco.Web/Editors/MemberTypeController.cs b/src/Umbraco.Web/Editors/MemberTypeController.cs
new file mode 100644
index 0000000000..0bb2f4a755
--- /dev/null
+++ b/src/Umbraco.Web/Editors/MemberTypeController.cs
@@ -0,0 +1,48 @@
+using System.Collections.Generic;
+using System.Linq;
+using AutoMapper;
+using Umbraco.Core.Models;
+using Umbraco.Web.Models.ContentEditing;
+using Umbraco.Web.Mvc;
+using Umbraco.Web.WebApi.Filters;
+using Constants = Umbraco.Core.Constants;
+
+namespace Umbraco.Web.Editors
+{
+ //TODO: We'll need to be careful about the security on this controller, when we start implementing
+ // methods to modify content types we'll need to enforce security on the individual methods, we
+ // cannot put security on the whole controller because things like GetAllowedChildren are required for content editing.
+
+ ///
+ /// An API controller used for dealing with content types
+ ///
+ [PluginController("UmbracoApi")]
+ public class MemberTypeController : UmbracoAuthorizedJsonController
+ {
+ ///
+ /// Constructor
+ ///
+ public MemberTypeController()
+ : this(UmbracoContext.Current)
+ {
+ }
+
+ ///
+ /// Constructor
+ ///
+ ///
+ public MemberTypeController(UmbracoContext umbracoContext)
+ : base(umbracoContext)
+ {
+ }
+
+ ///
+ /// Returns all member types
+ ///
+ public IEnumerable GetAllTypes()
+ {
+ return Services.MemberTypeService.GetAllMemberTypes()
+ .Select(Mapper.Map);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Umbraco.Web/Models/ContentEditing/ContentTypeBasic.cs b/src/Umbraco.Web/Models/ContentEditing/ContentTypeBasic.cs
index 1f70ec381d..2e527cfd93 100644
--- a/src/Umbraco.Web/Models/ContentEditing/ContentTypeBasic.cs
+++ b/src/Umbraco.Web/Models/ContentEditing/ContentTypeBasic.cs
@@ -14,9 +14,6 @@ namespace Umbraco.Web.Models.ContentEditing
[DataContract(Name = "contentType", Namespace = "")]
public class ContentTypeBasic : EntityBasic
{
- [DataMember(Name = "alias", IsRequired = true)]
- [Required]
- public string Alias { get; set; }
[DataMember(Name = "description")]
public string Description { get; set; }
diff --git a/src/Umbraco.Web/Models/Mapping/ContentTypeModelMapper.cs b/src/Umbraco.Web/Models/Mapping/ContentTypeModelMapper.cs
index 7af4ca2006..a09592a49d 100644
--- a/src/Umbraco.Web/Models/Mapping/ContentTypeModelMapper.cs
+++ b/src/Umbraco.Web/Models/Mapping/ContentTypeModelMapper.cs
@@ -7,7 +7,7 @@ using Umbraco.Web.Models.ContentEditing;
namespace Umbraco.Web.Models.Mapping
{
///
- /// Defines mappings for content/media (and i'm sure one day member) type mappings
+ /// Defines mappings for content/media/members type mappings
///
internal class ContentTypeModelMapper : MapperConfiguration
{
@@ -15,6 +15,7 @@ namespace Umbraco.Web.Models.Mapping
{
config.CreateMap();
config.CreateMap();
+ config.CreateMap();
}
}
}
\ No newline at end of file
diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj
index c6a18f95f0..457bfc6b6d 100644
--- a/src/Umbraco.Web/Umbraco.Web.csproj
+++ b/src/Umbraco.Web/Umbraco.Web.csproj
@@ -309,6 +309,7 @@
+
diff --git a/src/Umbraco.Web/UrlHelperExtensions.cs b/src/Umbraco.Web/UrlHelperExtensions.cs
index 3a966d858f..4957e0dbb4 100644
--- a/src/Umbraco.Web/UrlHelperExtensions.cs
+++ b/src/Umbraco.Web/UrlHelperExtensions.cs
@@ -1,5 +1,6 @@
using System;
using System.Linq;
+using System.Linq.Expressions;
using System.Web.Mvc;
using Umbraco.Core;
using Umbraco.Web.Mvc;
@@ -50,6 +51,13 @@ namespace Umbraco.Web
return url.GetUmbracoApiService(actionName).TrimEnd(actionName);
}
+ public static string GetUmbracoApiServiceBaseUrl(this UrlHelper url, Expression> methodSelector)
+ where T : UmbracoApiController
+ {
+ var method = Umbraco.Core.ExpressionHelper.GetMethodInfo(methodSelector);
+ return url.GetUmbracoApiService(method.Name).TrimEnd(method.Name);
+ }
+
///
/// Return the Url for a Web Api service
///