create AppendHeadContent method to consolidate logic
This commit is contained in:
parent
b21d202c7f
commit
bda0943d58
|
@ -140,15 +140,8 @@
|
||||||
{
|
{
|
||||||
// include CSS
|
// include CSS
|
||||||
var content = "<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/css/bootstrap.min.css\" integrity=\"sha512-t4GWSVZO1eC8BM339Xd7Uphw5s17a86tIZIj8qRxhnKub6WoyhnrxeCIMeAqBPgdZGlCcG2PrZjMc+Wr78+5Xg==\" crossorigin=\"anonymous\" type=\"text/css\"/>";
|
var content = "<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/css/bootstrap.min.css\" integrity=\"sha512-t4GWSVZO1eC8BM339Xd7Uphw5s17a86tIZIj8qRxhnKub6WoyhnrxeCIMeAqBPgdZGlCcG2PrZjMc+Wr78+5Xg==\" crossorigin=\"anonymous\" type=\"text/css\"/>";
|
||||||
if (string.IsNullOrEmpty(SiteState.Properties.HeadContent))
|
SiteState.AppendHeadContent(content);
|
||||||
{
|
|
||||||
SiteState.Properties.HeadContent = content;
|
|
||||||
}
|
|
||||||
else if (!SiteState.Properties.HeadContent.Contains(content))
|
|
||||||
{
|
|
||||||
SiteState.Properties.HeadContent += content;
|
|
||||||
}
|
|
||||||
|
|
||||||
_togglePassword = SharedLocalizer["ShowPassword"];
|
_togglePassword = SharedLocalizer["ShowPassword"];
|
||||||
_toggleConfirmPassword = SharedLocalizer["ShowPassword"];
|
_toggleConfirmPassword = SharedLocalizer["ShowPassword"];
|
||||||
|
|
||||||
|
|
|
@ -281,14 +281,7 @@ namespace Oqtane.Modules
|
||||||
// note - only supports links and meta tags - not scripts
|
// note - only supports links and meta tags - not scripts
|
||||||
public void AddHeadContent(string content)
|
public void AddHeadContent(string content)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(SiteState.Properties.HeadContent))
|
SiteState.AppendHeadContent(content);
|
||||||
{
|
|
||||||
SiteState.Properties.HeadContent = content;
|
|
||||||
}
|
|
||||||
else if (!SiteState.Properties.HeadContent.Contains(content))
|
|
||||||
{
|
|
||||||
SiteState.Properties.HeadContent += content;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddScript(Resource resource)
|
public void AddScript(Resource resource)
|
||||||
|
|
|
@ -150,14 +150,7 @@ namespace Oqtane.Themes
|
||||||
// note - only supports links and meta tags - not scripts
|
// note - only supports links and meta tags - not scripts
|
||||||
public void AddHeadContent(string content)
|
public void AddHeadContent(string content)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(SiteState.Properties.HeadContent))
|
SiteState.AppendHeadContent(content);
|
||||||
{
|
|
||||||
SiteState.Properties.HeadContent = content;
|
|
||||||
}
|
|
||||||
else if (!SiteState.Properties.HeadContent.Contains(content))
|
|
||||||
{
|
|
||||||
SiteState.Properties.HeadContent += content;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddScript(Resource resource)
|
public void AddScript(Resource resource)
|
||||||
|
|
|
@ -14,5 +14,17 @@ namespace Oqtane.Shared
|
||||||
private dynamic _properties;
|
private dynamic _properties;
|
||||||
public dynamic Properties => _properties ?? (_properties = new PropertyDictionary());
|
public dynamic Properties => _properties ?? (_properties = new PropertyDictionary());
|
||||||
|
|
||||||
|
|
||||||
|
public void AppendHeadContent(string content)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(Properties.HeadContent))
|
||||||
|
{
|
||||||
|
Properties.HeadContent = content;
|
||||||
|
}
|
||||||
|
else if (!Properties.HeadContent.Contains(content))
|
||||||
|
{
|
||||||
|
Properties.HeadContent += content;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user