Merge pull request #2400 from sbwalker/dev

more changes to support Default pane
This commit is contained in:
Shaun Walker 2022-09-05 15:51:22 -04:00 committed by GitHub
commit 64c5d9a09f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 159 additions and 148 deletions

View File

@ -582,9 +582,9 @@
}
else
{
if (PageState.Page.Panes.Count != 0)
if (PageState.Page.Panes.FindIndex(item => item.Equals(PaneNames.Default, StringComparison.OrdinalIgnoreCase)) != -1)
{
_pane = PageState.Page.Panes[0];
_pane = PaneNames.Default;
}
else
{

View File

@ -16,13 +16,6 @@
<Pane Name="@PaneNames.Default" />
</div>
</div>
</div>
<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">
@ -115,7 +108,7 @@
@code {
public override string Name => "Default Theme";
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 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";
public override List<Resource> Resources => new List<Resource>()
{

View File

@ -45,8 +45,18 @@ 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())
// action route needs to inject module control into specific pane
string pane = "";
if (PageState.Page.Panes.FindIndex(item => item.Equals(PaneNames.Default, StringComparison.OrdinalIgnoreCase)) != -1)
{
pane = PaneNames.Default;
}
else
{
pane = PaneNames.Admin;
}
if (Name.ToLower() == pane.ToLower())
{
Module module = PageState.Modules.FirstOrDefault(item => item.ModuleId == PageState.ModuleId);
if (module != null)

View File

@ -16,7 +16,7 @@
@if (!string.IsNullOrEmpty(_error))
{
<ModuleMessage Message="@_error" Type="@MessageType.Error" />
<ModuleMessage Message="@_error" Type="@MessageType.Warning" />
}
@DynamicComponent
@ -359,9 +359,9 @@
if (!string.IsNullOrEmpty(panes))
{
page.Panes = panes.Replace(";", ",").Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
if (!page.Panes.Contains(PaneNames.Admin))
if (!page.Panes.Contains(PaneNames.Default) && !page.Panes.Contains(PaneNames.Admin))
{
_error = "The Current Theme Does Not Contain An Admin Pane";
_error = "The Current Theme Does Not Contain A Default Or Admin Pane";
}
}
else
@ -460,11 +460,19 @@
}
}
// ensure module's pane exists in current page and if not, fallback to the admin pane
// validate that module's pane exists in current page
if (page.Panes.FindIndex(item => item.Equals(module.Pane, StringComparison.OrdinalIgnoreCase)) == -1)
{
// fallback to default pane if it exists
if (page.Panes.FindIndex(item => item.Equals(PaneNames.Default, StringComparison.OrdinalIgnoreCase)) != -1)
{
module.Pane = PaneNames.Default;
}
else // otherwise admin pane (legacy)
{
module.Pane = PaneNames.Admin;
}
}
// calculate module position within pane
if (paneindex.ContainsKey(module.Pane.ToLower()))