include methods for dynamic scenarios
This commit is contained in:
parent
85358c7dd4
commit
40c788fc33
|
@ -291,6 +291,16 @@ namespace Oqtane.Modules
|
|||
}
|
||||
}
|
||||
|
||||
public void AddScript(Resource resource)
|
||||
{
|
||||
resource.ResourceType = ResourceType.Script;
|
||||
if (Resources == null) Resources = new List<Resource>();
|
||||
if (!Resources.Any(item => (!string.IsNullOrEmpty(resource.Url) && item.Url == resource.Url) || (!string.IsNullOrEmpty(resource.Content) && item.Content == resource.Content)))
|
||||
{
|
||||
Resources.Add(resource);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task ScrollToPageTop()
|
||||
{
|
||||
var interop = new Interop(JSRuntime);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
@namespace Oqtane.Themes.Controls
|
||||
@inherits ContainerBase
|
||||
@attribute [OqtaneIgnore]
|
||||
@inject SiteState SiteState
|
||||
|
||||
<span class="app-moduletitle">
|
||||
@((MarkupString)title)
|
||||
|
|
|
@ -19,7 +19,6 @@ namespace Oqtane.Themes.Controls
|
|||
[Inject] public IUserService UserService { get; set; }
|
||||
[Inject] public IJSRuntime jsRuntime { get; set; }
|
||||
[Inject] public IServiceProvider ServiceProvider { get; set; }
|
||||
[Inject] public SiteState SiteState { get; set; }
|
||||
[Inject] public ILogService LoggingService { get; set; }
|
||||
|
||||
protected void LoginUser()
|
||||
|
|
|
@ -15,10 +15,13 @@ namespace Oqtane.Themes
|
|||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
// optional interface properties
|
||||
[Inject]
|
||||
protected SiteState SiteState { get; set; }
|
||||
|
||||
[CascadingParameter]
|
||||
protected PageState PageState { get; set; }
|
||||
|
||||
// optional interface properties
|
||||
public virtual string Name { get; set; }
|
||||
public virtual string Thumbnail { get; set; }
|
||||
public virtual string Panes { get; set; }
|
||||
|
@ -139,6 +142,34 @@ namespace Oqtane.Themes
|
|||
return Utilities.ImageUrl(PageState.Alias, fileid, width, height, mode, position, background, rotate, recreate);
|
||||
}
|
||||
|
||||
public void SetPageTitle(string title)
|
||||
{
|
||||
SiteState.Properties.PageTitle = title;
|
||||
}
|
||||
|
||||
// note - only supports links and meta tags - not scripts
|
||||
public void AddHeadContent(string content)
|
||||
{
|
||||
if (string.IsNullOrEmpty(SiteState.Properties.HeadContent))
|
||||
{
|
||||
SiteState.Properties.HeadContent = content;
|
||||
}
|
||||
else if (!SiteState.Properties.HeadContent.Contains(content))
|
||||
{
|
||||
SiteState.Properties.HeadContent += content;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddScript(Resource resource)
|
||||
{
|
||||
resource.ResourceType = ResourceType.Script;
|
||||
if (Resources == null) Resources = new List<Resource>();
|
||||
if (!Resources.Any(item => (!string.IsNullOrEmpty(resource.Url) && item.Url == resource.Url) || (!string.IsNullOrEmpty(resource.Content) && item.Content == resource.Content)))
|
||||
{
|
||||
Resources.Add(resource);
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("ContentUrl(int fileId) is deprecated. Use FileUrl(int fileId) instead.", false)]
|
||||
public string ContentUrl(int fileid)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user