Skip to content

Commit

Permalink
Update Site.Master.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
w8tcha committed May 11, 2024
1 parent 0abebe4 commit ec728fb
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions YAF.SampleWebApplication/Site.Master.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
* under the License.
*/

using YAF.Core.Helpers;

namespace YAF.SampleWebApplication
{
using System;
Expand All @@ -35,6 +37,9 @@ namespace YAF.SampleWebApplication
using YAF.Configuration;
using YAF.Core.Context;
using YAF.Core.Extensions;
using YAF.Core.Services;
using YAF.Core.Utilities;
using YAF.Types.Constants;
using YAF.Types.Interfaces;
using YAF.Types.Interfaces.Services;
using YAF.Types.Models;
Expand Down Expand Up @@ -77,14 +82,33 @@ protected void Page_Load(object sender, EventArgs e)
scriptManager.Scripts.Add(
new ScriptReference(BoardInfo.GetURLToScripts("forumExtensions.min.js")));

if (BoardContext.Current is not null)
{
var logoutScript = JavaScriptBlocks.LogOutJs(
BoardContext.Current.Get<ILocalization>().GetText("TOOLBAR", "LOGOUT_TITLE"),
BoardContext.Current.Get<ILocalization>().GetText("TOOLBAR", "LOGOUT_QUESTION"),
BoardContext.Current.Get<ILocalization>().GetText("TOOLBAR", "LOGOUT"),
BoardContext.Current.Get<ILocalization>().GetText("COMMON", "CANCEL"),
BoardContext.Current.Get<LinkBuilder>().GetLink(ForumPages.Account_Logout));


ScriptManager.RegisterStartupScript(
this.Page,
this.Page.GetType(),
nameof(JavaScriptBlocks.LogOutJs),
JsAndCssHelper.CompressJavaScript(logoutScript),
true);
}


var link = new HtmlLink();

link.Attributes.Add("rel", "stylesheet");
link.Attributes.Add("type", "text/css");

link.Href = BoardContext.Current != null
? BoardContext.Current.Get<ITheme>().BuildThemePath("bootstrap-forum.min.css")
: "~/Forum/Content/Themes/yaf/bootstrap-forum.min.css";
link.Href = BoardContext.Current != null
? BoardContext.Current.Get<ITheme>().BuildThemePath("bootstrap-forum.min.css")
: "~/Forum/Content/Themes/yaf/bootstrap-forum.min.css";

this.Page.Header.Controls.Add(link);

Expand Down

0 comments on commit ec728fb

Please sign in to comment.