CSS separation, multi-tenancy fixes

This commit is contained in:
Shaun Walker
2019-10-12 16:32:47 -04:00
parent 7f69f76263
commit c029e70783
82 changed files with 957 additions and 811 deletions

View File

@ -1,8 +1,8 @@
@namespace Oqtane.Themes
@inherits ContainerBase
<div id="modal" class="modal" style="display: block">
<div class="modal-content">
<a href="@closeurl" class="close">x</a>
<div id="modal" class="app-admin-modal" style="display: block">
<div class="app-admin-modal-content">
<a href="@closeurl" class="app-admin-modal-close">x</a>
<div class="container">
<div class="row px-4">
<h2><ModuleTitle /></h2>

View File

@ -1,4 +1,4 @@
@namespace Oqtane.Themes.Theme2
@namespace Oqtane.Themes.BlazorTheme
@inherits ThemeBase
<div class="sidebar">
@ -8,7 +8,7 @@
<div class="main">
<div class="top-row px-4">
<h1>@PageState.Page.Name - Theme #2</h1> <div class="ml-md-auto"><UserProfile /> <Login /> <ControlPanel /></div>
<h1>@PageState.Page.Name</h1> <div class="ml-md-auto"><UserProfile /> <Login /> <ControlPanel /></div>
</div>
<div class="container">
<div class="row px-4">
@ -24,6 +24,11 @@
</div>
@code {
public override string Name { get { return "Theme2"; } }
public override string Panes { get { return "Top;Bottom"; } }
protected override async Task OnParametersSetAsync()
{
await IncludeCSS("Theme.css");
}
}

View File

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace Oqtane.Themes.Theme2
namespace Oqtane.Themes.BlazorTheme
{
public class Theme : ITheme
{
@ -10,7 +10,7 @@ namespace Oqtane.Themes.Theme2
{
Dictionary<string, string> properties = new Dictionary<string, string>
{
{ "Name", "Theme2" },
{ "Name", "Blazor Theme" },
{ "Version", "1.0.0" }
};
return properties;

View File

@ -33,16 +33,6 @@ namespace Oqtane.Themes
return "Themes/" + this.GetType().Namespace + "/";
}
public async Task AddCSS(string Url)
{
if (!Url.StartsWith("http"))
{
Url = ThemePath() + Url;
}
var interop = new Interop(JSRuntime);
await interop.AddCSS("Theme:" + Utilities.CreateIdFromUrl(Url), Url);
}
public string NavigateUrl()
{
return NavigateUrl(PageState.Page.Path);

View File

@ -9,9 +9,9 @@
@if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions))
{
<div id="actions" class="overlay">
<a href="javascript:void(0)" class="closebtn" onclick="closeActions()">x</a>
<div class="overlay-content">
<div id="actions" class="app-controlpanel">
<a href="javascript:void(0)" class="app-controlpanel-close" onclick="closeActions()">x</a>
<div class="app-controlpanel-content">
<ul class="nav flex-column">
<li class="nav-item px-3">
<NavLink class="btn btn-primary mx-auto" href="@NavigateUrl("admin")">Admin Dashboard</NavLink>

View File

@ -1,5 +1,6 @@
@namespace Oqtane.Themes.Controls
@inherits ThemeControlBase
@inject NavigationManager NavigationManager
@((MarkupString)logo)
@ -10,7 +11,8 @@
{
if (PageState.Site.Logo != "")
{
logo = "<a href=\"" + PageState.Alias.Url + "\"><img src=\"" + PageState.Alias.BaseUrl + "/" + PageState.Site.SiteRootPath + PageState.Site.Logo + "\" alt=\"" + PageState.Site.Name + "\"/></a>";
Uri uri = new Uri(NavigationManager.Uri);
logo = "<a href=\"" + uri.Scheme + "://" + uri.Authority + "\"><img src=\"" + uri.Scheme + "://" + uri.Authority + "/" + PageState.Site.SiteRootPath + PageState.Site.Logo + "\" alt=\"" + PageState.Site.Name + "\"/></a>";
}
}
}

View File

@ -7,7 +7,7 @@
@if (PageState.DesignMode && UserSecurity.IsAuthorized(PageState.User, "Edit", ModuleState.Permissions))
{
<div class="dropdown">
<button type="button" class="btn dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
<button type="button" class="btn app-actions-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
@foreach (var action in actions)
{

View File

@ -0,0 +1,7 @@
namespace Oqtane.Themes
{
public interface ILayoutControl
{
}
}

View File

@ -2,7 +2,6 @@
{
public interface IThemeControl
{
string Name { get; }
string Panes { get; } // if a theme has different panes, delimit them with ";"
string Panes { get; } // identifies all panes in a theme ( delimited by ";" ) - assumed to be a layout if no panes specified
}
}

View File

@ -0,0 +1,18 @@
using Microsoft.AspNetCore.Components;
using Oqtane.Shared;
namespace Oqtane.Themes
{
public class LayoutBase : ComponentBase, ILayoutControl
{
[CascadingParameter]
protected PageState PageState { get; set; }
public virtual string Panes { get; set; }
public string LayoutPath()
{
return "Themes/" + this.GetType().Namespace + "/";
}
}
}

View File

@ -1,4 +1,4 @@
@namespace Oqtane.Themes.Theme2
@namespace Oqtane.Themes.OqtaneTheme
@inherits ContainerBase
<div class="container">
<div class="row px-4">

View File

@ -1,4 +1,4 @@
@namespace Oqtane.Themes.Theme1
@namespace Oqtane.Themes.OqtaneTheme
@inherits ThemeBase
<div class="sidebar">
@ -8,16 +8,14 @@
<div class="main">
<div class="top-row px-4">
<h1>@PageState.Page.Name - Theme #1</h1> <div class="ml-md-auto"><UserProfile /> <Login /> <ControlPanel /></div>
<h1>@PageState.Page.Name</h1> <div class="ml-md-auto"><UserProfile /> <Login /> <ControlPanel /></div>
</div>
<div class="container">
<div class="row px-4">
<div class="col-sm">
<Pane Name="Left" />
</div>
<div class="col-sm">
<Pane Name="Right" />
</div>
<Pane Name="Top" />
</div>
<div class="row px-4">
<Pane Name="Bottom" />
</div>
<div class="row px-4">
<Pane Name="Admin" />
@ -26,6 +24,10 @@
</div>
@code {
public override string Name { get { return "Theme1"; } }
public override string Panes { get { return "Left;Right"; } }
protected override async Task OnParametersSetAsync()
{
await IncludeCSS("Theme.css");
}
}

View File

@ -1,5 +1,5 @@
@namespace Oqtane.Themes.Theme3
@inherits ThemeBase
@namespace Oqtane.Themes.OqtaneTheme
@inherits LayoutBase
<div class="row px-4">
<div class="col-sm">
@ -11,6 +11,5 @@
</div>
@code {
public override string Name { get { return "Horizontal Layout"; } }
public override string Panes { get { return "Left;Right"; } }
}

View File

@ -1,4 +1,4 @@
@namespace Oqtane.Themes.Theme3
@namespace Oqtane.Themes.OqtaneTheme
@inherits ThemeBase
<div class="sidebar">
@ -8,7 +8,7 @@
<div class="main">
<div class="top-row px-4">
<h1>@PageState.Page.Name - Theme #3</h1> <div class="ml-md-auto"><UserProfile /> <Login /> <ControlPanel /></div>
<h1>@PageState.Page.Name</h1> <div class="ml-md-auto"><UserProfile /> <Login /> <ControlPanel /></div>
</div>
<div class="container">
<PaneLayout />
@ -19,6 +19,8 @@
</div>
@code {
public override string Name { get { return "Theme3"; } }
public override string Panes { get { return ""; } }
protected override async Task OnParametersSetAsync()
{
await IncludeCSS("Theme.css");
}
}

View File

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace Oqtane.Themes.Theme1
namespace Oqtane.Themes.OqtaneTheme
{
public class Theme : ITheme
{
@ -10,7 +10,7 @@ namespace Oqtane.Themes.Theme1
{
Dictionary<string, string> properties = new Dictionary<string, string>
{
{ "Name", "Theme1" },
{ "Name", "Oqtane Theme" },
{ "Version", "1.0.0" }
};
return properties;

View File

@ -1,5 +1,5 @@
@namespace Oqtane.Themes.Theme3
@inherits ThemeBase
@namespace Oqtane.Themes.OqtaneTheme
@inherits LayoutBase
<div class="row px-4">
<Pane Name="Top" />
@ -9,6 +9,5 @@
</div>
@code {
public override string Name { get { return "Vertical Layout"; } }
public override string Panes { get { return "Top;Bottom"; } }
}

View File

@ -1,13 +0,0 @@
@namespace Oqtane.Themes.Theme1
@inherits ContainerBase
<div class="container">
<div class="row px-4">
<ModuleActions /><h2><ModuleTitle /></h2>
<hr style="width: 100%; color: gray; height: 1px; background-color:gray;" />
</div>
<div class="row px-4">
<div class="container">
<ModuleInstance />
</div>
</div>
</div>

View File

@ -1,20 +0,0 @@
using System.Collections.Generic;
namespace Oqtane.Themes.Theme3
{
public class Theme : ITheme
{
public Dictionary<string, string> Properties
{
get
{
Dictionary<string, string> properties = new Dictionary<string, string>
{
{ "Name", "Theme3" },
{ "Version", "1.0.0" }
};
return properties;
}
}
}
}

View File

@ -12,7 +12,6 @@ namespace Oqtane.Themes
[CascadingParameter]
protected PageState PageState { get; set; }
public virtual string Name { get; set; }
public virtual string Panes { get; set; }
public string ThemePath()
@ -20,14 +19,14 @@ namespace Oqtane.Themes
return "Themes/" + this.GetType().Namespace + "/";
}
public async Task AddCSS(string Url)
public async Task IncludeCSS(string Url)
{
if (!Url.StartsWith("http"))
{
Url = ThemePath() + Url;
}
var interop = new Interop(JSRuntime);
await interop.AddCSS("Theme:" + Utilities.CreateIdFromUrl(Url), Url);
await interop.IncludeCSS("Theme", Url);
}
public string NavigateUrl()