Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/v15/dev' into v15/f…
Browse files Browse the repository at this point in the history
…ix/17521-expose-fully-invariant-variant-elements
  • Loading branch information
elit0451 committed Nov 25, 2024
2 parents a62cdbe + 4a19d89 commit c2e572a
Show file tree
Hide file tree
Showing 16 changed files with 310 additions and 32 deletions.
4 changes: 2 additions & 2 deletions src/Umbraco.Core/Constants-Icons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static class Icons
/// <summary>
/// System media audio icon.
/// </summary>
public const string MediaAudio = "icon-sound-waves";
public const string MediaAudio = "icon-audio-lines";

/// <summary>
/// System media article icon
Expand All @@ -77,7 +77,7 @@ public static class Icons
/// <summary>
/// System media vector icon.
/// </summary>
public const string MediaVectorGraphics = "icon-picture";
public const string MediaVectorGraphics = "icon-origami";

/// <summary>
/// System media folder icon.
Expand Down
9 changes: 6 additions & 3 deletions src/Umbraco.Core/EmbeddedResources/Snippets/Breadcrumb.cshtml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
@using Umbraco.Cms.Core.PublishedCache
@using Umbraco.Cms.Core.Routing
@using Umbraco.Extensions
@using Umbraco.Cms.Core.Services.Navigation
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
@inject IPublishedContentCache PublishedContentCache
@inject IDocumentNavigationQueryService DocumentNavigationQueryService
@inject IPublishedUrlProvider PublishedUrlProvider
@*
This snippet makes a breadcrumb of parents using an unordered HTML list.
How it works:
- It uses the Ancestors() method to get all parents and then generates links so the visitor can go back
- It uses the Ancestors method to get all parents and then generates links so the visitor can go back
- Finally it outputs the name of the current page (without a link)
*@

@{ var selection = Model?.Content.Ancestors().ToArray(); }
@{ var selection = Model?.Content.Ancestors(PublishedContentCache, DocumentNavigationQueryService).ToArray(); }

@if (selection?.Length > 0)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
@using Umbraco.Cms.Core.PublishedCache
@using Umbraco.Cms.Core.Routing
@using Umbraco.Extensions
@using Umbraco.Cms.Core.Services.Navigation
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
@inject IPublishedContentCache PublishedContentCache
@inject IDocumentNavigationQueryService DocumentNavigationQueryService
@inject IPublishedUrlProvider PublishedUrlProvider
@*
This snippet makes a list of links to the of parents of the current page using an unordered HTML list.
How it works:
- It uses the Ancestors() method to get all parents and then generates links so the visitor can go back
- It uses the Ancestors method to get all parents and then generates links so the visitor can go back
- Finally it outputs the name of the current page (without a link)
*@

@{ var selection = Model?.Content.Ancestors().ToArray(); }
@{ var selection = Model?.Content.Ancestors(PublishedContentCache, DocumentNavigationQueryService).ToArray(); }

@if (selection?.Length > 0)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
@using Umbraco.Cms.Core
@using Umbraco.Cms.Core.Models.PublishedContent
@using Umbraco.Cms.Core.PublishedCache
@using Umbraco.Cms.Core.Routing
@using Umbraco.Extensions
@using Umbraco.Cms.Core.Services.Navigation
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
@inject IVariationContextAccessor VariationContextAccessor
@inject IPublishedContentCache PublishedContentCache
@inject IDocumentNavigationQueryService DocumentNavigationQueryService
@inject IPublishedValueFallback PublishedValueFallback
@inject IPublishedUrlProvider PublishedUrlProvider
@*
Expand All @@ -13,7 +16,7 @@
- It then generates links so the visitor can go to each page
*@

@{ var selection = Model?.Content.Children.Where(x => x.IsVisible(PublishedValueFallback)).ToArray(); }
@{ var selection = Model?.Content.Children(VariationContextAccessor, PublishedContentCache, DocumentNavigationQueryService).Where(x => x.IsVisible(PublishedValueFallback)).ToArray(); }

@if (selection?.Length > 0)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
@using Umbraco.Cms.Core
@using Umbraco.Cms.Core.Models.PublishedContent
@using Umbraco.Cms.Core.PublishedCache
@using Umbraco.Cms.Core.Routing
@using Umbraco.Extensions
@using Umbraco.Cms.Core.Services.Navigation
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
@inject IVariationContextAccessor VariationContextAccessor
@inject IPublishedContentCache PublishedContentCache
@inject IDocumentNavigationQueryService DocumentNavigationQueryService
@inject IPublishedValueFallback PublishedValueFallback
@inject IPublishedUrlProvider PublishedUrlProvider
@*
Expand All @@ -14,7 +17,7 @@
- It then generates links so the visitor can go to each page
*@

@{ var selection = Model?.Content.Children.Where(x => x.IsVisible(PublishedValueFallback)).OrderByDescending(x => x.CreateDate).ToArray(); }
@{ var selection = Model?.Content.Children(VariationContextAccessor, PublishedContentCache, DocumentNavigationQueryService).Where(x => x.IsVisible(PublishedValueFallback)).OrderByDescending(x => x.CreateDate).ToArray(); }

@if (selection?.Length > 0)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
@using Umbraco.Cms.Core
@using Umbraco.Cms.Core.Models.PublishedContent
@using Umbraco.Cms.Core.PublishedCache
@using Umbraco.Cms.Core.Routing
@using Umbraco.Extensions
@using Umbraco.Cms.Core.Services.Navigation
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
@inject IVariationContextAccessor VariationContextAccessor
@inject IPublishedContentCache PublishedContentCache
@inject IDocumentNavigationQueryService DocumentNavigationQueryService
@inject IPublishedValueFallback PublishedValueFallback
@inject IPublishedUrlProvider PublishedUrlProvider
@*
Expand All @@ -14,14 +17,14 @@
- It then generates links so the visitor can go to each page
*@

@{ var selection = Model?.Content.Children.Where(x => x.IsVisible(PublishedValueFallback)).OrderBy(x => x.Name).ToArray(); }
@{ var selection = Model?.Content.Children(VariationContextAccessor, PublishedContentCache, DocumentNavigationQueryService).Where(x => x.IsVisible(PublishedValueFallback)).OrderBy(x => x.Name).ToArray(); }

@if (selection?.Length > 0)
{
<ul>
@foreach (var item in selection)
{
<li><a href="@item.Url(PublishedUrlProvider))">@item.Name</a></li>
<li><a href="@item.Url(PublishedUrlProvider)">@item.Name</a></li>
}
</ul>
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
@using Umbraco.Cms.Core
@using Umbraco.Cms.Core.Models.PublishedContent
@using Umbraco.Cms.Core.PublishedCache
@using Umbraco.Cms.Core.Routing
@using Umbraco.Extensions
@using Umbraco.Cms.Core.Services.Navigation
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
@inject IVariationContextAccessor VariationContextAccessor
@inject IPublishedContentCache PublishedContentCache
@inject IDocumentNavigationQueryService DocumentNavigationQueryService
@inject IPublishedValueFallback PublishedValueFallback
@inject IPublishedUrlProvider PublishedUrlProvider
@*
Expand All @@ -13,7 +15,7 @@
(You can find the alias of your Document Type by editing it in the Settings section)
*@

@{ var selection = Model?.Content.Children<IPublishedContent>(VariationContextAccessor).Where(x => x.IsVisible(PublishedValueFallback)).ToArray(); }
@{ var selection = Model?.Content.Children<IPublishedContent>(VariationContextAccessor, PublishedContentCache, DocumentNavigationQueryService).Where(x => x.IsVisible(PublishedValueFallback)).ToArray(); }

@if (selection?.Length > 0)
{
Expand Down
9 changes: 6 additions & 3 deletions src/Umbraco.Core/EmbeddedResources/Snippets/Navigation.cshtml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
@using Umbraco.Cms.Core
@using Umbraco.Cms.Core.Models.PublishedContent
@using Umbraco.Cms.Core.PublishedCache
@using Umbraco.Cms.Core.Routing
@using Umbraco.Extensions
@using Umbraco.Cms.Core.Services.Navigation
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
@inject IVariationContextAccessor VariationContextAccessor
@inject IPublishedContentCache PublishedContentCache
@inject IDocumentNavigationQueryService DocumentNavigationQueryService
@inject IPublishedValueFallback PublishedValueFallback
@inject IPublishedUrlProvider PublishedUrlProvider
@*
Expand All @@ -11,7 +14,7 @@
It also highlights the current active page/section in the navigation with the CSS class "current".
*@

@{ var selection = Model?.Content.Root().Children.Where(x => x.IsVisible(PublishedValueFallback)).ToArray(); }
@{ var selection = Model?.Content.Root(PublishedContentCache, DocumentNavigationQueryService).Children(VariationContextAccessor, PublishedContentCache, DocumentNavigationQueryService).Where(x => x.IsVisible(PublishedValueFallback)).ToArray(); }

@if (selection?.Length > 0)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Umbraco.Core/EmbeddedResources/Snippets/SiteMap.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- It uses a local method called Traverse() to select and display the markup and links.
*@

@{ var selection = Model?.Content.Root(); }
@{ var selection = Model?.Content.Root(PublishedContentCache, DocumentNavigationQueryService); }

<div class="sitemap">
@* Render the sitemap by passing the root node to the traverse method, below *@
Expand All @@ -26,13 +26,13 @@

@* Helper method to traverse through all descendants *@
@{
void Traverse(IPublishedContent? node)
void Traverse(IPublishedContent node)
{
//Update the level to reflect how deep you want the sitemap to go
const int maxLevelForSitemap = 4;

@* Select visible children *@
var selection = node?
var selection = node
.Children(VariationContextAccessor, PublishedContentCache, DocumentNavigationQueryService)
.Where(x => x.IsVisible(PublishedValueFallback) && x.Level <= maxLevelForSitemap)
.ToArray();
Expand Down
Loading

0 comments on commit c2e572a

Please sign in to comment.