diff --git a/src/Lib/StatCan.OrchardCore.Application.Targets/StatCan.OrchardCore.Application.Targets.csproj b/src/Lib/StatCan.OrchardCore.Application.Targets/StatCan.OrchardCore.Application.Targets.csproj index d5358c6f5..f32c3b6e8 100644 --- a/src/Lib/StatCan.OrchardCore.Application.Targets/StatCan.OrchardCore.Application.Targets.csproj +++ b/src/Lib/StatCan.OrchardCore.Application.Targets/StatCan.OrchardCore.Application.Targets.csproj @@ -27,6 +27,7 @@ + diff --git a/src/Modules/StatCan.OrchardCore.Tenant/FeatureIds.cs b/src/Modules/StatCan.OrchardCore.Tenant/FeatureIds.cs new file mode 100644 index 000000000..88123401f --- /dev/null +++ b/src/Modules/StatCan.OrchardCore.Tenant/FeatureIds.cs @@ -0,0 +1,7 @@ +namespace StatCan.OrchardCore.Tenant +{ + public static class FeatureIds + { + public const string Tenant= "StatCan.OrchardCore.Tenant"; + } +} \ No newline at end of file diff --git a/src/Modules/StatCan.OrchardCore.Tenant/Manifest.cs b/src/Modules/StatCan.OrchardCore.Tenant/Manifest.cs new file mode 100644 index 000000000..403b2eda9 --- /dev/null +++ b/src/Modules/StatCan.OrchardCore.Tenant/Manifest.cs @@ -0,0 +1,21 @@ +using OrchardCore.Modules.Manifest; +using static StatCan.OrchardCore.Tenant.FeatureIds; + +[assembly: Module( + Name = "StatCan Tenant", + Author = "Digital Innovation Team", + Website = "https://digital.statcan.gc.ca", + Version = "1.0.0" +)] + +[assembly: Feature( + Id = Tenant, + Name = "StatCan.Tenant - Widgets", + Category = "Content", + Description = "Adds a widget used to display a List of Tenant and its information", + Dependencies = new[] + { + "OrchardCore.Lists", + "OrchardCore.Widgets" + } +)] \ No newline at end of file diff --git a/src/Modules/StatCan.OrchardCore.Tenant/Migrations.cs b/src/Modules/StatCan.OrchardCore.Tenant/Migrations.cs new file mode 100644 index 000000000..13d796218 --- /dev/null +++ b/src/Modules/StatCan.OrchardCore.Tenant/Migrations.cs @@ -0,0 +1,83 @@ +using OrchardCore.Autoroute.Models; +using OrchardCore.ContentManagement.Metadata; +using OrchardCore.ContentManagement.Metadata.Settings; +using OrchardCore.Data.Migration; +using OrchardCore.Lists.Models; +using OrchardCore.Title.Models; + +namespace StatCan.OrchardCore.Tenant +{ + public class Migrations : DataMigration + { + private readonly IContentDefinitionManager _contentDefinitionManager; + public Migrations(IContentDefinitionManager contentDefinitionManager) + { + _contentDefinitionManager = contentDefinitionManager; + } + + public int Create() + { + _contentDefinitionManager.AlterTypeDefinition("Tenant", type => type + .DisplayedAs("Tenant") + .WithPart("Tenant", part => part + .WithPosition("1") + ) + .WithPart("TitlePart", part => part + .WithPosition("0") + .WithSettings(new TitlePartSettings + { + Options = TitlePartOptions.GeneratedHidden, + Pattern = "{{ Model.ContentItem.Content.Tenant.Name.Text }}", + }) + ) + ); + + _contentDefinitionManager.AlterPartDefinition("Tenant", part => part + .WithField("Poster", field => field + .OfType("MediaField") + .WithDisplayName("Poster") + .WithPosition("0") + ) + .WithField("Name", field => field + .OfType("TextField") + .WithDisplayName("Name") + .WithPosition("1") + ) + .WithField("Description", field => field + .OfType("TextField") + .WithDisplayName("Short Description") + .WithPosition("2") + ) + ); + + _contentDefinitionManager.AlterTypeDefinition("TenantPage", type => type + .DisplayedAs("Tenant Page") + .Creatable() + .Listable() + .Draftable() + .Versionable() + .Securable() + .WithPart("TenantPage", part => part + .WithPosition("0") + ) + .WithPart("ListPart", part => part + .WithPosition("2") + .WithSettings(new ListPartSettings + { + PageSize = 10, + ContainedContentTypes = new[] { "Tenant" }, + }) + ) + .WithPart("AutoroutePart", part => part + .WithPosition("1") + .WithSettings(new AutoroutePartSettings + { + AllowCustomPath = true, + }) + ) + ); + + return 1; + } + } +} diff --git a/src/Modules/StatCan.OrchardCore.Tenant/Startup.cs b/src/Modules/StatCan.OrchardCore.Tenant/Startup.cs new file mode 100644 index 000000000..7ea94ebda --- /dev/null +++ b/src/Modules/StatCan.OrchardCore.Tenant/Startup.cs @@ -0,0 +1,13 @@ +using Microsoft.Extensions.DependencyInjection; +using OrchardCore.Modules; +using OrchardCore.ResourceManagement; +using OrchardCore.Data.Migration; + +namespace StatCan.OrchardCore.Tenant +{ + [Feature(FeatureIds.Tenant)] + public class Startup : StartupBase + { + public override void ConfigureServices(IServiceCollection serviceCollection) => serviceCollection.AddScoped(); + } +} \ No newline at end of file diff --git a/src/Modules/StatCan.OrchardCore.Tenant/StatCan.OrchardCore.Tenant.csproj b/src/Modules/StatCan.OrchardCore.Tenant/StatCan.OrchardCore.Tenant.csproj new file mode 100644 index 000000000..fad569d25 --- /dev/null +++ b/src/Modules/StatCan.OrchardCore.Tenant/StatCan.OrchardCore.Tenant.csproj @@ -0,0 +1,26 @@ + + + + $(AspNetCoreTargetFramework) + true + $(DefaultItemExcludes);.git*;node_modules\** + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Modules/StatCan.OrchardCore.Tenant/Views/Content-Tenant.liquid b/src/Modules/StatCan.OrchardCore.Tenant/Views/Content-Tenant.liquid new file mode 100644 index 000000000..8e19f3dc5 --- /dev/null +++ b/src/Modules/StatCan.OrchardCore.Tenant/Views/Content-Tenant.liquid @@ -0,0 +1,36 @@ +{% assign nameLength = Model.ContentItem.Content.Tenant.Link.Text | size %} +{% assign photo = Model.ContentItem.Content.Tenant.Poster.Paths.first | raw %} +{% assign colors = "red pink purple deep-purple indigo blue light-blue cyan teal green light-green lime yellow amber orange deep-orange brown" | split: " " %} +{% assign numColors = colors | size %} +{% assign avatarColorNum = nameLength | modulo: numColors %} +{% assign avatarColor = colors[avatarColorNum] %} + + + {% if photo != empty %} + + + + {% else %} + + {{ Model.ContentItem.Content.Tenant.Link.Text | slice: 0 | capitalize }} + + {% endif %} + + + {{ Model.ContentItem.Content.Tenant.Link.Text }} + {{ Model.ContentItem.Content.Tenant.Description.Text }} + + + + diff --git a/src/Modules/StatCan.OrchardCore.Tenant/Views/Content-TenantPage.liquid b/src/Modules/StatCan.OrchardCore.Tenant/Views/Content-TenantPage.liquid new file mode 100644 index 000000000..03314a15c --- /dev/null +++ b/src/Modules/StatCan.OrchardCore.Tenant/Views/Content-TenantPage.liquid @@ -0,0 +1,15 @@ + + {% for item in Model.Content.ListPart.ContentItems %} + {{ item | shape_build_display | shape_render }} + {% endfor %} + + +{% assign previousText = "Newer Tenants" | t %} +{% assign nextText = "Older Tenants" | t %} +{% assign previousClass = "previous" | t %} +{% assign nextClass = "next" | t %} + +{% shape_pager Model.Content.ListPart.Pager previous_text: previousText, next_text: nextText, + previous_class: previousClass, next_class: nextClass %} + +{{ Model.Content.ListPart.Pager | shape_render }} diff --git a/src/Themes/BootstrapTheme/Views/Layout.liquid b/src/Themes/BootstrapTheme/Views/Layout.liquid index acd62c159..970a733b6 100644 --- a/src/Themes/BootstrapTheme/Views/Layout.liquid +++ b/src/Themes/BootstrapTheme/Views/Layout.liquid @@ -7,7 +7,10 @@ - + + + + {{ "ThemeResources" | shape_new | shape_render }} {% resources type: "Meta" %} diff --git a/src/Themes/VuetifyTheme/package-lock.json b/src/Themes/VuetifyTheme/package-lock.json index d618de20b..5ecb86e26 100644 --- a/src/Themes/VuetifyTheme/package-lock.json +++ b/src/Themes/VuetifyTheme/package-lock.json @@ -17770,6 +17770,16 @@ "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", "dev": true }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "optional": true, + "requires": { + "color-convert": "^2.0.1" + } + }, "cacache": { "version": "13.0.1", "resolved": "https://registry.npmjs.org/cacache/-/cacache-13.0.1.tgz", @@ -17812,6 +17822,16 @@ "minipass": "^3.1.1" } }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "optional": true, + "requires": { + "has-flag": "^4.0.0" + } + }, "terser-webpack-plugin": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.3.8.tgz", @@ -17828,6 +17848,18 @@ "terser": "^4.6.12", "webpack-sources": "^1.4.3" } + }, + "vue-loader-v16": { + "version": "npm:vue-loader@16.1.0", + "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.1.0.tgz", + "integrity": "sha512-fTtCdI7VeyNK0HP4q4y9Z9ts8TUeaF+2/FjKx8CJ/7/Oem1rCX7zIJe+d+jLrVnVNQjENd3gqmANraLcdRWwnQ==", + "dev": true, + "optional": true, + "requires": { + "chalk": "^4.1.0", + "hash-sum": "^2.0.0", + "loader-utils": "^2.0.0" + } } } }, @@ -18580,6 +18612,16 @@ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dev": true, + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -21334,6 +21376,13 @@ "schema-utils": "^2.5.0" } }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true, + "optional": true + }, "filesize": { "version": "3.6.1", "resolved": "https://registry.npmjs.org/filesize/-/filesize-3.6.1.tgz", @@ -23459,6 +23508,13 @@ "thenify-all": "^1.0.0" } }, + "nan": { + "version": "2.14.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz", + "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==", + "dev": true, + "optional": true + }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -27346,7 +27402,11 @@ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "dev": true, - "optional": true + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + } }, "glob-parent": { "version": "3.1.0", @@ -27657,7 +27717,11 @@ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "dev": true, - "optional": true + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + } }, "glob-parent": { "version": "3.1.0",