{"id":16489381,"url":"https://github.com/nicbell/ucreate","last_synced_at":"2025-03-23T12:34:24.313Z","repository":{"id":17945536,"uuid":"20927005","full_name":"nicbell/ucreate","owner":"nicbell","description":"Create strongly typed views and generate DocTypes, DataTypes, MediaTypes and MemberTypes for Umbraco 7 using a code-first approach.","archived":false,"fork":false,"pushed_at":"2023-07-13T17:17:12.000Z","size":15742,"stargazers_count":17,"open_issues_count":7,"forks_count":7,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2025-03-18T20:39:50.310Z","etag":null,"topics":["umbraco"],"latest_commit_sha":null,"homepage":"http://nicbell.github.io/ucreate/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nicbell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-06-17T14:36:40.000Z","updated_at":"2023-09-02T00:14:36.000Z","dependencies_parsed_at":"2024-06-21T07:26:03.378Z","dependency_job_id":null,"html_url":"https://github.com/nicbell/ucreate","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicbell%2Fucreate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicbell%2Fucreate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicbell%2Fucreate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicbell%2Fucreate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nicbell","download_url":"https://codeload.github.com/nicbell/ucreate/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245104460,"owners_count":20561377,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["umbraco"],"created_at":"2024-10-11T13:44:04.043Z","updated_at":"2025-03-23T12:34:21.904Z","avatar_url":"https://github.com/nicbell.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"UCreate [![Build status](https://ci.appveyor.com/api/projects/status/60v4v2cbl6nxmf0q?svg=true)](https://ci.appveyor.com/project/nicbell/ucreate) [![Nuget](https://buildstats.info/nuget/ucreate)](https://www.nuget.org/packages/UCreate/)\n=======\n\nCreate doc types, media types, data types, member types and member groups for Umbraco 7 using a code-first approach. Inspired by [USiteBuilder](https://github.com/spopovic/uSiteBuilder).\n\nAvailable on NuGet\n---\n```\nPM\u003e Install-Package UCreate\n```\n\nUsage\n---\n\nThe only configuration you'll need to get started is an app setting in your ```web.config```. This tells UCreate to sync your doc types, media types, data types, member types and member groups on application start.\n\n```xml\n...\n\u003cappSettings\u003e\n    ...\n    \u003cadd key=\"UCreateSyncEnabled\" value=\"true\" /\u003e\n    ...\n\u003c/appSettings\u003e\n...\n```\n\nDocType example\n---\nDoc types support property inheritance. Here is a list of available [icons](http://nicbell.github.io/ucreate/icons.html).\n```csharp\n[DocType(Name = \"Page With Title\",\n    Icon = \"icon-zip color-blue\",\n    AllowedAsRoot = true,\n    AllowedTemplates = new[] { \"PageWithTitle\" },\n    DefaultTemplate = \"PageWithTitle\",\n    CompositionTypes = new[] { typeof(TaggedPage) })]\npublic class PageWithTitle : PublishedContentModel\n{\n    public PageWithTitle(IPublishedContent content) : base(content)\n    { }\n\n    [Property(Alias = \"heading\", TypeName = PropertyTypes.Textstring, Description = \"Heading for page\", Mandatory = true, TabName = \"Content\")]\n    public string Heading {\n        get { return Content.GetPropertyValue\u003cstring\u003e(\"heading\"); }\n    }\n\n    [Property(Alias = \"itemDate\", Name = \"Item Date\", TypeName = PropertyTypes.DatePicker, Description = \"Date\", Mandatory = true, TabName = \"Content\")]\n    public DateTime ItemDate\n    {\n        get { return Content.GetPropertyValue\u003cDateTime\u003e(\"itemDate\"); }\n    }\n}\n```\n\nMediaType example\n---\nMedia types support property inheritance.\n```csharp\n[MediaType(Name = \"Folder With Cover\",\n    Icon = \"icon-folder color-blue\",\n    AllowedAsRoot = true,\n    IsContainer = true,\n    AllowedChildTypes = new[] { typeof(FolderWithCover), typeof(Image) })]\npublic class FolderWithCover\n{\n    [Property(Alias = \"coverImage\", TypeName = PropertyTypes.MediaPicker, Description = \"Cover image.\", Mandatory = true)]\n    public string CoverImage { get; set; }\n}\n```\n\nDataType with prevalues example\n---\n```csharp\n[DataType(EditorAlias = Umbraco.Core.Constants.PropertyEditors.ColorPickerAlias,\n    Name = \"Nice Color Picker\",\n    Key = \"1bfca1e7-95d0-485e-bd94-9fe9c2b8821f\",\n    DBType = DataTypeDatabaseType.Nvarchar)]\npublic class NiceColorPicker : IHasPreValues\n{\n    /// \u003csummary\u003e\n    /// Implementing PreValues\n    /// \u003c/summary\u003e\n    public IDictionary\u003cstring, PreValue\u003e PreValues\n    {\n        get\n        {\n            return new Dictionary\u003cstring, PreValue\u003e {\n                {\"1\", new PreValue(\"ff00ff\")},\n                {\"2\", new PreValue(\"1f00f1\")},\n                {\"3\", new PreValue(\"123123\")},\n                {\"4\", new PreValue(\"ffffff\")}\n            };\n        }\n    }\n}\n```\n\nMemberType example\n---\n```csharp\n[MemberType(Name = \"Employee\", Description = \"Member who represents an employee\", Icon = \"icon-user color-green\")]\npublic class Employee\n{\n    [MemberProperty(Alias = \"jobTitle\", TypeName = PropertyTypes.Textstring, Description = \"Employee's job title\", Mandatory = true, TabName = \"Job Details\", CanEdit = true, ShowOnProfile = true)]\n    public string JobTitle { get; set; }\n\n    [MemberProperty(Alias = \"jobDescription\", TypeName = PropertyTypes.Textarea, Description = \"Employee's job description\", Mandatory = false, TabName = \"Job Details\", CanEdit = true, ShowOnProfile = false)]\n    public string JobDescription { get; set; }\n\n    [MemberProperty(Alias = \"profilePicture\", TypeName = PropertyTypes.MediaPicker, Description = \"Admin profile picture\", Mandatory = false, CanEdit = true, ShowOnProfile = true)]\n    public string ProfilePicture { get; set; }\n}\n```\n\nMemberGroup example\n---\n```csharp\n[MemberGroup(Name = \"Staff\")]\npublic class Staff\n{\n}\n```\n\nStrongly typed views\n---\nIn order to use your doc types on the front-end you need to enable the `PublishedContentModel` factory. UCreate can do this for you if add the following app setting:\n```xml\n...\n\u003cappSettings\u003e\n    ...\n    \u003cadd key=\"UCreatePublishedModelsEnabled\" value=\"true\" /\u003e\n    ...\n\u003c/appSettings\u003e\n...\n```\nThen using the doc types in your views is pretty simple.\n```html\n@inherits UmbracoTemplatePage\u003cPageWithTitle\u003e\n\n@{\n    Layout = null;\n}\n\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003chead\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width\" /\u003e\n    \u003ctitle\u003ePageWithTitle\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n    \u003ch1\u003e@Model.Content.Heading\u003c/h1\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\nContributing\n---\nIf you have a fix for something don't be shy, submit a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicbell%2Fucreate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicbell%2Fucreate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicbell%2Fucreate/lists"}