Improvements to themes, layouts, and CSS styling

This commit is contained in:
Shaun Walker
2019-10-16 14:28:49 -04:00
parent c029e70783
commit 05a405e036
51 changed files with 11843 additions and 777 deletions

View File

@ -11,7 +11,7 @@
<img src="oqtane.png" />
</div>
</div>
<hr style="width: 100%; color: gray; height: 1px; background-color:gray;" />
<hr class="app-rule" />
<h2 class="text-center">Database Configuration</h2>
<div class="row">
<div class="mx-auto text-center">
@ -75,7 +75,7 @@
</table>
</div>
</div>
<hr style="width: 100%; color: gray; height: 1px; background-color:gray;" />
<hr class="app-rule" />
<h2 class="text-center">Application Administrator</h2>
<div class="row">
<div class="mx-auto text-center">
@ -178,7 +178,8 @@
site.Name = "Default Site";
site.Logo = "oqtane.png";
site.DefaultThemeType = Constants.DefaultTheme;
site.DefaultLayoutType = "";
site.DefaultLayoutType = Constants.DefaultLayout;
site.DefaultContainerType = Constants.DefaultContainer;
site = await SiteService.AddSiteAsync(site);
User user = new User();

View File

@ -1,4 +1,5 @@
using Microsoft.JSInterop;
using System;
using System.Threading.Tasks;
namespace Oqtane.Shared

View File

@ -218,6 +218,8 @@
if (page != null)
{
page = ProcessPage(page, site);
// check if user is authorized to view page
if (UserSecurity.IsAuthorized(user, "View", page.Permissions))
{
@ -243,7 +245,7 @@
if (PageState == null || reload >= Reload.Page)
{
modules = await ModuleService.GetModulesAsync(page.PageId);
modules = ProcessModules(modules, moduledefinitions, pagestate.Control, page.Panes);
modules = ProcessModules(modules, moduledefinitions, pagestate.Control, page.Panes, site);
}
else
{
@ -311,7 +313,35 @@
return querystring;
}
private List<Module> ProcessModules(List<Module> modules, List<ModuleDefinition> moduledefinitions, string control, string panes)
private Page ProcessPage(Page page, Site site)
{
try
{
if (string.IsNullOrEmpty(page.ThemeType))
{
page.ThemeType = site.DefaultThemeType;
page.LayoutType = site.DefaultLayoutType;
}
Type type;
if (!string.IsNullOrEmpty(page.LayoutType))
{
type = Type.GetType(page.LayoutType);
}
else
{
type = Type.GetType(page.ThemeType);
}
System.Reflection.PropertyInfo property = type.GetProperty("Panes");
page.Panes = (string)property.GetValue(Activator.CreateInstance(type), null);
}
catch
{
// error loading theme or layout
}
return page;
}
private List<Module> ProcessModules(List<Module> modules, List<ModuleDefinition> moduledefinitions, string control, string panes, Site site)
{
ModuleDefinition moduledefinition;
@ -374,6 +404,11 @@
paneindex.Add(module.Pane, 0);
}
module.PaneModuleIndex = paneindex[module.Pane];
if (string.IsNullOrEmpty(module.ContainerType))
{
module.ContainerType = site.DefaultContainerType;
}
}
foreach (Module module in modules)