Skip to content

Commit

Permalink
Added Issue, IssuePriority, and IssueStatus content types.
Browse files Browse the repository at this point in the history
  • Loading branch information
DrewBrasher committed Apr 4, 2024
1 parent 3afc48e commit 21762e9
Show file tree
Hide file tree
Showing 3 changed files with 162 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/OrchardCoreContrib.IssueTracker/Manifest.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using OrchardCore.Modules.Manifest;

[assembly: Module(
Name = "OrchardCoreContrib.IssueTracker",
Author = "The Orchard Core Team",
Website = "https://orchardcore.net",
Name = "Issue Tracker",
Author = "The Orchard Core Community",
Website = "https://github.com/OrchardCoreContrib",
Version = "0.0.1",
Description = "OrchardCoreContrib.IssueTracker",
Dependencies = new[] { "OrchardCore.Contents" },
Description = "Adds Issue Tracker Features ",

This comment has been minimized.

Copy link
@hishamco

hishamco Apr 28, 2024

Member

Provides a set of features and services to manage and track issues.

This comment has been minimized.

Copy link
@DrewBrasher

DrewBrasher Apr 29, 2024

Author

I updated the Description

Dependencies = new[] { "OrchardCore.Contents", "OrchardCore.Taxonomies", "OrchardCore.Media" },
Category = "Content Management"
)]
153 changes: 153 additions & 0 deletions src/OrchardCoreContrib.IssueTracker/Migrations.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
using OrchardCore.ContentFields.Settings;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Metadata;
using OrchardCore.ContentManagement.Metadata.Settings;
using OrchardCore.Data.Migration;
using OrchardCore.Media.Settings;
using OrchardCore.Taxonomies.Settings;

namespace OrchardCoreContrib.IssueTracker;
public class Migrations : DataMigration
Expand All @@ -14,7 +18,156 @@ public Migrations(IContentDefinitionManager contentDefinitionManager)

public int Create()
{
// Issue Priority
_contentDefinitionManager.AlterTypeDefinition("IssuePriority", type => type
.DisplayedAs("Issue Priority")
.WithPart("TitlePart", part => part
.WithPosition("0")
)
.WithPart("IssuePriority", part => part
.WithPosition("1")
)
.WithPart("AutoroutePart", part => part

This comment has been minimized.

Copy link
@hishamco

hishamco Apr 28, 2024

Member

Why do you need an autoroute here?

This comment has been minimized.

Copy link
@DrewBrasher

DrewBrasher Apr 29, 2024

Author

I don't think it is needed. I'll remove it. I think I should remove it from all the content types I created. Do you think so?

This comment has been minimized.

Copy link
@hishamco

hishamco Apr 29, 2024

Member

It depends

.WithPosition("2")
)
);

// Issue Status
_contentDefinitionManager.AlterTypeDefinition("IssueStatus", type => type
.DisplayedAs("Issue Status")
.WithPart("TitlePart", part => part
.WithPosition("0")
)
.WithPart("IssueStatus", part => part
.WithPosition("1")
)
.WithPart("AutoroutePart", part => part
.WithPosition("2")
)
);

// Issue Category
_contentDefinitionManager.AlterTypeDefinition("IssueCategory", type => type
.DisplayedAs("Issue Category")
.WithPart("TitlePart", part => part
.WithPosition("0")
)
.WithPart("IssueCategory", part => part
.WithPosition("1")
)
.WithPart("AutoroutePart", part => part
.WithPosition("2")
)
);

_contentDefinitionManager.AlterPartDefinition("IssueCategory", part => part
.WithField("ResponsibleUsers", field => field

This comment has been minimized.

Copy link
@hishamco

hishamco Apr 28, 2024

Member

Do you mean assignees or reviewers?

This comment has been minimized.

Copy link
@DrewBrasher

DrewBrasher Apr 29, 2024

Author

This would be the people who can see and get notified about issues in a particular category. For example, if an issue is created with the category "Printer", the people in the IT department would be responsible for it but if it has the category "Website" the Web Developers would be responsible for it.

This comment has been minimized.

Copy link
@hishamco

hishamco Apr 29, 2024

Member

While it's issue tracker, the assignees and reviewers will get notified, right?

.OfType("UserPickerField")
.WithDisplayName("Responsible Users")
.WithPosition("0")
.WithSettings(new UserPickerFieldSettings
{
Required = true,
Multiple = true,
DisplayAllUsers = false,
DisplayedRoles = new[]
{
"Administrator",
},
})
)
);

// Issue
_contentDefinitionManager.AlterTypeDefinition("Issue", type => type
.DisplayedAs("Issue")
.Creatable()
.Listable()
.Securable()
.WithPart("Issue", part => part
.WithPosition("2")
)
.WithPart("AutoroutePart", part => part
.WithPosition("3")
)
.WithPart("TitlePart", part => part
.WithPosition("0")
)
.WithPart("ContactInformationPart", part => part
.WithPosition("1")
)
);

_contentDefinitionManager.AlterPartDefinition("Issue", part => part
.WithField("Description", field => field
.OfType("MarkdownField")
.WithDisplayName("Description")
.WithEditor("Wysiwyg")
.WithPosition("0")
)
.WithField("Files", field => field
.OfType("MediaField")
.WithDisplayName("Files")
.WithEditor("Attached")
.WithPosition("4")
)
.WithField("Category", field => field
.OfType("TaxonomyField")
.WithDisplayName("Category")
.WithPosition("1")
.WithSettings(new TaxonomyFieldSettings
{
Required = true,
TaxonomyContentItemId = "4gj5zq9wf1zaet99mqab9gvw4g",

This comment has been minimized.

Copy link
@hishamco

hishamco Apr 28, 2024

Member

Let us rid of that and calculate it programatically

Unique = true,
})
)
.WithField("Assignees", field => field
.OfType("UserPickerField")
.WithDisplayName("Assignees")
.WithPosition("2")
.WithSettings(new UserPickerFieldSettings
{
Multiple = true,
DisplayAllUsers = false,
DisplayedRoles = new[]
{
"Administrator",
},
})
)
.WithField("Priority", field => field
.OfType("TaxonomyField")
.WithDisplayName("Priority")
.WithPosition("3")
.WithSettings(new TaxonomyFieldSettings
{
TaxonomyContentItemId = "4mwtqz7n7dqyr1hxnr7hcte148",
})
)
);

_contentDefinitionManager.AlterPartDefinition("ContactInformationPart", part => part
.Attachable()
.WithDescription("Contact Information")
.WithField("Name", field => field
.OfType("TextField")
.WithDisplayName("Name")
.WithPosition("0")
)
.WithField("Email", field => field
.OfType("TextField")
.WithDisplayName("Email")
.WithEditor("Email")
.WithPosition("2")
)
.WithField("Phone", field => field
.OfType("TextField")
.WithDisplayName("Phone")
.WithEditor("Tel")
.WithPosition("1")
)
);
return 1;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
Expand All @@ -16,6 +16,9 @@
<PackageReference Include="OrchardCore.ContentManagement" Version="1.7.0" />
<PackageReference Include="OrchardCore.ContentTypes.Abstractions" Version="1.7.0" />
<PackageReference Include="OrchardCore.DisplayManagement" Version="1.7.0" />
<PackageReference Include="OrchardCore.Taxonomies" Version="1.7.0" />
<PackageReference Include="OrchardCore.Media" Version="1.7.0" />
<PackageReference Include="OrchardCore.ContentFields" Version="1.7.0" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 21762e9

Please sign in to comment.