96 lines
3.0 KiB
Plaintext
96 lines
3.0 KiB
Plaintext
@namespace Oqtane.Modules.Admin.Sites
|
|
@inherits ModuleBase
|
|
@inject NavigationManager NavigationManager
|
|
@inject ISiteService SiteService
|
|
@inject IThemeService ThemeService
|
|
|
|
@if (themes == null)
|
|
{
|
|
<p><em>Loading...</em></p>
|
|
}
|
|
else
|
|
{
|
|
<table class="table table-borderless">
|
|
<tr>
|
|
<td>
|
|
<label for="Name" class="control-label">Name: </label>
|
|
</td>
|
|
<td>
|
|
<input class="form-control" @bind="@name" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="Name" class="control-label">Logo: </label>
|
|
</td>
|
|
<td>
|
|
<input class="form-control" @bind="@logo" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="Name" class="control-label">Default Theme: </label>
|
|
</td>
|
|
<td>
|
|
<select class="form-control" @bind="@themetype">
|
|
<option value=""><Select Theme></option>
|
|
@foreach (KeyValuePair<string, string> item in themes)
|
|
{
|
|
<option value="@item.Key">@item.Value</option>
|
|
}
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="Name" class="control-label">Default Layout: </label>
|
|
</td>
|
|
<td>
|
|
<select class="form-control" @bind="@layouttype">
|
|
<option value=""><Select Layout></option>
|
|
@foreach (KeyValuePair<string, string> panelayout in panelayouts)
|
|
{
|
|
<option value="@panelayout.Key">@panelayout.Value</option>
|
|
}
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<button type="button" class="btn btn-success" @onclick="SaveSite">Save</button>
|
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
|
}
|
|
|
|
@code {
|
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
|
|
|
Dictionary<string, string> themes = new Dictionary<string, string>();
|
|
Dictionary<string, string> panelayouts = new Dictionary<string, string>();
|
|
|
|
string name = "";
|
|
string logo = "";
|
|
string themetype;
|
|
string layouttype;
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
themes = ThemeService.GetThemeTypes(PageState.Themes);
|
|
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes);
|
|
name = PageState.Site.Name;
|
|
logo = PageState.Site.Logo;
|
|
themetype = PageState.Site.DefaultThemeType;
|
|
layouttype = PageState.Site.DefaultLayoutType;
|
|
}
|
|
|
|
private async Task SaveSite()
|
|
{
|
|
Site site = PageState.Site;
|
|
site.Name = name;
|
|
site.Logo = (logo == null ? "" : logo);
|
|
site.DefaultThemeType = themetype;
|
|
site.DefaultLayoutType = (layouttype == null ? "" : layouttype);
|
|
site = await SiteService.UpdateSiteAsync(site);
|
|
|
|
NavigationManager.NavigateTo(NavigateUrl());
|
|
}
|
|
}
|