Added support for friendly names and thumbnails in theme, layout, and container components. Added fallback support during loading for themes, layout, and containers.

This commit is contained in:
Shaun Walker
2020-06-01 14:58:46 -04:00
parent f45cb8b069
commit 1b7ca45d4a
26 changed files with 222 additions and 200 deletions

View File

@ -17,6 +17,8 @@ namespace Oqtane.Themes
[CascadingParameter]
protected Module ModuleState { get; set; }
public virtual string Name { get; set; }
public virtual string Thumbnail { get; set; }
public string ThemePath()
{

View File

@ -161,9 +161,9 @@
<div class="col text-center">
<label for="Container" class="control-label">Container: </label>
<select class="form-control" @bind="@ContainerType">
@foreach (KeyValuePair<string, string> container in _containers)
@foreach (var container in _containers)
{
<option value="@container.Key">@container.Value</option>
<option value="@container.TypeName">@container.Name</option>
}
</select>
</div>
@ -218,7 +218,7 @@
private List<ModuleDefinition> _moduleDefinitions;
private List<Page> _pages = new List<Page>();
private List<Module> _modules = new List<Module>();
private Dictionary<string, string> _containers = new Dictionary<string, string>();
private List<ThemeControl> _containers = new List<ThemeControl>();
private string _display = "display: none;";
private string _category = "Common";
@ -301,7 +301,7 @@
var panes = PageState.Page.Panes;
Pane = panes.Count() == 1 ? panes.SingleOrDefault() : "";
var themes = await ThemeService.GetThemesAsync();
_containers = ThemeService.GetContainerTypes(themes, PageState.Page.ThemeType);
_containers = ThemeService.GetContainerControls(themes, PageState.Page.ThemeType);
ContainerType = PageState.Site.DefaultContainerType;
_allModuleDefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync(PageState.Site.SiteId);

View File

@ -2,5 +2,7 @@
{
public interface IContainerControl
{
string Name { get; } // friendly name for a container
string Thumbnail { get; } // screen shot of a container - assumed to be in the ThemePath() folder
}
}

View File

@ -2,7 +2,9 @@
{
public interface ILayoutControl
{
string Panes { get; } // identifies all panes in a theme ( delimited by ";" )
string Name { get; } // friendly name for a layout
string Thumbnail { get; } // screen shot of a layout - assumed to be in the ThemePath() folder
string Panes { get; } // identifies all panes in a theme ( delimited by "," or ";" )
}
}

View File

@ -8,6 +8,8 @@ namespace Oqtane.Themes
{
[CascadingParameter]
protected PageState PageState { get; set; }
public virtual string Name { get; set; }
public virtual string Thumbnail { get; set; }
public virtual string Panes { get; set; }
public string LayoutPath()

View File

@ -12,4 +12,8 @@
<ModuleInstance />
</div>
</div>
</div>
</div>
@code {
public override string Name => "Standard Header";
}

View File

@ -17,6 +17,8 @@
</main>
@code {
public override string Name => "Default";
public override string Panes => string.Empty;
public override List<Resource> Resources => new List<Resource>()

View File

@ -14,5 +14,7 @@
</div>
@code {
public override string Panes => "Top;Left;Content;Right;Bottom";
public override string Name => "Multiple Panes";
public override string Panes => "Top,Left,Content,Right,Bottom";
}

View File

@ -6,4 +6,8 @@
<ModuleActions />
}
<ModuleInstance />
</div>
</div>
@code {
public override string Name => "No Header";
}

View File

@ -6,5 +6,7 @@
</div>
@code {
public override string Name => "Single Pane";
public override string Panes => "Content";
}

View File

@ -17,6 +17,8 @@ namespace Oqtane.Themes
[CascadingParameter]
protected PageState PageState { get; set; }
public virtual string Name { get; set; }
public virtual string Thumbnail { get; set; }
public virtual string Panes { get; set; }
public virtual List<Resource> Resources { get; set; }