64 lines
1.7 KiB
C#
64 lines
1.7 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.JSInterop;
|
|
using Oqtane.Shared;
|
|
using Oqtane.UI;
|
|
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 Panes { get; set; }
|
|
|
|
public string ThemePath()
|
|
{
|
|
return "Themes/" + GetType().Namespace + "/";
|
|
}
|
|
|
|
public async Task IncludeCSS(string Url)
|
|
{
|
|
if (!Url.StartsWith("http"))
|
|
{
|
|
Url = ThemePath() + Url;
|
|
}
|
|
var interop = new Interop(JSRuntime);
|
|
await interop.IncludeCSS("Theme", Url);
|
|
}
|
|
|
|
public string NavigateUrl()
|
|
{
|
|
return NavigateUrl(PageState.Page.Path);
|
|
}
|
|
|
|
public string NavigateUrl(string path)
|
|
{
|
|
return NavigateUrl(path, "");
|
|
}
|
|
|
|
public string NavigateUrl(string path, string parameters)
|
|
{
|
|
return Utilities.NavigateUrl(PageState.Alias.Path, path, parameters);
|
|
}
|
|
|
|
public string EditUrl(int moduleid, string action)
|
|
{
|
|
return EditUrl(moduleid, action, "");
|
|
}
|
|
|
|
public string EditUrl(int moduleid, string action, string parameters)
|
|
{
|
|
return EditUrl(PageState.Page.Path, moduleid, action, parameters);
|
|
}
|
|
|
|
public string EditUrl(string path, int moduleid, string action, string parameters)
|
|
{
|
|
return Utilities.EditUrl(PageState.Alias.Path, path, moduleid, action, parameters);
|
|
}
|
|
}
|
|
}
|