1+ using OrchardCore . ContentFields . Settings ;
2+ using OrchardCore . ContentManagement ;
13using OrchardCore . ContentManagement . Metadata ;
24using OrchardCore . ContentManagement . Metadata . Settings ;
35using OrchardCore . Data . Migration ;
6+ using OrchardCore . Media . Settings ;
7+ using OrchardCore . Taxonomies . Settings ;
48
59namespace OrchardCoreContrib . IssueTracker ;
610public class Migrations : DataMigration
@@ -14,7 +18,156 @@ public Migrations(IContentDefinitionManager contentDefinitionManager)
1418
1519 public int Create ( )
1620 {
21+ // Issue Priority
22+ _contentDefinitionManager . AlterTypeDefinition ( "IssuePriority" , type => type
23+ . DisplayedAs ( "Issue Priority" )
24+ . WithPart ( "TitlePart" , part => part
25+ . WithPosition ( "0" )
26+ )
27+ . WithPart ( "IssuePriority" , part => part
28+ . WithPosition ( "1" )
29+ )
30+ . WithPart ( "AutoroutePart" , part => part
31+ . WithPosition ( "2" )
32+ )
33+ ) ;
1734
35+ // Issue Status
36+ _contentDefinitionManager . AlterTypeDefinition ( "IssueStatus" , type => type
37+ . DisplayedAs ( "Issue Status" )
38+ . WithPart ( "TitlePart" , part => part
39+ . WithPosition ( "0" )
40+ )
41+ . WithPart ( "IssueStatus" , part => part
42+ . WithPosition ( "1" )
43+ )
44+ . WithPart ( "AutoroutePart" , part => part
45+ . WithPosition ( "2" )
46+ )
47+ ) ;
48+
49+ // Issue Category
50+ _contentDefinitionManager . AlterTypeDefinition ( "IssueCategory" , type => type
51+ . DisplayedAs ( "Issue Category" )
52+ . WithPart ( "TitlePart" , part => part
53+ . WithPosition ( "0" )
54+ )
55+ . WithPart ( "IssueCategory" , part => part
56+ . WithPosition ( "1" )
57+ )
58+ . WithPart ( "AutoroutePart" , part => part
59+ . WithPosition ( "2" )
60+ )
61+ ) ;
62+
63+ _contentDefinitionManager . AlterPartDefinition ( "IssueCategory" , part => part
64+ . WithField ( "ResponsibleUsers" , field => field
65+ . OfType ( "UserPickerField" )
66+ . WithDisplayName ( "Responsible Users" )
67+ . WithPosition ( "0" )
68+ . WithSettings ( new UserPickerFieldSettings
69+ {
70+ Required = true ,
71+ Multiple = true ,
72+ DisplayAllUsers = false ,
73+ DisplayedRoles = new [ ]
74+ {
75+ "Administrator" ,
76+ } ,
77+ } )
78+ )
79+ ) ;
80+
81+ // Issue
82+ _contentDefinitionManager . AlterTypeDefinition ( "Issue" , type => type
83+ . DisplayedAs ( "Issue" )
84+ . Creatable ( )
85+ . Listable ( )
86+ . Securable ( )
87+ . WithPart ( "Issue" , part => part
88+ . WithPosition ( "2" )
89+ )
90+ . WithPart ( "AutoroutePart" , part => part
91+ . WithPosition ( "3" )
92+ )
93+ . WithPart ( "TitlePart" , part => part
94+ . WithPosition ( "0" )
95+ )
96+ . WithPart ( "ContactInformationPart" , part => part
97+ . WithPosition ( "1" )
98+ )
99+ ) ;
100+
101+ _contentDefinitionManager . AlterPartDefinition ( "Issue" , part => part
102+ . WithField ( "Description" , field => field
103+ . OfType ( "MarkdownField" )
104+ . WithDisplayName ( "Description" )
105+ . WithEditor ( "Wysiwyg" )
106+ . WithPosition ( "0" )
107+ )
108+ . WithField ( "Files" , field => field
109+ . OfType ( "MediaField" )
110+ . WithDisplayName ( "Files" )
111+ . WithEditor ( "Attached" )
112+ . WithPosition ( "4" )
113+ )
114+ . WithField ( "Category" , field => field
115+ . OfType ( "TaxonomyField" )
116+ . WithDisplayName ( "Category" )
117+ . WithPosition ( "1" )
118+ . WithSettings ( new TaxonomyFieldSettings
119+ {
120+ Required = true ,
121+ TaxonomyContentItemId = "4gj5zq9wf1zaet99mqab9gvw4g" ,
122+ Unique = true ,
123+ } )
124+ )
125+ . WithField ( "Assignees" , field => field
126+ . OfType ( "UserPickerField" )
127+ . WithDisplayName ( "Assignees" )
128+ . WithPosition ( "2" )
129+ . WithSettings ( new UserPickerFieldSettings
130+ {
131+ Multiple = true ,
132+ DisplayAllUsers = false ,
133+ DisplayedRoles = new [ ]
134+ {
135+ "Administrator" ,
136+ } ,
137+ } )
138+ )
139+ . WithField ( "Priority" , field => field
140+ . OfType ( "TaxonomyField" )
141+ . WithDisplayName ( "Priority" )
142+ . WithPosition ( "3" )
143+ . WithSettings ( new TaxonomyFieldSettings
144+ {
145+ TaxonomyContentItemId = "4mwtqz7n7dqyr1hxnr7hcte148" ,
146+ } )
147+ )
148+ ) ;
149+
150+ _contentDefinitionManager . AlterPartDefinition ( "ContactInformationPart" , part => part
151+ . Attachable ( )
152+ . WithDescription ( "Contact Information" )
153+ . WithField ( "Name" , field => field
154+ . OfType ( "TextField" )
155+ . WithDisplayName ( "Name" )
156+ . WithPosition ( "0" )
157+ )
158+ . WithField ( "Email" , field => field
159+ . OfType ( "TextField" )
160+ . WithDisplayName ( "Email" )
161+ . WithEditor ( "Email" )
162+ . WithPosition ( "2" )
163+ )
164+ . WithField ( "Phone" , field => field
165+ . OfType ( "TextField" )
166+ . WithDisplayName ( "Phone" )
167+ . WithEditor ( "Tel" )
168+ . WithPosition ( "1" )
169+ )
170+ ) ;
18171 return 1 ;
19172 }
20173}
0 commit comments