
To better align with commonly used terminology in industry renamed all references from Skin -> Theme.
92 lines
3.3 KiB
Plaintext
92 lines
3.3 KiB
Plaintext
@using Oqtane.Themes
|
|
@using Oqtane.Services
|
|
@using Oqtane.Models
|
|
@inherits ContainerBase
|
|
@inject IUriHelper UriHelper
|
|
@inject IUserService UserService
|
|
@inject IPageModuleService PageModuleService
|
|
|
|
<div class="dropdown" style="@display">
|
|
<button class="btn dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
|
|
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
|
@foreach (var action in actions)
|
|
{
|
|
<a class="dropdown-item" onclick="@(async () => await ModuleAction(action.Action))">@action.Name</a>
|
|
}
|
|
</div>
|
|
</div>
|
|
|
|
@functions {
|
|
string display = "display: none";
|
|
List<ActionViewModel> actions;
|
|
|
|
protected override void OnInit()
|
|
{
|
|
actions = new List<ActionViewModel>();
|
|
if (ModuleState.PaneModuleIndex > 0)
|
|
{
|
|
actions.Add(new ActionViewModel { Action = "up", Name = "Move Up" });
|
|
}
|
|
if (ModuleState.PaneModuleIndex < (ModuleState.PaneModuleCount - 1))
|
|
{
|
|
actions.Add(new ActionViewModel { Action = "down", Name = "Move Down" });
|
|
}
|
|
foreach (string pane in PageState.Page.Panes.Split(';'))
|
|
{
|
|
if (pane != ModuleState.Pane)
|
|
{
|
|
actions.Add(new ActionViewModel { Action = pane, Name = "Move To " + pane + " Pane" });
|
|
}
|
|
}
|
|
actions.Add(new ActionViewModel { Action = "settings", Name = "Settings" });
|
|
actions.Add(new ActionViewModel { Action = "delete", Name = "Delete" });
|
|
|
|
if (UserService.IsAuthorized(PageState.User, ModuleState.EditPermissions))
|
|
{
|
|
display = "display: inline";
|
|
}
|
|
}
|
|
|
|
protected async Task ModuleAction(string action)
|
|
{
|
|
PageModule pagemodule = new PageModule();
|
|
pagemodule.PageModuleId = ModuleState.PageModuleId;
|
|
pagemodule.PageId = ModuleState.PageId;
|
|
pagemodule.ModuleId = ModuleState.ModuleId;
|
|
pagemodule.Title = ModuleState.Title;
|
|
pagemodule.Pane = ModuleState.Pane;
|
|
pagemodule.Order = ModuleState.Order;
|
|
pagemodule.ContainerType = ModuleState.ContainerType;
|
|
|
|
string path = PageState.Page.Path + "?reload=true";
|
|
switch (action)
|
|
{
|
|
case "up":
|
|
pagemodule.Order += -1;
|
|
await PageModuleService.UpdatePageModuleAsync(pagemodule);
|
|
break;
|
|
case "down":
|
|
pagemodule.Order += 1;
|
|
await PageModuleService.UpdatePageModuleAsync(pagemodule);
|
|
break;
|
|
case "settings":
|
|
if (path == "") { path += "/"; }
|
|
path = PageState.Page.Path + "?mid=" + pagemodule.ModuleId.ToString() + "&ctl=Settings";
|
|
break;
|
|
case "delete":
|
|
await PageModuleService.DeletePageModuleAsync(pagemodule.PageModuleId);
|
|
break;
|
|
default: // move to pane
|
|
pagemodule.Pane = action;
|
|
await PageModuleService.UpdatePageModuleAsync(pagemodule);
|
|
break;
|
|
}
|
|
UriHelper.NavigateTo(PageState.Alias + path);
|
|
}
|
|
|
|
public class ActionViewModel
|
|
{
|
|
public string Action { set; get; }
|
|
public string Name { set; get; }
|
|
}
|
|
} |