From 4770daa7c60a3160ef650263d390763f22fd2f2f Mon Sep 17 00:00:00 2001 From: Leigh Pointer Date: Tue, 30 Apr 2024 19:46:10 +0200 Subject: [PATCH] Fix for Issue #4210 and part #4209 This I will work on on a different Issue --- .../Modules/Admin/Modules/Settings.razor | 2 +- .../Modules/Admin/Modules/Settings.resx | 3 + .../Themes/Controls/ModuleActionsBase.resx | 150 ++++++++++++++++++ .../Controls/Container/ModuleActionsBase.cs | 17 +- 4 files changed, 164 insertions(+), 8 deletions(-) create mode 100644 Oqtane.Client/Resources/Themes/Controls/ModuleActionsBase.resx diff --git a/Oqtane.Client/Modules/Admin/Modules/Settings.razor b/Oqtane.Client/Modules/Admin/Modules/Settings.razor index 0031c729..03102dde 100644 --- a/Oqtane.Client/Modules/Admin/Modules/Settings.razor +++ b/Oqtane.Client/Modules/Admin/Modules/Settings.razor @@ -94,7 +94,7 @@ } - + @if (_permissions != null) {
diff --git a/Oqtane.Client/Resources/Modules/Admin/Modules/Settings.resx b/Oqtane.Client/Resources/Modules/Admin/Modules/Settings.resx index b872c727..b08997ee 100644 --- a/Oqtane.Client/Resources/Modules/Admin/Modules/Settings.resx +++ b/Oqtane.Client/Resources/Modules/Admin/Modules/Settings.resx @@ -180,4 +180,7 @@ Permissions + + Permissions + \ No newline at end of file diff --git a/Oqtane.Client/Resources/Themes/Controls/ModuleActionsBase.resx b/Oqtane.Client/Resources/Themes/Controls/ModuleActionsBase.resx new file mode 100644 index 00000000..fe72e3ea --- /dev/null +++ b/Oqtane.Client/Resources/Themes/Controls/ModuleActionsBase.resx @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Delete Module + + + Export Content + + + Import Content + + + Manage Settings + + + Move Down + + + Move To Bottom + + + Move To Top + + + MoveUp + + + Publish Module + + + Unpublish Module + + \ No newline at end of file diff --git a/Oqtane.Client/Themes/Controls/Container/ModuleActionsBase.cs b/Oqtane.Client/Themes/Controls/Container/ModuleActionsBase.cs index 3ca24a69..54e01ef4 100644 --- a/Oqtane.Client/Themes/Controls/Container/ModuleActionsBase.cs +++ b/Oqtane.Client/Themes/Controls/Container/ModuleActionsBase.cs @@ -9,6 +9,8 @@ using Oqtane.Services; using Oqtane.Shared; using Oqtane.UI; using System.Net; +using static System.Runtime.InteropServices.JavaScript.JSType; +using Microsoft.Extensions.Localization; // ReSharper disable UnassignedGetOnlyAutoProperty // ReSharper disable MemberCanBePrivate.Global @@ -20,6 +22,7 @@ namespace Oqtane.Themes.Controls [Inject] public NavigationManager NavigationManager { get; set; } [Inject] public IPageModuleService PageModuleService { get; set; } [Inject] public IModuleService ModuleService { get; set; } + [Inject] public IStringLocalizer Localizer { get; set; } [Parameter] public PageState PageState { get; set; } [Parameter] public Module ModuleState { get; set; } @@ -37,30 +40,30 @@ namespace Oqtane.Themes.Controls if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.PermissionList)) { - actionList.Add(new ActionViewModel { Icon = Icons.Cog, Name = "Manage Settings", Action = async (u, m) => await Settings(u, m) }); + actionList.Add(new ActionViewModel { Icon = Icons.Cog, Name = Localizer["ManageSettings"], Action = async (u, m) => await Settings(u, m) }); if (UserSecurity.ContainsRole(ModuleState.PermissionList, PermissionNames.View, RoleNames.Everyone)) { - actionList.Add(new ActionViewModel { Icon = Icons.CircleX, Name = "Unpublish Module", Action = async (s, m) => await Unpublish(s, m) }); + actionList.Add(new ActionViewModel { Icon = Icons.CircleX, Name = Localizer["UnpublishModule"], Action = async (s, m) => await Unpublish(s, m) }); } else { - actionList.Add(new ActionViewModel { Icon = Icons.CircleCheck, Name = "Publish Module", Action = async (s, m) => await Publish(s, m) }); + actionList.Add(new ActionViewModel { Icon = Icons.CircleCheck, Name = Localizer["PublishModule"], Action = async (s, m) => await Publish(s, m) }); } - actionList.Add(new ActionViewModel { Icon = Icons.Trash, Name = "Delete Module", Action = async (u, m) => await DeleteModule(u, m) }); + actionList.Add(new ActionViewModel { Icon = Icons.Trash, Name = Localizer["DeleteModule"], Action = async (u, m) => await DeleteModule(u, m) }); if (ModuleState.ModuleDefinition != null && ModuleState.ModuleDefinition.IsPortable) { actionList.Add(new ActionViewModel { Name = "" }); - actionList.Add(new ActionViewModel { Icon = Icons.CloudUpload, Name = "Import Content", Action = async (u, m) => await EditUrlAsync(u, m.ModuleId, "Import") }); - actionList.Add(new ActionViewModel { Icon = Icons.CloudDownload, Name = "Export Content", Action = async (u, m) => await EditUrlAsync(u, m.ModuleId, "Export") }); + actionList.Add(new ActionViewModel { Icon = Icons.CloudUpload, Name = Localizer["ImportContent"], Action = async (u, m) => await EditUrlAsync(u, m.ModuleId, "Import") }); + actionList.Add(new ActionViewModel { Icon = Icons.CloudDownload, Name = Localizer["ExportContent"], Action = async (u, m) => await EditUrlAsync(u, m.ModuleId, "Export") }); } actionList.Add(new ActionViewModel { Name = "" }); if (ModuleState.PaneModuleIndex > 0) { - actionList.Add(new ActionViewModel { Icon = Icons.DataTransferUpload, Name = "Move To Top", Action = async (s, m) => await MoveTop(s, m) }); + actionList.Add(new ActionViewModel { Icon = Icons.DataTransferUpload, Name = Localizer["MoveToTop"], Action = async (s, m) => await MoveTop(s, m) }); } if (ModuleState.PaneModuleIndex > 0)