Change Skin -> Theme
To better align with commonly used terminology in industry renamed all references from Skin -> Theme.
This commit is contained in:
147
Oqtane.Client/Themes/Controls/ControlPanel.razor
Normal file
147
Oqtane.Client/Themes/Controls/ControlPanel.razor
Normal file
@ -0,0 +1,147 @@
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Oqtane.Services
|
||||
@using Oqtane.Models
|
||||
@using Oqtane.Themes
|
||||
@using Oqtane.Shared
|
||||
@inherits ThemeObjectBase
|
||||
@inject IUriHelper UriHelper
|
||||
@inject IUserService UserService
|
||||
@inject IModuleDefinitionService ModuleDefinitionService
|
||||
@inject IThemeService ThemeService
|
||||
@inject IModuleService ModuleService
|
||||
@inject IPageModuleService PageModuleService
|
||||
|
||||
<div id="actions" class="overlay">
|
||||
<a href="javascript:void(0)" class="closebtn" onclick="closeActions()">x</a>
|
||||
<div class="overlay-content">
|
||||
<ul class="nav flex-column">
|
||||
<li class="nav-item px-3">
|
||||
<NavLink class="btn btn-primary" href="@PageUrl("Add")" Match="NavLinkMatch.All">Add Page</NavLink>
|
||||
</li>
|
||||
<li class="nav-item px-3">
|
||||
<NavLink class="btn btn-primary" href="@PageUrl("Edit")" Match="NavLinkMatch.All">Edit Page</NavLink>
|
||||
</li>
|
||||
<li class="nav-item px-3">
|
||||
<NavLink class="btn btn-primary" href="@PageUrl("Delete")" Match="NavLinkMatch.All">Delete Page</NavLink>
|
||||
</li>
|
||||
</ul>
|
||||
<hr style="width: 100%; color: white; height: 1px; background-color:white;" />
|
||||
<div class="container">
|
||||
<div class="form-group">
|
||||
<label for="Module" class="control-label" style="color: white !important;">Module: </label>
|
||||
@if (moduledefinitions != null)
|
||||
{
|
||||
<select class="form-control" bind="@moduledefinitionname">
|
||||
<option value=""><Select Module></option>
|
||||
@foreach (var moduledefinition in moduledefinitions)
|
||||
{
|
||||
<option value="@moduledefinition.ModuleDefinitionName">@moduledefinition.Name</option>
|
||||
}
|
||||
</select>
|
||||
}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="Pane" class="control-label" style="color: white !important;">Pane: </label>
|
||||
<select class="form-control" bind="@pane">
|
||||
<option value=""><Select Pane></option>
|
||||
@foreach (string pane in PageState.Page.Panes.Split(';'))
|
||||
{
|
||||
<option value="@pane">@pane Pane</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="Title" class="control-label" style="color: white !important;">Title: </label>
|
||||
<input type="text" name="Title" class="form-control" bind="@title" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="Container" class="control-label" style="color: white !important;">Container: </label>
|
||||
<select class="form-control" bind="@containertype">
|
||||
<option value=""><Select Container></option>
|
||||
@foreach (KeyValuePair<string, string> container in containers)
|
||||
{
|
||||
<option value="@container.Key">@container.Value</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary" onclick="@AddModule">Add Module To Page</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<span class="oi oi-menu" style="@display" onclick="openActions()"></span>
|
||||
|
||||
@functions {
|
||||
string display = "display: none";
|
||||
List<ModuleDefinition> moduledefinitions;
|
||||
Dictionary<string, string> containers = new Dictionary<string, string>();
|
||||
int pagemanagementmoduleid;
|
||||
string moduledefinitionname;
|
||||
string pane;
|
||||
string title = "";
|
||||
string containertype;
|
||||
|
||||
protected override async Task OnInitAsync()
|
||||
{
|
||||
//TODO: Move this to shared component. This is used in this control Add, Edit, and Delete controls as well
|
||||
moduledefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync();
|
||||
List<Theme> themes = await ThemeService.GetThemesAsync();
|
||||
foreach (Theme theme in themes)
|
||||
{
|
||||
foreach (string container in theme.ContainerControls.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
containers.Add(container, theme.Name + " - " + @Utilities.GetTypeNameClass(container));
|
||||
}
|
||||
}
|
||||
List<Module> modules = await ModuleService.GetModulesAsync(PageState.Site.SiteId, Constants.PageManagementModule);
|
||||
pagemanagementmoduleid = modules.FirstOrDefault().ModuleId;
|
||||
if (UserService.IsAuthorized(PageState.User, PageState.Page.EditPermissions))
|
||||
{
|
||||
display = "display: inline";
|
||||
}
|
||||
}
|
||||
|
||||
private async Task AddModule()
|
||||
{
|
||||
Module module = new Module();
|
||||
module.SiteId = PageState.Site.SiteId;
|
||||
module.ModuleDefinitionName = moduledefinitionname;
|
||||
module.ViewPermissions = PageState.Page.ViewPermissions;
|
||||
module.EditPermissions = PageState.Page.EditPermissions;
|
||||
await ModuleService.AddModuleAsync(module);
|
||||
|
||||
List<Module> modules = await ModuleService.GetModulesAsync(PageState.Site.SiteId, moduledefinitionname);
|
||||
int ModuleId = modules.LastOrDefault().ModuleId;
|
||||
|
||||
PageModule pagemodule = new PageModule();
|
||||
pagemodule.PageId = PageState.Page.PageId;
|
||||
pagemodule.ModuleId = ModuleId;
|
||||
if (title == "")
|
||||
{
|
||||
title = moduledefinitions.Where(item => item.ModuleDefinitionName == moduledefinitionname).FirstOrDefault().Name;
|
||||
}
|
||||
pagemodule.Title = title;
|
||||
pagemodule.Pane = pane;
|
||||
pagemodule.Order = 0;
|
||||
pagemodule.ContainerType = containertype;
|
||||
await PageModuleService.AddPageModuleAsync(pagemodule);
|
||||
UriHelper.NavigateTo(PageState.Alias + PageState.Page.Path + "?reload=true");
|
||||
}
|
||||
|
||||
private string PageUrl(string action)
|
||||
{
|
||||
string url = "";
|
||||
switch (action)
|
||||
{
|
||||
case "Add":
|
||||
url = "admin/pages?mid=" + pagemanagementmoduleid.ToString() + "&ctl=" + action;
|
||||
break;
|
||||
case "Edit":
|
||||
url = "admin/pages?mid=" + pagemanagementmoduleid.ToString() + "&ctl=" + action + "&id=" + PageState.Page.PageId.ToString();
|
||||
break;
|
||||
case "Delete":
|
||||
url = "admin/pages?mid=" + pagemanagementmoduleid.ToString() + "&ctl=" + action + "&id=" + PageState.Page.PageId.ToString();
|
||||
break;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user