Skip to content

Commit

Permalink
Admin section links for help and public store link is opened in new t…
Browse files Browse the repository at this point in the history
  • Loading branch information
manojkulkarni30 committed Jan 17, 2017
1 parent 222d444 commit 672198a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/Presentation/Nop.Web.Framework/Menu/SiteMapNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,10 @@ public SiteMapNode()
/// Gets or sets the item is visible
/// </summary>
public bool Visible { get; set; }

/// <summary>
/// Gets or sets a value indicating whether to open url in new tab (window) or not
/// </summary>
public bool OpenUrlInNewTab { get; set; }
}
}
12 changes: 12 additions & 0 deletions src/Presentation/Nop.Web.Framework/Menu/XmlSiteMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,18 @@ private static void PopulateNode(SiteMapNode siteMapNode, XmlNode xmlNode)
{
siteMapNode.Visible = true;
}

// Open URL in new tab
var openUrlInNewTabValue = GetStringValueFromAttribute(xmlNode, "OpenUrlInNewTab");
bool booleanResult;
if (!string.IsNullOrWhiteSpace(openUrlInNewTabValue) && bool.TryParse(openUrlInNewTabValue, out booleanResult))
{
siteMapNode.OpenUrlInNewTab = booleanResult;
}
else
{
siteMapNode.OpenUrlInNewTab = false;
}
}

private static string GetStringValueFromAttribute(XmlNode node, string attributeName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
if (!String.IsNullOrEmpty(url))
{
<li @(isActive ? Html.Raw("class=\"active current-active-item\"") : null)>
<a href="@url" class="menu-item-link">
<a href="@url" class="menu-item-link" @(item.OpenUrlInNewTab ? Html.Raw("target=\"_blank\"") : null)>
@if (!String.IsNullOrEmpty(item.IconClass))
{
<text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
@Html.Widget("admin_header_middle", area: "Admin")
</li>
<li>
<a href="@Url.Action("Index", "Home", new {area = ""})">
<a href="@Url.Action("Index", "Home", new {area = ""})" target="_blank">
@T("Admin.Header.PublicStore")
</a>
</li>
Expand Down
6 changes: 3 additions & 3 deletions src/Presentation/Nop.Web/Administration/sitemap.config
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@
</siteMapNode>
</siteMapNode>
<siteMapNode SystemName="Help" nopResource="Admin.Help" IconClass="fa-question-circle">
<siteMapNode SystemName="Help topics" nopResource="Admin.Help.Topics" url="http://docs.nopcommerce.com/display/nc/nopCommerce+Documentation?utm_source=admin-panel&amp;utm_medium=menu&amp;utm_campaign=admin-panel" IconClass="fa-dot-circle-o"/>
<siteMapNode SystemName="Community forums" nopResource="Admin.Help.Forums" url="http://www.nopcommerce.com/boards/?utm_source=admin-panel&amp;utm_medium=menu&amp;utm_campaign=admin-panel" IconClass="fa-dot-circle-o"/>
<siteMapNode SystemName="Premium support services" nopResource="Admin.Help.SupportServices" url="http://www.nopcommerce.com/p/541/nopcommerce-premium-support-services.aspx?utm_source=admin-panel&amp;utm_medium=menu&amp;utm_campaign=admin-panel" IconClass="fa-dot-circle-o"/>
<siteMapNode SystemName="Help topics" nopResource="Admin.Help.Topics" url="http://docs.nopcommerce.com/display/nc/nopCommerce+Documentation?utm_source=admin-panel&amp;utm_medium=menu&amp;utm_campaign=admin-panel" IconClass="fa-dot-circle-o" OpenUrlInNewTab="true"/>
<siteMapNode SystemName="Community forums" nopResource="Admin.Help.Forums" url="http://www.nopcommerce.com/boards/?utm_source=admin-panel&amp;utm_medium=menu&amp;utm_campaign=admin-panel" IconClass="fa-dot-circle-o" OpenUrlInNewTab="true"/>
<siteMapNode SystemName="Premium support services" nopResource="Admin.Help.SupportServices" url="http://www.nopcommerce.com/p/541/nopcommerce-premium-support-services.aspx?utm_source=admin-panel&amp;utm_medium=menu&amp;utm_campaign=admin-panel" IconClass="fa-dot-circle-o" OpenUrlInNewTab="true"/>
</siteMapNode>
<siteMapNode SystemName="Third party plugins" nopResource="Admin.Plugins" IconClass="fa-bars" />
</siteMapNode>
Expand Down

0 comments on commit 672198a

Please sign in to comment.