Merge pull request #3788 from sbwalker/dev
force ModuleActions to interactive render mode
This commit is contained in:
commit
e33fc1a89b
@ -1,45 +1,15 @@
|
|||||||
@namespace Oqtane.Themes.Controls
|
@namespace Oqtane.Themes.Controls
|
||||||
@inherits ModuleActionsBase
|
@inherits ContainerBase
|
||||||
@attribute [OqtaneIgnore]
|
@attribute [OqtaneIgnore]
|
||||||
|
|
||||||
@if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.PermissionList) && PageState.Action == Constants.DefaultAction)
|
@if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.PermissionList) && PageState.Action == Constants.DefaultAction)
|
||||||
{
|
{
|
||||||
<div class="app-moduleactions py-2 px-3">
|
@if (PageState.Site.RenderMode == RenderModes.Interactive)
|
||||||
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"></a>
|
{
|
||||||
<ul class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 37px, 0px);" role="button">
|
<ModuleActionsInteractive PageState="@PageState" ModuleState="@ModuleState" />
|
||||||
@foreach (var action in Actions.Where(item => !item.Name.Contains("Pane")))
|
}
|
||||||
{
|
else
|
||||||
if (string.IsNullOrEmpty(action.Name))
|
{
|
||||||
{
|
<ModuleActionsInteractive PageState="@PageState" ModuleState="@ModuleState" @rendermode="@InteractiveRenderMode.GetInteractiveRenderMode(PageState.Site.Runtime, PageState.Site.Prerender)" />
|
||||||
<li class="dropdown-divider"></li>
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<li>
|
|
||||||
<a class="dropdown-item" @onclick="(async () => await ModuleAction(action))">
|
|
||||||
<span class="@action.Icon" aria-hidden="true"></span> @action.Name
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@if (Actions.Where(item => item.Name.Contains("Pane")).Any())
|
|
||||||
{
|
|
||||||
<li class="dropdown-submenu">
|
|
||||||
<a class="dropdown-item" onclick="return subMenu(this)">
|
|
||||||
<span class="@Icons.AccountLogin" aria-hidden="true"></span> Move To >
|
|
||||||
</a>
|
|
||||||
<ul class="dropdown-menu">
|
|
||||||
@foreach (var action in Actions.Where(item => item.Name.Contains("Pane")))
|
|
||||||
{
|
|
||||||
<li>
|
|
||||||
<a class="dropdown-item" @onclick="(async () => await ModuleAction(action))">
|
|
||||||
<span class="@action.Icon" aria-hidden="true"></span> @action.Name
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
}
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
|
@ -7,18 +7,22 @@ using Oqtane.Models;
|
|||||||
using Oqtane.Security;
|
using Oqtane.Security;
|
||||||
using Oqtane.Services;
|
using Oqtane.Services;
|
||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
|
using Oqtane.UI;
|
||||||
|
|
||||||
// ReSharper disable UnassignedGetOnlyAutoProperty
|
// ReSharper disable UnassignedGetOnlyAutoProperty
|
||||||
// ReSharper disable MemberCanBePrivate.Global
|
// ReSharper disable MemberCanBePrivate.Global
|
||||||
|
|
||||||
namespace Oqtane.Themes.Controls
|
namespace Oqtane.Themes.Controls
|
||||||
{
|
{
|
||||||
public class ModuleActionsBase : ContainerBase
|
public class ModuleActionsBase : ComponentBase
|
||||||
{
|
{
|
||||||
[Inject] public NavigationManager NavigationManager { get; set; }
|
[Inject] public NavigationManager NavigationManager { get; set; }
|
||||||
[Inject] public IPageModuleService PageModuleService { get; set; }
|
[Inject] public IPageModuleService PageModuleService { get; set; }
|
||||||
[Inject] public IModuleService ModuleService { get; set; }
|
[Inject] public IModuleService ModuleService { get; set; }
|
||||||
|
|
||||||
|
[Parameter] public PageState PageState { get; set; }
|
||||||
|
[Parameter] public Module ModuleState { get; set; }
|
||||||
|
|
||||||
public List<ActionViewModel> Actions;
|
public List<ActionViewModel> Actions;
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
@ -88,7 +92,7 @@ namespace Oqtane.Themes.Controls
|
|||||||
private async Task<string> EditUrlAsync(string url, int moduleId, string import)
|
private async Task<string> EditUrlAsync(string url, int moduleId, string import)
|
||||||
{
|
{
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
return EditUrl(moduleId, import);
|
return Utilities.EditUrl(PageState.Alias.Path, PageState.Page.Path, moduleId, import, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task ModuleAction(ActionViewModel action)
|
protected async Task ModuleAction(ActionViewModel action)
|
||||||
@ -97,7 +101,7 @@ namespace Oqtane.Themes.Controls
|
|||||||
{
|
{
|
||||||
PageModule pagemodule = await PageModuleService.GetPageModuleAsync(ModuleState.PageModuleId);
|
PageModule pagemodule = await PageModuleService.GetPageModuleAsync(ModuleState.PageModuleId);
|
||||||
|
|
||||||
string url = NavigateUrl(true);
|
string url = Utilities.NavigateUrl(PageState.Alias.Path, PageState.Page.Path, "refresh");
|
||||||
|
|
||||||
if (action.Action != null)
|
if (action.Action != null)
|
||||||
{
|
{
|
||||||
@ -130,7 +134,7 @@ namespace Oqtane.Themes.Controls
|
|||||||
private async Task<string> Settings(string url, PageModule pagemodule)
|
private async Task<string> Settings(string url, PageModule pagemodule)
|
||||||
{
|
{
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
url = EditUrl(pagemodule.ModuleId, "Settings");
|
url = Utilities.EditUrl(PageState.Alias.Path, PageState.Page.Path, pagemodule.ModuleId, "Settings", "");
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
@namespace Oqtane.Themes.Controls
|
||||||
|
@inherits ModuleActionsBase
|
||||||
|
@attribute [OqtaneIgnore]
|
||||||
|
|
||||||
|
<div class="app-moduleactions py-2 px-3">
|
||||||
|
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"></a>
|
||||||
|
<ul class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 37px, 0px);" role="button">
|
||||||
|
@foreach (var action in Actions.Where(item => !item.Name.Contains("Pane")))
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(action.Name))
|
||||||
|
{
|
||||||
|
<li class="dropdown-divider"></li>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<li>
|
||||||
|
<a class="dropdown-item" @onclick="(async () => await ModuleAction(action))">
|
||||||
|
<span class="@action.Icon" aria-hidden="true"></span> @action.Name
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@if (Actions.Where(item => item.Name.Contains("Pane")).Any())
|
||||||
|
{
|
||||||
|
<li class="dropdown-submenu">
|
||||||
|
<a class="dropdown-item" onclick="return subMenu(this)">
|
||||||
|
<span class="@Icons.AccountLogin" aria-hidden="true"></span> Move To >
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
@foreach (var action in Actions.Where(item => item.Name.Contains("Pane")))
|
||||||
|
{
|
||||||
|
<li>
|
||||||
|
<a class="dropdown-item" @onclick="(async () => await ModuleAction(action))">
|
||||||
|
<span class="@action.Icon" aria-hidden="true"></span> @action.Name
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
</div>
|
Loading…
x
Reference in New Issue
Block a user