Central management of resources ( ie. stylesheets and scripts )
This commit is contained in:
@ -28,9 +28,19 @@
|
||||
@code {
|
||||
public override string Panes => "Content";
|
||||
|
||||
public override List<Resource> Resources
|
||||
{
|
||||
get
|
||||
{
|
||||
List<Resource> resources = new List<Resource>();
|
||||
resources.Add(new Resource { ResourceType = ResourceType.Stylesheet, Url = "Themes/" + GetType().Namespace + "/Theme.css", Integrity = "", CrossOrigin = "" });
|
||||
return resources;
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await IncludeCSS("Theme.css");
|
||||
//await IncludeCSS("Theme.css");
|
||||
}
|
||||
|
||||
}
|
@ -19,11 +19,22 @@
|
||||
@code {
|
||||
public override string Panes => string.Empty;
|
||||
|
||||
public override List<Resource> Resources
|
||||
{
|
||||
get
|
||||
{
|
||||
List<Resource> resources = new List<Resource>();
|
||||
resources.Add(new Resource { ResourceType = ResourceType.Stylesheet, Url = "https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/cyborg/bootstrap.min.css", Integrity = "sha384-l7xaoY0cJM4h9xh1RfazbgJVUZvdtyLWPueWNtLAphf/UbBgOVzqbOTogxPwYLHM", CrossOrigin = "anonymous" });
|
||||
resources.Add(new Resource { ResourceType = ResourceType.Stylesheet, Url = "Themes/" + GetType().Namespace + "/Theme.css" });
|
||||
return resources;
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
// go to https://www.bootstrapcdn.com/bootswatch/ and take your favorite theme
|
||||
//<link href="https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/cyborg/bootstrap.min.css" rel="stylesheet" integrity="sha384-l7xaoY0cJM4h9xh1RfazbgJVUZvdtyLWPueWNtLAphf/UbBgOVzqbOTogxPwYLHM" crossorigin="anonymous">
|
||||
await LoadBootstrapTheme("https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/cyborg/bootstrap.min.css","sha384-l7xaoY0cJM4h9xh1RfazbgJVUZvdtyLWPueWNtLAphf/UbBgOVzqbOTogxPwYLHM");
|
||||
await IncludeCSS("Theme.css");
|
||||
// go to https://www.bootstrapcdn.com/bootswatch/ and take your favorite theme
|
||||
//<link href="https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/cyborg/bootstrap.min.css" rel="stylesheet" integrity="sha384-l7xaoY0cJM4h9xh1RfazbgJVUZvdtyLWPueWNtLAphf/UbBgOVzqbOTogxPwYLHM" crossorigin="anonymous">
|
||||
//await LoadBootstrapTheme("https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/cyborg/bootstrap.min.css","sha384-l7xaoY0cJM4h9xh1RfazbgJVUZvdtyLWPueWNtLAphf/UbBgOVzqbOTogxPwYLHM");
|
||||
//await IncludeCSS("Theme.css");
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using Oqtane.Models;
|
||||
using Oqtane.Shared;
|
||||
using Oqtane.UI;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Themes
|
||||
@ -14,6 +16,7 @@ namespace Oqtane.Themes
|
||||
[CascadingParameter]
|
||||
protected PageState PageState { get; set; }
|
||||
public virtual string Panes { get; set; }
|
||||
public virtual List<Resource> Resources { get; set; }
|
||||
|
||||
public string ThemePath()
|
||||
{
|
||||
|
Reference in New Issue
Block a user