From af59ce1cd6af9d83b1e4de074252d66221fc01a1 Mon Sep 17 00:00:00 2001 From: giannik Date: Thu, 2 May 2024 21:43:45 +0300 Subject: [PATCH 1/7] load resources by name --- .../OrchardCore.Flows/ResourceManifest.cs | 30 +++++++++++++++++++ .../OrchardCore.Flows/Startup.cs | 5 ++++ .../Views/BagPart.Edit.cshtml | 9 ++---- .../Views/FlowPart.Edit.cshtml | 11 +++---- .../OrchardCore.Widgets/ResourceManifest.cs | 30 +++++++++++++++++++ .../OrchardCore.Widgets/Startup.cs | 3 ++ .../Views/WidgetsListPart.Edit.cshtml | 8 ++--- 7 files changed, 78 insertions(+), 18 deletions(-) create mode 100644 src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs create mode 100644 src/OrchardCore.Modules/OrchardCore.Widgets/ResourceManifest.cs diff --git a/src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs b/src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs new file mode 100644 index 00000000000..2d411aaf5ff --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs @@ -0,0 +1,30 @@ +using Microsoft.Extensions.Options; +using OrchardCore.ResourceManagement; + +namespace OrchardCore.Flows +{ + public class ResourceManagementOptionsConfiguration : IConfigureOptions + { + private static ResourceManifest _manifest; + + static ResourceManagementOptionsConfiguration() + { + _manifest = new ResourceManifest(); + + _manifest + .DefineStyle("flowpart-edit") + .SetUrl( "~/OrchardCore.Flows/Styles/flows.edit.min.css", "~/OrchardCore.Flows/Styles/flows.edit.css"); + _manifest + .DefineScript("flowpart-edit") + .SetDependencies("jQuery") + .SetUrl("~/OrchardCore.Flows/Scripts/flows.edit.min.js","~/OrchardCore.Flows/Scripts/flows.edit.js"); + } + + public void Configure(ResourceManagementOptions options) + { + options.ResourceManifests.Add(_manifest); + } + } + + +} diff --git a/src/OrchardCore.Modules/OrchardCore.Flows/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Flows/Startup.cs index ba65ad68400..d47abf3ed77 100644 --- a/src/OrchardCore.Modules/OrchardCore.Flows/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Flows/Startup.cs @@ -1,5 +1,6 @@ using Fluid; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentTypes.Editors; @@ -12,6 +13,7 @@ using OrchardCore.Flows.ViewModels; using OrchardCore.Indexing; using OrchardCore.Modules; +using OrchardCore.ResourceManagement; namespace OrchardCore.Flows { @@ -45,6 +47,9 @@ public override void ConfigureServices(IServiceCollection services) services.AddContentPart(); services.AddDataMigration(); + + services.AddTransient, ResourceManagementOptionsConfiguration>(); + } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Flows/Views/BagPart.Edit.cshtml b/src/OrchardCore.Modules/OrchardCore.Flows/Views/BagPart.Edit.cshtml index 9f16578c2a8..cc995e5b7ce 100644 --- a/src/OrchardCore.Modules/OrchardCore.Flows/Views/BagPart.Edit.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Flows/Views/BagPart.Edit.cshtml @@ -97,12 +97,9 @@ @if (Context.Items["BagPart.Edit"] == null) { Context.Items["BagPart.Edit"] = new object(); - - - + + + } @* Rendered only once per type to initialize the scripts its editor will need *@ diff --git a/src/OrchardCore.Modules/OrchardCore.Flows/Views/FlowPart.Edit.cshtml b/src/OrchardCore.Modules/OrchardCore.Flows/Views/FlowPart.Edit.cshtml index bdb55b5176c..9cee6127c56 100644 --- a/src/OrchardCore.Modules/OrchardCore.Flows/Views/FlowPart.Edit.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Flows/Views/FlowPart.Edit.cshtml @@ -101,13 +101,10 @@ var contentItem = await ContentManager.NewAsync(type.Name); await DisplayAsync(await ContentItemDisplayManager.BuildEditorAsync(contentItem, Model.Updater, true, "", Guid.NewGuid().ToString("n"))); } - - - - + + + + } - + + + } From 36ec36ba7a1faf555bf55d40376a42123434d7f3 Mon Sep 17 00:00:00 2001 From: yk Date: Thu, 2 May 2024 22:34:59 +0300 Subject: [PATCH 2/7] Update src/OrchardCore.Modules/OrchardCore.Flows/Startup.cs Co-authored-by: Mike Alhayek --- src/OrchardCore.Modules/OrchardCore.Flows/Startup.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Flows/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Flows/Startup.cs index d47abf3ed77..345d6c3b93e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Flows/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Flows/Startup.cs @@ -49,7 +49,6 @@ public override void ConfigureServices(IServiceCollection services) services.AddDataMigration(); services.AddTransient, ResourceManagementOptionsConfiguration>(); - } } } From 8d2b062aa7bda0a471c0e0fe34ec4284047e6567 Mon Sep 17 00:00:00 2001 From: yk Date: Thu, 2 May 2024 22:35:07 +0300 Subject: [PATCH 3/7] Update src/OrchardCore.Modules/OrchardCore.Widgets/ResourceManifest.cs Co-authored-by: Mike Alhayek --- src/OrchardCore.Modules/OrchardCore.Widgets/ResourceManifest.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Widgets/ResourceManifest.cs b/src/OrchardCore.Modules/OrchardCore.Widgets/ResourceManifest.cs index ae0e54af4e2..f7082abf4ef 100644 --- a/src/OrchardCore.Modules/OrchardCore.Widgets/ResourceManifest.cs +++ b/src/OrchardCore.Modules/OrchardCore.Widgets/ResourceManifest.cs @@ -25,6 +25,4 @@ public void Configure(ResourceManagementOptions options) options.ResourceManifests.Add(_manifest); } } - - } From 380ca815bacf60fb1340b9769286b320e1676b14 Mon Sep 17 00:00:00 2001 From: yk Date: Thu, 2 May 2024 22:35:26 +0300 Subject: [PATCH 4/7] Update src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs Co-authored-by: Mike Alhayek --- src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs b/src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs index 2d411aaf5ff..23872d96757 100644 --- a/src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs +++ b/src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs @@ -25,6 +25,4 @@ public void Configure(ResourceManagementOptions options) options.ResourceManifests.Add(_manifest); } } - - } From 21f9fbd0892258833c0739e2641e19622cd4dd10 Mon Sep 17 00:00:00 2001 From: giannik Date: Thu, 2 May 2024 22:48:45 +0300 Subject: [PATCH 5/7] file scoped namespace --- .../OrchardCore.Flows/ResourceManifest.cs | 7 ++----- .../OrchardCore.Widgets/ResourceManifest.cs | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs b/src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs index 2d411aaf5ff..a02678d4024 100644 --- a/src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs +++ b/src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs @@ -1,8 +1,8 @@ using Microsoft.Extensions.Options; using OrchardCore.ResourceManagement; -namespace OrchardCore.Flows -{ +namespace OrchardCore.Flows; + public class ResourceManagementOptionsConfiguration : IConfigureOptions { private static ResourceManifest _manifest; @@ -25,6 +25,3 @@ public void Configure(ResourceManagementOptions options) options.ResourceManifests.Add(_manifest); } } - - -} diff --git a/src/OrchardCore.Modules/OrchardCore.Widgets/ResourceManifest.cs b/src/OrchardCore.Modules/OrchardCore.Widgets/ResourceManifest.cs index ae0e54af4e2..ece5fbc4227 100644 --- a/src/OrchardCore.Modules/OrchardCore.Widgets/ResourceManifest.cs +++ b/src/OrchardCore.Modules/OrchardCore.Widgets/ResourceManifest.cs @@ -1,8 +1,8 @@ using Microsoft.Extensions.Options; using OrchardCore.ResourceManagement; -namespace OrchardCore.Widgets -{ +namespace OrchardCore.Widgets; + public class ResourceManagementOptionsConfiguration : IConfigureOptions { private static ResourceManifest _manifest; @@ -25,6 +25,3 @@ public void Configure(ResourceManagementOptions options) options.ResourceManifests.Add(_manifest); } } - - -} From 8489c5db4d18415f871907af94c5f2debdcd8ca8 Mon Sep 17 00:00:00 2001 From: giannik Date: Thu, 2 May 2024 22:51:21 +0300 Subject: [PATCH 6/7] file scoped namespaces --- .../OrchardCore.Flows/ResourceManifest.cs | 6 +++--- .../OrchardCore.Widgets/ResourceManifest.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs b/src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs index 23872d96757..d89597a70d6 100644 --- a/src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs +++ b/src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs @@ -1,8 +1,8 @@ using Microsoft.Extensions.Options; using OrchardCore.ResourceManagement; -namespace OrchardCore.Flows -{ +namespace OrchardCore.Flows; + public class ResourceManagementOptionsConfiguration : IConfigureOptions { private static ResourceManifest _manifest; @@ -25,4 +25,4 @@ public void Configure(ResourceManagementOptions options) options.ResourceManifests.Add(_manifest); } } -} + diff --git a/src/OrchardCore.Modules/OrchardCore.Widgets/ResourceManifest.cs b/src/OrchardCore.Modules/OrchardCore.Widgets/ResourceManifest.cs index f7082abf4ef..295e3df9eb0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Widgets/ResourceManifest.cs +++ b/src/OrchardCore.Modules/OrchardCore.Widgets/ResourceManifest.cs @@ -1,8 +1,8 @@ using Microsoft.Extensions.Options; using OrchardCore.ResourceManagement; -namespace OrchardCore.Widgets -{ +namespace OrchardCore.Widgets; + public class ResourceManagementOptionsConfiguration : IConfigureOptions { private static ResourceManifest _manifest; @@ -25,4 +25,4 @@ public void Configure(ResourceManagementOptions options) options.ResourceManifests.Add(_manifest); } } -} + From 22d88c9d5728c6f4960fc7e9462a0cbcda595167 Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Thu, 2 May 2024 18:15:48 -0700 Subject: [PATCH 7/7] fix formatting --- .../OrchardCore.Flows/ResourceManifest.cs | 38 +++++++++---------- .../OrchardCore.Widgets/ResourceManifest.cs | 38 +++++++++---------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs b/src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs index d89597a70d6..644220017c0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs +++ b/src/OrchardCore.Modules/OrchardCore.Flows/ResourceManifest.cs @@ -3,26 +3,26 @@ namespace OrchardCore.Flows; - public class ResourceManagementOptionsConfiguration : IConfigureOptions - { - private static ResourceManifest _manifest; - - static ResourceManagementOptionsConfiguration() - { - _manifest = new ResourceManifest(); +public class ResourceManagementOptionsConfiguration : IConfigureOptions +{ + private static ResourceManifest _manifest; - _manifest - .DefineStyle("flowpart-edit") - .SetUrl( "~/OrchardCore.Flows/Styles/flows.edit.min.css", "~/OrchardCore.Flows/Styles/flows.edit.css"); - _manifest - .DefineScript("flowpart-edit") - .SetDependencies("jQuery") - .SetUrl("~/OrchardCore.Flows/Scripts/flows.edit.min.js","~/OrchardCore.Flows/Scripts/flows.edit.js"); - } + static ResourceManagementOptionsConfiguration() + { + _manifest = new ResourceManifest(); - public void Configure(ResourceManagementOptions options) - { - options.ResourceManifests.Add(_manifest); - } + _manifest + .DefineStyle("flowpart-edit") + .SetUrl( "~/OrchardCore.Flows/Styles/flows.edit.min.css", "~/OrchardCore.Flows/Styles/flows.edit.css"); + + _manifest + .DefineScript("flowpart-edit") + .SetDependencies("jQuery") + .SetUrl("~/OrchardCore.Flows/Scripts/flows.edit.min.js","~/OrchardCore.Flows/Scripts/flows.edit.js"); } + public void Configure(ResourceManagementOptions options) + { + options.ResourceManifests.Add(_manifest); + } +} diff --git a/src/OrchardCore.Modules/OrchardCore.Widgets/ResourceManifest.cs b/src/OrchardCore.Modules/OrchardCore.Widgets/ResourceManifest.cs index 295e3df9eb0..aa5c13e8d85 100644 --- a/src/OrchardCore.Modules/OrchardCore.Widgets/ResourceManifest.cs +++ b/src/OrchardCore.Modules/OrchardCore.Widgets/ResourceManifest.cs @@ -3,26 +3,26 @@ namespace OrchardCore.Widgets; - public class ResourceManagementOptionsConfiguration : IConfigureOptions - { - private static ResourceManifest _manifest; - - static ResourceManagementOptionsConfiguration() - { - _manifest = new ResourceManifest(); +public class ResourceManagementOptionsConfiguration : IConfigureOptions +{ + private static ResourceManifest _manifest; - _manifest - .DefineStyle("widgetslist-edit") - .SetUrl( "~/OrchardCore.Widgets/Styles/widgetslist.edit.min.css", "~/OrchardCore.Widgets/Styles/widgetslist.edit.css"); - _manifest - .DefineScript("widgetslist-edit") - .SetDependencies("jQuery") - .SetUrl("~/OrchardCore.Widgets/Scripts/widgetslist.edit.min.js","~/OrchardCore.Widgets/Scripts/widgetslist.edit.js"); - } + static ResourceManagementOptionsConfiguration() + { + _manifest = new ResourceManifest(); - public void Configure(ResourceManagementOptions options) - { - options.ResourceManifests.Add(_manifest); - } + _manifest + .DefineStyle("widgetslist-edit") + .SetUrl( "~/OrchardCore.Widgets/Styles/widgetslist.edit.min.css", "~/OrchardCore.Widgets/Styles/widgetslist.edit.css"); + + _manifest + .DefineScript("widgetslist-edit") + .SetDependencies("jQuery") + .SetUrl("~/OrchardCore.Widgets/Scripts/widgetslist.edit.min.js","~/OrchardCore.Widgets/Scripts/widgetslist.edit.js"); } + public void Configure(ResourceManagementOptions options) + { + options.ResourceManifests.Add(_manifest); + } +}