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);
|
||||
|
Reference in New Issue
Block a user