Skip to content

Commit

Permalink
Merge pull request #3881 from sbwalker/dev
Browse files Browse the repository at this point in the history
fix #3868 - static rendering support for page themes within site
  • Loading branch information
sbwalker authored Feb 23, 2024
2 parents a95cde3 + ddd39ea commit 4262424
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 10 deletions.
34 changes: 28 additions & 6 deletions Oqtane.Client/Themes/Controls/Theme/MenuItemsHorizontal.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,20 @@
<div class="dropdown-menu" aria-labelledby="@($"navbarDropdown{ParentPage.PageId}")">
@foreach (var childPage in GetChildPages())
{
var _attributes = new Dictionary<string, object>();
_attributes.Add("href", GetUrl(childPage));
var _target = GetTarget(childPage);
if (!string.IsNullOrEmpty(_target))
{
_attributes.Add("target", _target);
}
if (!string.IsNullOrEmpty(childPage.ThemeType))
{
_attributes.Add("data-enhance-nav", "false");
}
if (childPage.PageId == PageState.Page.PageId)
{
<a class="nav-link active px-3" href="@GetUrl(childPage)" target="@GetTarget(childPage)">
<a class="nav-link active px-3" @attributes="_attributes">
<span class="w-100" data-bs-toggle="collapse" data-bs-target=".navbar-collapse.show">
<span class="@childPage.Icon" aria-hidden="true" />
@childPage.Name <span class="visually-hidden-focusable">(current)</span>
Expand All @@ -17,7 +28,7 @@
}
else
{
<a class="nav-link px-3" href="@GetUrl(childPage)" target="@GetTarget(childPage)">
<a class="nav-link px-3" @attributes="_attributes">
<span class="w-100" data-bs-toggle="collapse" data-bs-target=".navbar-collapse.show">
<span class="@childPage.Icon" aria-hidden="true" />
@childPage.Name
Expand All @@ -32,12 +43,23 @@ else
<ul class="navbar-nav mr-auto">
@foreach (var childPage in GetChildPages())
{
var _attributes = new Dictionary<string, object>();
_attributes.Add("href", GetUrl(childPage));
var _target = GetTarget(childPage);
if (!string.IsNullOrEmpty(_target))
{
_attributes.Add("target", _target);
}
if (!string.IsNullOrEmpty(childPage.ThemeType))
{
_attributes.Add("data-enhance-nav", "false");
}
if (!Pages.Any(e => e.ParentId == childPage.PageId))
{
if (childPage.PageId == PageState.Page.PageId)
{
<li class="nav-item">
<a class="nav-link active" href="@GetUrl(childPage)" target="@GetTarget(childPage)">
<a class="nav-link active" @attributes="_attributes">
<span class="w-100" data-bs-toggle="collapse" data-bs-target=".navbar-collapse.show">
<span class="@childPage.Icon" aria-hidden="true" />
@childPage.Name <span class="visually-hidden-focusable">(current)</span>
Expand All @@ -48,7 +70,7 @@ else
else
{
<li class="nav-item">
<a class="nav-link" href="@GetUrl(childPage)" target="@GetTarget(childPage)">
<a class="nav-link" @attributes="_attributes">
<span class="w-100" data-bs-toggle="collapse" data-bs-target=".navbar-collapse.show">
<span class="@childPage.Icon" aria-hidden="true" />
@childPage.Name
Expand All @@ -62,7 +84,7 @@ else
if (childPage.PageId == PageState.Page.PageId)
{
<li class="nav-item dropdown active">
<a class="nav-link dropdown-toggle" href="@GetUrl(childPage)" target="@GetTarget(childPage)" id="@($"navbarDropdown{childPage.PageId}")" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<a class="nav-link dropdown-toggle" id="@($"navbarDropdown{childPage.PageId}")" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" @attributes="_attributes">
<span class="@childPage.Icon" aria-hidden="true" />
@childPage.Name <span class="visually-hidden-focusable">(current)</span>
</a>
Expand All @@ -72,7 +94,7 @@ else
else
{
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="@GetUrl(childPage)" target="@GetTarget(childPage)" id="@($"navbarDropdown{childPage.PageId}")" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<a class="nav-link dropdown-toggle" id="@($"navbarDropdown{childPage.PageId}")" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" @attributes="_attributes">
<span class="@childPage.Icon" aria-hidden="true" />
@childPage.Name
</a>
Expand Down
30 changes: 26 additions & 4 deletions Oqtane.Client/Themes/Controls/Theme/MenuItemsVertical.razor
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,21 @@
{
foreach (var childPage in GetChildPages())
{
var _attributes = new Dictionary<string, object>();
_attributes.Add("href", GetUrl(childPage));
var _target = GetTarget(childPage);
if (!string.IsNullOrEmpty(_target))
{
_attributes.Add("target", _target);
}
if (!string.IsNullOrEmpty(childPage.ThemeType))
{
_attributes.Add("data-enhance-nav", "false");
}
if (childPage.PageId == PageState.Page.PageId)
{
<li class="nav-item px-3" style="margin-left: @(childPage.Level * 15)px;">
<a class="nav-link active" href="@GetUrl(childPage)" target="@GetTarget(childPage)">
<a class="nav-link active" @attributes="_attributes">
<span class="w-100" data-bs-toggle="collapse" data-bs-target=".navbar-collapse.show">
<span class="@childPage.Icon" aria-hidden="true" />
@childPage.Name <span class="visually-hidden-focusable">(current)</span>
Expand All @@ -19,7 +30,7 @@
else
{
<li class="nav-item px-3" style="margin-left: @(childPage.Level * 15)px;">
<a class="nav-link" href="@GetUrl(childPage)" target="@GetTarget(childPage)">
<a class="nav-link" @attributes="_attributes">
<span class="w-100" data-bs-toggle="collapse" data-bs-target=".navbar-collapse.show">
<span class="@childPage.Icon" aria-hidden="true" />
@childPage.Name
Expand All @@ -38,10 +49,21 @@ else
<ul class="nav flex-column">
@foreach (var childPage in GetChildPages())
{
var _attributes = new Dictionary<string, object>();
_attributes.Add("href", GetUrl(childPage));
var _target = GetTarget(childPage);
if (!string.IsNullOrEmpty(_target))
{
_attributes.Add("target", _target);
}
if (!string.IsNullOrEmpty(childPage.ThemeType))
{
_attributes.Add("data-enhance-nav", "false");
}
if (childPage.PageId == PageState.Page.PageId)
{
<li class="nav-item px-3" style="margin-left: @(childPage.Level * 15)px;">
<a class="nav-link active" href="@GetUrl(childPage)" target="@GetTarget(childPage)">
<a class="nav-link active" @attributes="_attributes">
<span class="w-100" data-bs-toggle="collapse" data-bs-target=".navbar-collapse.show">
<span class="@childPage.Icon" aria-hidden="true" />
@childPage.Name <span class="visually-hidden-focusable">(current)</span>
Expand All @@ -52,7 +74,7 @@ else
else
{
<li class="nav-item px-3" style="margin-left: @(childPage.Level * 15)px;">
<a class="nav-link" href="@GetUrl(childPage)" target="@GetTarget(childPage)">
<a class="nav-link" @attributes="_attributes">
<span class="w-100" data-bs-toggle="collapse" data-bs-target=".navbar-collapse.show">
<span class="@childPage.Icon" aria-hidden="true" />
@childPage.Name
Expand Down

0 comments on commit 4262424

Please sign in to comment.