
Centralized the code used to determine the available themes, panes, and containers. This isn't the most "ideal" way to handle this. However, it does improve the management of the code by centralizing the logic for theme selection. Future PR's development might improve this more.
110 lines
3.6 KiB
Plaintext
110 lines
3.6 KiB
Plaintext
@using Microsoft.AspNetCore.Components.Routing
|
|
@using Oqtane.Services
|
|
@using Oqtane.Models
|
|
@using Oqtane.Modules
|
|
@using Oqtane.Shared
|
|
@using Oqtane.Client.Modules.Controls
|
|
@inherits ModuleBase
|
|
@inject IUriHelper UriHelper
|
|
@inject IThemeService ThemeService
|
|
@inject IModuleService ModuleService
|
|
@inject IPageModuleService PageModuleService
|
|
|
|
<table class="form-group">
|
|
<tr>
|
|
<td>
|
|
<label for="Title" class="control-label">Title: </label>
|
|
</td>
|
|
<td>
|
|
<input type="text" name="Title" class="form-control" bind="@title" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="Container" class="control-label">Container: </label>
|
|
</td>
|
|
<td>
|
|
<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>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="ViewPermissions" class="control-label">View Permissions: </label>
|
|
</td>
|
|
<td>
|
|
<input type="text" name="ViewPermissions" class="form-control" bind="@viewpermissions" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="EditPermissions" class="control-label">Edit Permissions: </label>
|
|
</td>
|
|
<td>
|
|
<input type="text" name="EditPermissions" class="form-control" bind="@editpermissions" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="Page" class="control-label">Page: </label>
|
|
</td>
|
|
<td>
|
|
<select class="form-control" bind="@pageid">
|
|
@foreach (Page p in PageState.Pages)
|
|
{
|
|
<option value="@p.PageId">@p.Name</option>
|
|
}
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<button class="btn btn-success" onclick="@SaveModule">Save</button>
|
|
<NavLink class="btn btn" href="@NavigateUrl()">Cancel</NavLink>
|
|
|
|
@functions {
|
|
public override SecurityAccessLevelEnum SecurityAccessLevel { get { return SecurityAccessLevelEnum.Edit; } }
|
|
public override string Title { get { return "Module Settings"; } }
|
|
|
|
Dictionary<string, string> containers = new Dictionary<string, string>();
|
|
string title;
|
|
string containertype;
|
|
string viewpermissions;
|
|
string editpermissions;
|
|
string pageid;
|
|
|
|
protected override async Task OnInitAsync()
|
|
{
|
|
title = ModuleState.Title;
|
|
containers = ThemeService.CalculateSelectableContainers(await ThemeService.GetThemesAsync());
|
|
containertype = ModuleState.ContainerType;
|
|
viewpermissions = ModuleState.ViewPermissions;
|
|
editpermissions = ModuleState.EditPermissions;
|
|
pageid = ModuleState.PageId.ToString();
|
|
}
|
|
|
|
private async Task SaveModule()
|
|
{
|
|
Module module = ModuleState;
|
|
module.ViewPermissions = viewpermissions;
|
|
module.EditPermissions = editpermissions;
|
|
await ModuleService.UpdateModuleAsync(module);
|
|
|
|
PageModule pagemodule = new PageModule();
|
|
pagemodule.PageModuleId = ModuleState.PageModuleId;
|
|
pagemodule.PageId = Int32.Parse(pageid);
|
|
pagemodule.ModuleId = ModuleState.ModuleId;
|
|
pagemodule.Title = title;
|
|
pagemodule.Pane = ModuleState.Pane;
|
|
pagemodule.Order = ModuleState.Order;
|
|
pagemodule.ContainerType = containertype;
|
|
await PageModuleService.UpdatePageModuleAsync(pagemodule);
|
|
|
|
UriHelper.NavigateTo(NavigateUrl(true));
|
|
}
|
|
}
|