Fix #2382 - Admin pane improvements
This commit is contained in:
@ -576,7 +576,21 @@
|
||||
Dictionary<string, string> settings = await SettingService.GetUserSettingsAsync(PageState.User.UserId);
|
||||
_category = SettingService.GetSetting(settings, settingCategory, "Common");
|
||||
var pane = SettingService.GetSetting(settings, settingPane, "");
|
||||
_pane = PageState.Page.Panes.Contains(pane) ? pane : PaneNames.Admin;
|
||||
if (PageState.Page.Panes.Contains(pane))
|
||||
{
|
||||
_pane = pane;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PageState.Page.Panes.Count != 0)
|
||||
{
|
||||
_pane = PageState.Page.Panes[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
_pane = PaneNames.Admin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task UpdateSettingsAsync()
|
||||
|
@ -13,11 +13,18 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<Pane Name="@PaneNames.Admin" />
|
||||
<Pane Name="@PaneNames.Default" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Pane Name="Top Full Width" />
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<Pane Name="@PaneNames.Admin" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Pane Name="Top Full Width" />
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
@ -102,13 +109,13 @@
|
||||
{
|
||||
<Pane Name="Footer" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
@code {
|
||||
public override string Name => "Default Theme";
|
||||
|
||||
public override string Panes => PaneNames.Admin + ",Top Full Width,Top 100%,Left 50%,Right 50%,Left 33%,Center 33%,Right 33%,Left Outer 25%,Left Inner 25%,Right Inner 25%,Right Outer 25%,Left 25%,Center 50%,Right 25%,Left Sidebar 66%,Right Sidebar 33%,Left Sidebar 33%,Right Sidebar 66%,Bottom 100%,Bottom Full Width,Footer";
|
||||
public override string Panes => PaneNames.Default + ",Top Full Width,Top 100%,Left 50%,Right 50%,Left 33%,Center 33%,Right 33%,Left Outer 25%,Left Inner 25%,Right Inner 25%,Right Outer 25%,Left 25%,Center 50%,Right 25%,Left Sidebar 66%,Right Sidebar 33%,Left Sidebar 33%,Right Sidebar 66%,Bottom 100%,Bottom Full Width,Footer," + PaneNames.Admin;
|
||||
|
||||
public override List<Resource> Resources => new List<Resource>()
|
||||
{
|
||||
|
@ -45,6 +45,7 @@ else
|
||||
{
|
||||
if (PageState.ModuleId != -1 && PageState.Action != Constants.DefaultAction)
|
||||
{
|
||||
// an admin pane is required in every theme so that module controls can be rendered in a specific location
|
||||
if (Name.ToLower() == PaneNames.Admin.ToLower())
|
||||
{
|
||||
Module module = PageState.Modules.FirstOrDefault(item => item.ModuleId == PageState.ModuleId);
|
||||
|
@ -14,12 +14,18 @@
|
||||
@inject IJSRuntime JSRuntime
|
||||
@implements IHandleAfterRender
|
||||
|
||||
@if (!string.IsNullOrEmpty(_error))
|
||||
{
|
||||
<ModuleMessage Message="@_error" Type="@MessageType.Error" />
|
||||
}
|
||||
|
||||
@DynamicComponent
|
||||
|
||||
@code {
|
||||
private string _absoluteUri;
|
||||
private bool _navigationInterceptionEnabled;
|
||||
private PageState _pagestate;
|
||||
private string _error = "";
|
||||
|
||||
[Parameter]
|
||||
public string Runtime { get; set; }
|
||||
@ -76,6 +82,7 @@
|
||||
var refresh = UI.Refresh.None;
|
||||
var lastsyncdate = DateTime.UtcNow.AddHours(-1);
|
||||
var runtime = (Shared.Runtime)Enum.Parse(typeof(Shared.Runtime), Runtime);
|
||||
_error = "";
|
||||
|
||||
Route route = new Route(_absoluteUri, SiteState.Alias.Path);
|
||||
int moduleid = (int.TryParse(route.ModuleId, out moduleid)) ? moduleid : -1;
|
||||
@ -329,7 +336,7 @@
|
||||
page.Panes = new List<string>();
|
||||
page.Resources = new List<Resource>();
|
||||
|
||||
string panes = PaneNames.Admin;
|
||||
string panes = "";
|
||||
Type themetype = Type.GetType(page.ThemeType);
|
||||
if (themetype == null)
|
||||
{
|
||||
@ -349,7 +356,19 @@
|
||||
page.Resources = ManagePageResources(page.Resources, themeobject.Resources, ResourceLevel.Page);
|
||||
}
|
||||
}
|
||||
page.Panes = panes.Replace(";", ",").Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
if (!string.IsNullOrEmpty(panes))
|
||||
{
|
||||
page.Panes = panes.Replace(";", ",").Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
if (!page.Panes.Contains(PaneNames.Admin))
|
||||
{
|
||||
_error = "The Current Theme Does Not Contain An Admin Pane";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
page.Panes.Add(PaneNames.Admin);
|
||||
_error = "The Current Theme Does Not Contain Any Panes";
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
@ -441,8 +460,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
// ensure module's pane exists in current page and if not, assign it to the Admin pane
|
||||
if (page.Panes == null || page.Panes.FindIndex(item => item.Equals(module.Pane, StringComparison.OrdinalIgnoreCase)) == -1)
|
||||
// ensure module's pane exists in current page and if not, fallback to the admin pane
|
||||
if (page.Panes.FindIndex(item => item.Equals(module.Pane, StringComparison.OrdinalIgnoreCase)) == -1)
|
||||
{
|
||||
module.Pane = PaneNames.Admin;
|
||||
}
|
||||
|
Reference in New Issue
Block a user