Skip to content

Commit

Permalink
nopSolutions#2022 Admin section links for help are opened in new tab.
Browse files Browse the repository at this point in the history
  • Loading branch information
manojkulkarni30 committed Jan 19, 2017
1 parent def716e commit c01b2ff
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 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; }
}
}
8 changes: 8 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,14 @@ 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;
}
}

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
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 c01b2ff

Please sign in to comment.