Improved CSS handling
This commit is contained in:
@ -1,11 +1,16 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using Oqtane.Shared;
|
||||
using Oqtane.Models;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Themes
|
||||
{
|
||||
public class ContainerBase : ComponentBase, IContainerControl
|
||||
{
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[CascadingParameter]
|
||||
protected PageState PageState { get; set; }
|
||||
|
||||
@ -14,6 +19,21 @@ namespace Oqtane.Themes
|
||||
|
||||
public virtual string Name { get; set; }
|
||||
|
||||
public string ThemePath()
|
||||
{
|
||||
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);
|
||||
|
@ -19,6 +19,11 @@
|
||||
<div id="actions" class="overlay">
|
||||
<a href="javascript:void(0)" class="closebtn" onclick="closeActions()">x</a>
|
||||
<div class="overlay-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>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav flex-column">
|
||||
<li class="nav-item px-3">
|
||||
<NavLink class="btn btn-primary mx-auto" href="@PageUrl("Add")">Add Page</NavLink>
|
||||
@ -99,12 +104,6 @@
|
||||
</table>
|
||||
<button type="button" class="btn btn-primary mx-auto" style="width: 100%;" @onclick="@AddModule">Add Module To Page</button>
|
||||
</div>
|
||||
<hr style="width: 100%; color: white; height: 1px; background-color:white;" />
|
||||
<ul class="nav flex-column">
|
||||
<li class="nav-item px-3">
|
||||
<NavLink class="btn btn-primary mx-auto" href="@NavigateUrl("admin")">Admin Dashboard</NavLink>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -1,10 +1,15 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using Oqtane.Shared;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Themes
|
||||
{
|
||||
public class ThemeBase : ComponentBase, IThemeControl
|
||||
{
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[CascadingParameter]
|
||||
protected PageState PageState { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
@ -15,6 +20,16 @@ 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);
|
||||
|
Reference in New Issue
Block a user