From d0600f94660db9f7eddc556d14bb7c454879e2d6 Mon Sep 17 00:00:00 2001 From: Hisham Bin Ateya Date: Sat, 12 Oct 2024 14:17:54 +0300 Subject: [PATCH] Add DeploymentStepDriverBase --- .../Steps/CustomFileDeploymentStepDriver.cs | 12 ++-------- .../Steps/RecipeFileDeploymentStepDriver.cs | 12 ++-------- .../FacebookLoginDeploymentStepDriver.cs | 18 ++------------- .../AllFeaturesDeploymentStepDriver.cs | 12 ++-------- .../AllLayersDeploymentStepDriver.cs | 18 ++------------- .../AllMediaProfilesDeploymentStepDriver.cs | 18 ++------------- .../Deployment/AzureADDeploymentStepDriver.cs | 18 ++------------- .../MicrosoftAccountDeploymentStepDriver.cs | 15 ++----------- .../OpenIdServerDeploymentStepDriver.cs | 18 ++------------- .../OpenIdValidationDeploymentStepDriver.cs | 18 ++------------- .../PlacementsDeploymentStepDriver.cs | 18 ++------------- .../AllQueriesDeploymentStepDriver.cs | 18 ++------------- .../AllRolesDeploymentStepDriver.cs | 18 ++------------- ...lShortcodeTemplatesDeploymentStepDriver.cs | 18 ++------------- .../AllSitemapsDeploymentStepDriver.cs | 18 ++------------- .../AllAdminTemplatesDeploymentStepDriver.cs | 12 ++-------- .../AllTemplatesDeploymentStepDriver.cs | 12 ++-------- .../AllFeatureProfilesDeploymentStepDriver.cs | 18 ++------------- .../Deployment/ThemesDeploymentStepDriver.cs | 17 ++------------ .../AllUsersDeploymentStepDriver.cs | 16 ++------------ .../DeploymentStepDriverBase.cs | 22 +++++++++++++++++++ 21 files changed, 62 insertions(+), 284 deletions(-) create mode 100644 src/OrchardCore/OrchardCore.Deployment.Abstractions/DeploymentStepDriverBase.cs diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment/Steps/CustomFileDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.Deployment/Steps/CustomFileDeploymentStepDriver.cs index f91be54c9dfe..0cd8e70b2f74 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment/Steps/CustomFileDeploymentStepDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment/Steps/CustomFileDeploymentStepDriver.cs @@ -4,17 +4,9 @@ namespace OrchardCore.Deployment.Steps; -public sealed class CustomFileDeploymentStepDriver : DisplayDriver +public sealed class CustomFileDeploymentStepDriver + : DeploymentStepDriverBase { - public override Task DisplayAsync(CustomFileDeploymentStep step, BuildDisplayContext context) - { - return - CombineAsync( - View("CustomFileDeploymentStep_Fields_Summary", step).Location("Summary", "Content"), - View("CustomFileDeploymentStep_Fields_Thumbnail", step).Location("Thumbnail", "Content") - ); - } - public override IDisplayResult Edit(CustomFileDeploymentStep step, BuildEditorContext context) { return Initialize("CustomFileDeploymentStep_Fields_Edit", model => diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment/Steps/RecipeFileDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.Deployment/Steps/RecipeFileDeploymentStepDriver.cs index 90b10e20ba71..caa51f7f8166 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment/Steps/RecipeFileDeploymentStepDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment/Steps/RecipeFileDeploymentStepDriver.cs @@ -4,17 +4,9 @@ namespace OrchardCore.Deployment.Steps; -public sealed class RecipeFileDeploymentStepDriver : DisplayDriver +public sealed class RecipeFileDeploymentStepDriver + : DeploymentStepDriverBase { - public override Task DisplayAsync(RecipeFileDeploymentStep step, BuildDisplayContext context) - { - return - CombineAsync( - View("RecipeFileDeploymentStep_Fields_Summary", step).Location("Summary", "Content"), - View("RecipeFileDeploymentStep_Fields_Thumbnail", step).Location("Thumbnail", "Content") - ); - } - public override IDisplayResult Edit(RecipeFileDeploymentStep step, BuildEditorContext context) { return Initialize("RecipeFileDeploymentStep_Fields_Edit", model => diff --git a/src/OrchardCore.Modules/OrchardCore.Facebook/Deployment/FacebookLoginDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.Facebook/Deployment/FacebookLoginDeploymentStepDriver.cs index 67eed1723d23..547a162807cc 100644 --- a/src/OrchardCore.Modules/OrchardCore.Facebook/Deployment/FacebookLoginDeploymentStepDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Facebook/Deployment/FacebookLoginDeploymentStepDriver.cs @@ -1,22 +1,8 @@ using OrchardCore.Deployment; -using OrchardCore.DisplayManagement.Handlers; -using OrchardCore.DisplayManagement.Views; namespace OrchardCore.Facebook.Deployment; -public sealed class FacebookLoginDeploymentStepDriver : DisplayDriver +public sealed class FacebookLoginDeploymentStepDriver + : DeploymentStepDriverBase { - public override Task DisplayAsync(FacebookLoginDeploymentStep step, BuildDisplayContext context) - { - return - CombineAsync( - View("FacebookLoginDeploymentStep_Summary", step).Location("Summary", "Content"), - View("FacebookLoginDeploymentStep_Thumbnail", step).Location("Thumbnail", "Content") - ); - } - - public override IDisplayResult Edit(FacebookLoginDeploymentStep step, BuildEditorContext context) - { - return View("FacebookLoginDeploymentStep_Edit", step).Location("Content"); - } } diff --git a/src/OrchardCore.Modules/OrchardCore.Features/Deployment/AllFeaturesDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.Features/Deployment/AllFeaturesDeploymentStepDriver.cs index c6c61167340b..62138d9344c2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Features/Deployment/AllFeaturesDeploymentStepDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Features/Deployment/AllFeaturesDeploymentStepDriver.cs @@ -5,17 +5,9 @@ namespace OrchardCore.Features.Deployment; -public sealed class AllFeaturesDeploymentStepDriver : DisplayDriver +public sealed class AllFeaturesDeploymentStepDriver + : DeploymentStepFieldsDriverBase { - public override Task DisplayAsync(AllFeaturesDeploymentStep step, BuildDisplayContext context) - { - return - CombineAsync( - View("AllFeaturesDeploymentStep_Fields_Summary", step).Location("Summary", "Content"), - View("AllFeaturesDeploymentStep_Fields_Thumbnail", step).Location("Thumbnail", "Content") - ); - } - public override IDisplayResult Edit(AllFeaturesDeploymentStep step, BuildEditorContext context) { return Initialize("AllFeaturesDeploymentStep_Fields_Edit", model => diff --git a/src/OrchardCore.Modules/OrchardCore.Layers/Deployment/AllLayersDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.Layers/Deployment/AllLayersDeploymentStepDriver.cs index e37067fa6257..bda1c7e46eb9 100644 --- a/src/OrchardCore.Modules/OrchardCore.Layers/Deployment/AllLayersDeploymentStepDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Layers/Deployment/AllLayersDeploymentStepDriver.cs @@ -1,22 +1,8 @@ using OrchardCore.Deployment; -using OrchardCore.DisplayManagement.Handlers; -using OrchardCore.DisplayManagement.Views; namespace OrchardCore.Layers.Deployment; -public sealed class AllLayersDeploymentStepDriver : DisplayDriver +public sealed class AllLayersDeploymentStepDriver + : DeploymentStepDriverBase { - public override Task DisplayAsync(AllLayersDeploymentStep step, BuildDisplayContext context) - { - return - CombineAsync( - View("AllLayersDeploymentStep_Summary", step).Location("Summary", "Content"), - View("AllLayersDeploymentStep_Thumbnail", step).Location("Thumbnail", "Content") - ); - } - - public override IDisplayResult Edit(AllLayersDeploymentStep step, BuildEditorContext context) - { - return View("AllLayersDeploymentStep_Edit", step).Location("Content"); - } } diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Deployment/AllMediaProfilesDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.Media/Deployment/AllMediaProfilesDeploymentStepDriver.cs index 3091a8c106af..88aac21c284f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Deployment/AllMediaProfilesDeploymentStepDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Deployment/AllMediaProfilesDeploymentStepDriver.cs @@ -1,22 +1,8 @@ using OrchardCore.Deployment; -using OrchardCore.DisplayManagement.Handlers; -using OrchardCore.DisplayManagement.Views; namespace OrchardCore.Media.Deployment; -public sealed class AllMediaProfilesDeploymentStepDriver : DisplayDriver +public sealed class AllMediaProfilesDeploymentStepDriver + : DeploymentStepDriverBase { - public override Task DisplayAsync(AllMediaProfilesDeploymentStep step, BuildDisplayContext context) - { - return - CombineAsync( - View("AllMediaProfilesDeploymentStep_Summary", step).Location("Summary", "Content"), - View("AllMediaProfilesDeploymentStep_Thumbnail", step).Location("Thumbnail", "Content") - ); - } - - public override IDisplayResult Edit(AllMediaProfilesDeploymentStep step, BuildEditorContext context) - { - return View("AllMediaProfilesDeploymentStep_Edit", step).Location("Content"); - } } diff --git a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Deployment/AzureADDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Deployment/AzureADDeploymentStepDriver.cs index e8213176c2f6..87becde43ceb 100644 --- a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Deployment/AzureADDeploymentStepDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Deployment/AzureADDeploymentStepDriver.cs @@ -1,22 +1,8 @@ using OrchardCore.Deployment; -using OrchardCore.DisplayManagement.Handlers; -using OrchardCore.DisplayManagement.Views; namespace OrchardCore.Microsoft.Authentication.Deployment; -public sealed class AzureADDeploymentStepDriver : DisplayDriver +public sealed class AzureADDeploymentStepDriver + : DeploymentStepDriverBase { - public override Task DisplayAsync(AzureADDeploymentStep step, BuildDisplayContext context) - { - return - CombineAsync( - View("AzureADDeploymentStep_Summary", step).Location("Summary", "Content"), - View("AzureADDeploymentStep_Thumbnail", step).Location("Thumbnail", "Content") - ); - } - - public override IDisplayResult Edit(AzureADDeploymentStep step, BuildEditorContext context) - { - return View("AzureADDeploymentStep_Edit", step).Location("Content"); - } } diff --git a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Deployment/MicrosoftAccountDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Deployment/MicrosoftAccountDeploymentStepDriver.cs index d4023b17c9f8..1d4442f34d1c 100644 --- a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Deployment/MicrosoftAccountDeploymentStepDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Deployment/MicrosoftAccountDeploymentStepDriver.cs @@ -1,19 +1,8 @@ using OrchardCore.Deployment; -using OrchardCore.DisplayManagement.Handlers; -using OrchardCore.DisplayManagement.Views; namespace OrchardCore.Microsoft.Authentication.Deployment; -public sealed class MicrosoftAccountDeploymentStepDriver : DisplayDriver +public sealed class MicrosoftAccountDeploymentStepDriver + : DeploymentStepDriverBase { - public override Task DisplayAsync(MicrosoftAccountDeploymentStep step, BuildDisplayContext context) - { - return CombineAsync( - View("MicrosoftAccountDeploymentStep_Summary", step).Location("Summary", "Content"), - View("MicrosoftAccountDeploymentStep_Thumbnail", step).Location("Thumbnail", "Content") - ); - } - - public override IDisplayResult Edit(MicrosoftAccountDeploymentStep step, BuildEditorContext context) - => View("MicrosoftAccountDeploymentStep_Edit", step).Location("Content"); } diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Deployment/OpenIdServerDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Deployment/OpenIdServerDeploymentStepDriver.cs index c0a0fc514b03..d989d5c20209 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Deployment/OpenIdServerDeploymentStepDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Deployment/OpenIdServerDeploymentStepDriver.cs @@ -1,22 +1,8 @@ using OrchardCore.Deployment; -using OrchardCore.DisplayManagement.Handlers; -using OrchardCore.DisplayManagement.Views; namespace OrchardCore.OpenId.Deployment; -public sealed class OpenIdServerDeploymentStepDriver : DisplayDriver +public sealed class OpenIdServerDeploymentStepDriver + : DeploymentStepDriverBase { - public override Task DisplayAsync(OpenIdServerDeploymentStep step, BuildDisplayContext context) - { - return - CombineAsync( - View("OpenIdServerDeploymentStep_Summary", step).Location("Summary", "Content"), - View("OpenIdServerDeploymentStep_Thumbnail", step).Location("Thumbnail", "Content") - ); - } - - public override IDisplayResult Edit(OpenIdServerDeploymentStep step, BuildEditorContext context) - { - return View("OpenIdServerDeploymentStep_Edit", step).Location("Content"); - } } diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Deployment/OpenIdValidationDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Deployment/OpenIdValidationDeploymentStepDriver.cs index b880c7cd36be..e5f047fac42e 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Deployment/OpenIdValidationDeploymentStepDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Deployment/OpenIdValidationDeploymentStepDriver.cs @@ -1,22 +1,8 @@ using OrchardCore.Deployment; -using OrchardCore.DisplayManagement.Handlers; -using OrchardCore.DisplayManagement.Views; namespace OrchardCore.OpenId.Deployment; -public sealed class OpenIdValidationDeploymentStepDriver : DisplayDriver +public sealed class OpenIdValidationDeploymentStepDriver + : DeploymentStepDriverBase { - public override Task DisplayAsync(OpenIdValidationDeploymentStep step, BuildDisplayContext context) - { - return - CombineAsync( - View("OpenIdValidationDeploymentStep_Summary", step).Location("Summary", "Content"), - View("OpenIdValidationDeploymentStep_Thumbnail", step).Location("Thumbnail", "Content") - ); - } - - public override IDisplayResult Edit(OpenIdValidationDeploymentStep step, BuildEditorContext context) - { - return View("OpenIdValidationDeploymentStep_Edit", step).Location("Content"); - } } diff --git a/src/OrchardCore.Modules/OrchardCore.Placements/Deployment/PlacementsDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.Placements/Deployment/PlacementsDeploymentStepDriver.cs index 2a4b223ae0a4..3485f96a803b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Placements/Deployment/PlacementsDeploymentStepDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Placements/Deployment/PlacementsDeploymentStepDriver.cs @@ -1,22 +1,8 @@ using OrchardCore.Deployment; -using OrchardCore.DisplayManagement.Handlers; -using OrchardCore.DisplayManagement.Views; namespace OrchardCore.Placements.Deployment; -public sealed class PlacementsDeploymentStepDriver : DisplayDriver +public sealed class PlacementsDeploymentStepDriver + : DeploymentStepDriverBase { - public override Task DisplayAsync(PlacementsDeploymentStep step, BuildDisplayContext context) - { - return - CombineAsync( - View("PlacementsDeploymentStep_Summary", step).Location("Summary", "Content"), - View("PlacementsDeploymentStep_Thumbnail", step).Location("Thumbnail", "Content") - ); - } - - public override IDisplayResult Edit(PlacementsDeploymentStep step, BuildEditorContext context) - { - return View("PlacementsDeploymentStep_Edit", step).Location("Content"); - } } diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/Deployment/AllQueriesDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.Queries/Deployment/AllQueriesDeploymentStepDriver.cs index cff300c7b708..da68a3a28acc 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/Deployment/AllQueriesDeploymentStepDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/Deployment/AllQueriesDeploymentStepDriver.cs @@ -1,22 +1,8 @@ using OrchardCore.Deployment; -using OrchardCore.DisplayManagement.Handlers; -using OrchardCore.DisplayManagement.Views; namespace OrchardCore.Queries.Deployment; -public sealed class AllQueriesDeploymentStepDriver : DisplayDriver +public sealed class AllQueriesDeploymentStepDriver + : DeploymentStepDriverBase { - public override Task DisplayAsync(AllQueriesDeploymentStep step, BuildDisplayContext context) - { - return - CombineAsync( - View("AllQueriesDeploymentStep_Summary", step).Location("Summary", "Content"), - View("AllQueriesDeploymentStep_Thumbnail", step).Location("Thumbnail", "Content") - ); - } - - public override IDisplayResult Edit(AllQueriesDeploymentStep step, BuildEditorContext context) - { - return View("AllQueriesDeploymentStep_Edit", step).Location("Content"); - } } diff --git a/src/OrchardCore.Modules/OrchardCore.Roles/Deployment/AllRolesDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.Roles/Deployment/AllRolesDeploymentStepDriver.cs index 3607c36968b5..6627c821c056 100644 --- a/src/OrchardCore.Modules/OrchardCore.Roles/Deployment/AllRolesDeploymentStepDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Roles/Deployment/AllRolesDeploymentStepDriver.cs @@ -1,22 +1,8 @@ using OrchardCore.Deployment; -using OrchardCore.DisplayManagement.Handlers; -using OrchardCore.DisplayManagement.Views; namespace OrchardCore.Roles.Deployment; -public sealed class AllRolesDeploymentStepDriver : DisplayDriver +public sealed class AllRolesDeploymentStepDriver + : DeploymentStepDriverBase { - public override Task DisplayAsync(AllRolesDeploymentStep step, BuildDisplayContext context) - { - return - CombineAsync( - View("AllRolesDeploymentStep_Summary", step).Location("Summary", "Content"), - View("AllRolesDeploymentStep_Thumbnail", step).Location("Thumbnail", "Content") - ); - } - - public override IDisplayResult Edit(AllRolesDeploymentStep step, BuildEditorContext context) - { - return View("AllRolesDeploymentStep_Edit", step).Location("Content"); - } } diff --git a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Deployment/AllShortcodeTemplatesDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Deployment/AllShortcodeTemplatesDeploymentStepDriver.cs index a0802d1979e5..a514a414563d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Deployment/AllShortcodeTemplatesDeploymentStepDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Deployment/AllShortcodeTemplatesDeploymentStepDriver.cs @@ -1,22 +1,8 @@ using OrchardCore.Deployment; -using OrchardCore.DisplayManagement.Handlers; -using OrchardCore.DisplayManagement.Views; namespace OrchardCore.Shortcodes.Deployment; -public sealed class AllShortcodeTemplatesDeploymentStepDriver : DisplayDriver +public sealed class AllShortcodeTemplatesDeploymentStepDriver + : DeploymentStepDriverBase { - public override Task DisplayAsync(AllShortcodeTemplatesDeploymentStep step, BuildDisplayContext context) - { - return - CombineAsync( - View("AllShortcodeTemplatesDeploymentStep_Summary", step).Location("Summary", "Content"), - View("AllShortcodeTemplatesDeploymentStep_Thumbnail", step).Location("Thumbnail", "Content") - ); - } - - public override IDisplayResult Edit(AllShortcodeTemplatesDeploymentStep step, BuildEditorContext context) - { - return View("AllShortcodeTemplatesDeploymentStep_Edit", step).Location("Content"); - } } diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Deployment/AllSitemapsDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Deployment/AllSitemapsDeploymentStepDriver.cs index 73b328c4510b..9311bb7ab22f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Deployment/AllSitemapsDeploymentStepDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Deployment/AllSitemapsDeploymentStepDriver.cs @@ -1,22 +1,8 @@ using OrchardCore.Deployment; -using OrchardCore.DisplayManagement.Handlers; -using OrchardCore.DisplayManagement.Views; namespace OrchardCore.Sitemaps.Deployment; -public sealed class AllSitemapsDeploymentStepDriver : DisplayDriver +public sealed class AllSitemapsDeploymentStepDriver + : DeploymentStepDriverBase { - public override Task DisplayAsync(AllSitemapsDeploymentStep step, BuildDisplayContext context) - { - return - CombineAsync( - View("AllSitemapsDeploymentStep_Summary", step).Location("Summary", "Content"), - View("AllSitemapsDeploymentStep_Thumbnail", step).Location("Thumbnail", "Content") - ); - } - - public override IDisplayResult Edit(AllSitemapsDeploymentStep step, BuildEditorContext context) - { - return View("AllSitemapsDeploymentStep_Edit", step).Location("Content"); - } } diff --git a/src/OrchardCore.Modules/OrchardCore.Templates/Deployment/AllAdminTemplatesDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.Templates/Deployment/AllAdminTemplatesDeploymentStepDriver.cs index cc2a2a28caf9..cbc8706ab325 100644 --- a/src/OrchardCore.Modules/OrchardCore.Templates/Deployment/AllAdminTemplatesDeploymentStepDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Templates/Deployment/AllAdminTemplatesDeploymentStepDriver.cs @@ -5,17 +5,9 @@ namespace OrchardCore.Templates.Deployment; -public sealed class AllAdminTemplatesDeploymentStepDriver : DisplayDriver +public sealed class AllAdminTemplatesDeploymentStepDriver + : DeploymentStepDriverBase { - public override Task DisplayAsync(AllAdminTemplatesDeploymentStep step, BuildDisplayContext context) - { - return - CombineAsync( - View("AllAdminTemplatesDeploymentStep_Summary", step).Location("Summary", "Content"), - View("AllAdminTemplatesDeploymentStep_Thumbnail", step).Location("Thumbnail", "Content") - ); - } - public override IDisplayResult Edit(AllAdminTemplatesDeploymentStep step, BuildEditorContext context) { return Initialize("AllAdminTemplatesDeploymentStep_Fields_Edit", model => diff --git a/src/OrchardCore.Modules/OrchardCore.Templates/Deployment/AllTemplatesDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.Templates/Deployment/AllTemplatesDeploymentStepDriver.cs index 4132b3f7054f..65c52b85b4ef 100644 --- a/src/OrchardCore.Modules/OrchardCore.Templates/Deployment/AllTemplatesDeploymentStepDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Templates/Deployment/AllTemplatesDeploymentStepDriver.cs @@ -5,17 +5,9 @@ namespace OrchardCore.Templates.Deployment; -public sealed class AllTemplatesDeploymentStepDriver : DisplayDriver +public sealed class AllTemplatesDeploymentStepDriver + : DeploymentStepDriverBase { - public override Task DisplayAsync(AllTemplatesDeploymentStep step, BuildDisplayContext context) - { - return - CombineAsync( - View("AllTemplatesDeploymentStep_Summary", step).Location("Summary", "Content"), - View("AllTemplatesDeploymentStep_Thumbnail", step).Location("Thumbnail", "Content") - ); - } - public override IDisplayResult Edit(AllTemplatesDeploymentStep step, BuildEditorContext context) { return Initialize("AllTemplatesDeploymentStep_Fields_Edit", model => diff --git a/src/OrchardCore.Modules/OrchardCore.Tenants/Deployment/AllFeatureProfilesDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.Tenants/Deployment/AllFeatureProfilesDeploymentStepDriver.cs index f7a4c6a0d22f..1ec9d0097be2 100644 --- a/src/OrchardCore.Modules/OrchardCore.Tenants/Deployment/AllFeatureProfilesDeploymentStepDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Tenants/Deployment/AllFeatureProfilesDeploymentStepDriver.cs @@ -1,22 +1,8 @@ using OrchardCore.Deployment; -using OrchardCore.DisplayManagement.Handlers; -using OrchardCore.DisplayManagement.Views; namespace OrchardCore.Tenants.Deployment; -public sealed class AllFeatureProfilesDeploymentStepDriver : DisplayDriver +public sealed class AllFeatureProfilesDeploymentStepDriver + : DeploymentStepDriverBase { - public override Task DisplayAsync(AllFeatureProfilesDeploymentStep step, BuildDisplayContext context) - { - return - CombineAsync( - View("AllFeatureProfilesDeploymentStep_Summary", step).Location("Summary", "Content"), - View("AllFeatureProfilesDeploymentStep_Thumbnail", step).Location("Thumbnail", "Content") - ); - } - - public override IDisplayResult Edit(AllFeatureProfilesDeploymentStep step, BuildEditorContext context) - { - return View("AllFeatureProfilesDeploymentStep_Edit", step).Location("Content"); - } } diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Deployment/ThemesDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.Themes/Deployment/ThemesDeploymentStepDriver.cs index 6dc6b50699bc..6600f0f9a4e9 100644 --- a/src/OrchardCore.Modules/OrchardCore.Themes/Deployment/ThemesDeploymentStepDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Themes/Deployment/ThemesDeploymentStepDriver.cs @@ -1,21 +1,8 @@ using OrchardCore.Deployment; -using OrchardCore.DisplayManagement.Handlers; -using OrchardCore.DisplayManagement.Views; namespace OrchardCore.Themes.Deployment; -public sealed class ThemesDeploymentStepDriver : DisplayDriver +public sealed class ThemesDeploymentStepDriver + : DeploymentStepDriverBase { - public override Task DisplayAsync(ThemesDeploymentStep step, BuildDisplayContext context) - { - return CombineAsync( - View("ThemesDeploymentStep_Summary", step).Location("Summary", "Content"), - View("ThemesDeploymentStep_Thumbnail", step).Location("Thumbnail", "Content") - ); - } - - public override IDisplayResult Edit(ThemesDeploymentStep step, BuildEditorContext context) - { - return View("ThemesDeploymentStep_Edit", step).Location("Content"); - } } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Deployment/AllUsersDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.Users/Deployment/AllUsersDeploymentStepDriver.cs index cf91ada8630f..c5f240246ee3 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Deployment/AllUsersDeploymentStepDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Deployment/AllUsersDeploymentStepDriver.cs @@ -1,20 +1,8 @@ using OrchardCore.Deployment; -using OrchardCore.DisplayManagement.Handlers; -using OrchardCore.DisplayManagement.Views; namespace OrchardCore.Users.Deployment; -public sealed class AllUsersDeploymentStepDriver : DisplayDriver +public sealed class AllUsersDeploymentStepDriver + : DeploymentStepDriverBase { - public override Task DisplayAsync(AllUsersDeploymentStep step, BuildDisplayContext context) - { - return CombineAsync( - View("AllUsersDeploymentStep_Summary", step).Location("Summary", "Content"), - View("AllUsersDeploymentStep_Thumbnail", step).Location("Thumbnail", "Content")); - } - - public override IDisplayResult Edit(AllUsersDeploymentStep step, BuildEditorContext context) - { - return View("AllUsersDeploymentStep_Edit", step).Location("Content"); - } } diff --git a/src/OrchardCore/OrchardCore.Deployment.Abstractions/DeploymentStepDriverBase.cs b/src/OrchardCore/OrchardCore.Deployment.Abstractions/DeploymentStepDriverBase.cs new file mode 100644 index 000000000000..5c491b88dcd8 --- /dev/null +++ b/src/OrchardCore/OrchardCore.Deployment.Abstractions/DeploymentStepDriverBase.cs @@ -0,0 +1,22 @@ +using OrchardCore.DisplayManagement.Handlers; +using OrchardCore.DisplayManagement.Views; + +namespace OrchardCore.Deployment; + +public abstract class DeploymentStepDriverBase + : DisplayDriver where TStep : DeploymentStep +{ + private readonly string _stepName = typeof(TStep).Name; + + public override Task DisplayAsync(TStep step, BuildDisplayContext context) + { + return + CombineAsync( + View($"{_stepName}_Summary", step).Location("Summary", "Content"), + View($"{_stepName}_Thumbnail", step).Location("Thumbnail", "Content") + ); + } + + public override IDisplayResult Edit(TStep step, BuildEditorContext context) + => View($"{_stepName}_Edit", step).Location("Content"); +}