diff --git a/src/Umbraco.Core/Constants-Icons.cs b/src/Umbraco.Core/Constants-Icons.cs index 53501a012c90..cf2c263d83c7 100644 --- a/src/Umbraco.Core/Constants-Icons.cs +++ b/src/Umbraco.Core/Constants-Icons.cs @@ -67,7 +67,7 @@ public static class Icons /// /// System media audio icon. /// - public const string MediaAudio = "icon-sound-waves"; + public const string MediaAudio = "icon-audio-lines"; /// /// System media article icon @@ -77,7 +77,7 @@ public static class Icons /// /// System media vector icon. /// - public const string MediaVectorGraphics = "icon-picture"; + public const string MediaVectorGraphics = "icon-origami"; /// /// System media folder icon. diff --git a/src/Umbraco.Core/EmbeddedResources/Snippets/Breadcrumb.cshtml b/src/Umbraco.Core/EmbeddedResources/Snippets/Breadcrumb.cshtml index 612c80948779..e609ac7c684a 100644 --- a/src/Umbraco.Core/EmbeddedResources/Snippets/Breadcrumb.cshtml +++ b/src/Umbraco.Core/EmbeddedResources/Snippets/Breadcrumb.cshtml @@ -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) { diff --git a/src/Umbraco.Core/EmbeddedResources/Snippets/ListAncestorsFromCurrentPage.cshtml b/src/Umbraco.Core/EmbeddedResources/Snippets/ListAncestorsFromCurrentPage.cshtml index a0056976666d..1ab6c7fb1d08 100644 --- a/src/Umbraco.Core/EmbeddedResources/Snippets/ListAncestorsFromCurrentPage.cshtml +++ b/src/Umbraco.Core/EmbeddedResources/Snippets/ListAncestorsFromCurrentPage.cshtml @@ -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) { diff --git a/src/Umbraco.Core/EmbeddedResources/Snippets/ListChildPagesFromCurrentPage.cshtml b/src/Umbraco.Core/EmbeddedResources/Snippets/ListChildPagesFromCurrentPage.cshtml index 2a88e4766047..39cd12665b51 100644 --- a/src/Umbraco.Core/EmbeddedResources/Snippets/ListChildPagesFromCurrentPage.cshtml +++ b/src/Umbraco.Core/EmbeddedResources/Snippets/ListChildPagesFromCurrentPage.cshtml @@ -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 @* @@ -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) { diff --git a/src/Umbraco.Core/EmbeddedResources/Snippets/ListChildPagesOrderedByDate.cshtml b/src/Umbraco.Core/EmbeddedResources/Snippets/ListChildPagesOrderedByDate.cshtml index 168e9b63acf0..9b6796096ca2 100644 --- a/src/Umbraco.Core/EmbeddedResources/Snippets/ListChildPagesOrderedByDate.cshtml +++ b/src/Umbraco.Core/EmbeddedResources/Snippets/ListChildPagesOrderedByDate.cshtml @@ -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 @* @@ -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) { diff --git a/src/Umbraco.Core/EmbeddedResources/Snippets/ListChildPagesOrderedByName.cshtml b/src/Umbraco.Core/EmbeddedResources/Snippets/ListChildPagesOrderedByName.cshtml index aed9085a76de..575ecae74d3c 100644 --- a/src/Umbraco.Core/EmbeddedResources/Snippets/ListChildPagesOrderedByName.cshtml +++ b/src/Umbraco.Core/EmbeddedResources/Snippets/ListChildPagesOrderedByName.cshtml @@ -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 @* @@ -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) { } diff --git a/src/Umbraco.Core/EmbeddedResources/Snippets/ListChildPagesWithDoctype.cshtml b/src/Umbraco.Core/EmbeddedResources/Snippets/ListChildPagesWithDoctype.cshtml index 95a65d0af902..9b7b24abc000 100644 --- a/src/Umbraco.Core/EmbeddedResources/Snippets/ListChildPagesWithDoctype.cshtml +++ b/src/Umbraco.Core/EmbeddedResources/Snippets/ListChildPagesWithDoctype.cshtml @@ -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 @* @@ -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(VariationContextAccessor).Where(x => x.IsVisible(PublishedValueFallback)).ToArray(); } +@{ var selection = Model?.Content.Children(VariationContextAccessor, PublishedContentCache, DocumentNavigationQueryService).Where(x => x.IsVisible(PublishedValueFallback)).ToArray(); } @if (selection?.Length > 0) { diff --git a/src/Umbraco.Core/EmbeddedResources/Snippets/Navigation.cshtml b/src/Umbraco.Core/EmbeddedResources/Snippets/Navigation.cshtml index 75397076702e..3b737ad9b616 100644 --- a/src/Umbraco.Core/EmbeddedResources/Snippets/Navigation.cshtml +++ b/src/Umbraco.Core/EmbeddedResources/Snippets/Navigation.cshtml @@ -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 @* @@ -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) { diff --git a/src/Umbraco.Core/EmbeddedResources/Snippets/SiteMap.cshtml b/src/Umbraco.Core/EmbeddedResources/Snippets/SiteMap.cshtml index 20b31b6dcbf8..9f2c1c419382 100644 --- a/src/Umbraco.Core/EmbeddedResources/Snippets/SiteMap.cshtml +++ b/src/Umbraco.Core/EmbeddedResources/Snippets/SiteMap.cshtml @@ -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); }
@* Render the sitemap by passing the root node to the traverse method, below *@ @@ -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(); diff --git a/src/Umbraco.Web.UI.Client/src/mocks/data/media-type/media-type.data.ts b/src/Umbraco.Web.UI.Client/src/mocks/data/media-type/media-type.data.ts index 9378249bf40e..389ec141bae2 100644 --- a/src/Umbraco.Web.UI.Client/src/mocks/data/media-type/media-type.data.ts +++ b/src/Umbraco.Web.UI.Client/src/mocks/data/media-type/media-type.data.ts @@ -15,7 +15,7 @@ export const data: Array = [ parent: null, description: 'Media type 1 description', alias: 'mediaType1', - icon: 'icon-bug', + icon: 'icon-picture', properties: [ { id: '19', @@ -99,4 +99,204 @@ export const data: Array = [ isDeletable: false, aliasCanBeChanged: false, }, + { + name: 'Media Type 2', + id: 'media-type-2-id', + parent: null, + description: 'Media type 2 description', + alias: 'mediaType2', + icon: 'icon-audio-lines', + properties: [ + { + id: '19', + container: { id: 'c3cd2f12-b7c4-4206-8d8b-27c061589f75' }, + alias: 'umbracoFile', + name: 'File', + description: '', + dataType: { id: 'dt-uploadField' }, + variesByCulture: false, + variesBySegment: false, + sortOrder: 0, + validation: { + mandatory: true, + mandatoryMessage: null, + regEx: null, + regExMessage: null, + }, + appearance: { + labelOnTop: false, + }, + }, + ], + containers: [ + { + id: 'c3cd2f12-b7c4-4206-8d8b-27c061589f75', + parent: null, + name: 'Content', + type: 'Group', + sortOrder: 0, + }, + ], + allowedAsRoot: true, + variesByCulture: false, + variesBySegment: false, + isElement: false, + allowedMediaTypes: [{ mediaType: { id: 'media-type-2-id' }, sortOrder: 0 }], + compositions: [], + isFolder: false, + hasChildren: false, + collection: { id: 'dt-collectionView' }, + isDeletable: false, + aliasCanBeChanged: false, + }, + { + name: 'Media Type 3', + id: 'media-type-3-id', + parent: null, + description: 'Media type 3 description', + alias: 'mediaType3', + icon: 'icon-origami', + properties: [ + { + id: '19', + container: { id: 'c3cd2f12-b7c4-4206-8d8b-27c061589f75' }, + alias: 'umbracoFile', + name: 'File', + description: '', + dataType: { id: 'dt-uploadField' }, + variesByCulture: false, + variesBySegment: false, + sortOrder: 0, + validation: { + mandatory: true, + mandatoryMessage: null, + regEx: null, + regExMessage: null, + }, + appearance: { + labelOnTop: false, + }, + }, + ], + containers: [ + { + id: 'c3cd2f12-b7c4-4206-8d8b-27c061589f75', + parent: null, + name: 'Content', + type: 'Group', + sortOrder: 0, + }, + ], + allowedAsRoot: true, + variesByCulture: false, + variesBySegment: false, + isElement: false, + allowedMediaTypes: [{ mediaType: { id: 'media-type-3-id' }, sortOrder: 0 }], + compositions: [], + isFolder: false, + hasChildren: false, + collection: { id: 'dt-collectionView' }, + isDeletable: false, + aliasCanBeChanged: false, + }, + { + name: 'Media Type 4', + id: 'media-type-4-id', + parent: null, + description: 'Media type 4 description', + alias: 'mediaType4', + icon: 'icon-video', + properties: [ + { + id: '19', + container: { id: 'c3cd2f12-b7c4-4206-8d8b-27c061589f75' }, + alias: 'umbracoFile', + name: 'File', + description: '', + dataType: { id: 'dt-uploadField' }, + variesByCulture: false, + variesBySegment: false, + sortOrder: 0, + validation: { + mandatory: true, + mandatoryMessage: null, + regEx: null, + regExMessage: null, + }, + appearance: { + labelOnTop: false, + }, + }, + ], + containers: [ + { + id: 'c3cd2f12-b7c4-4206-8d8b-27c061589f75', + parent: null, + name: 'Content', + type: 'Group', + sortOrder: 0, + }, + ], + allowedAsRoot: true, + variesByCulture: false, + variesBySegment: false, + isElement: false, + allowedMediaTypes: [{ mediaType: { id: 'media-type-4-id' }, sortOrder: 0 }], + compositions: [], + isFolder: false, + hasChildren: false, + collection: { id: 'dt-collectionView' }, + isDeletable: false, + aliasCanBeChanged: false, + }, + { + name: 'Media Type 5', + id: 'media-type-5-id', + parent: null, + description: 'Media type 5 description', + alias: 'mediaType5', + icon: 'icon-document', + properties: [ + { + id: '19', + container: { id: 'c3cd2f12-b7c4-4206-8d8b-27c061589f75' }, + alias: 'umbracoFile', + name: 'File', + description: '', + dataType: { id: 'dt-uploadField' }, + variesByCulture: false, + variesBySegment: false, + sortOrder: 0, + validation: { + mandatory: true, + mandatoryMessage: null, + regEx: null, + regExMessage: null, + }, + appearance: { + labelOnTop: false, + }, + }, + ], + containers: [ + { + id: 'c3cd2f12-b7c4-4206-8d8b-27c061589f75', + parent: null, + name: 'Content', + type: 'Group', + sortOrder: 0, + }, + ], + allowedAsRoot: true, + variesByCulture: false, + variesBySegment: false, + isElement: false, + allowedMediaTypes: [{ mediaType: { id: 'media-type-5-id' }, sortOrder: 0 }], + compositions: [], + isFolder: false, + hasChildren: false, + collection: { id: 'dt-collectionView' }, + isDeletable: false, + aliasCanBeChanged: false, + }, ]; diff --git a/src/Umbraco.Web.UI.Client/src/mocks/handlers/media-type/tree.handlers.ts b/src/Umbraco.Web.UI.Client/src/mocks/handlers/media-type/tree.handlers.ts index 2d113dee3501..75683e8e545f 100644 --- a/src/Umbraco.Web.UI.Client/src/mocks/handlers/media-type/tree.handlers.ts +++ b/src/Umbraco.Web.UI.Client/src/mocks/handlers/media-type/tree.handlers.ts @@ -19,4 +19,11 @@ export const treeHandlers = [ const response = umbMediaTypeMockDb.tree.getChildrenOf({ parentId, skip, take }); return res(ctx.status(200), ctx.json(response)); }), + + rest.get(umbracoPath(`/tree${UMB_SLUG}/ancestors`), (req, res, ctx) => { + const id = req.url.searchParams.get('descendantId'); + if (!id) return; + const response = umbMediaTypeMockDb.tree.getAncestorsOf({ descendantId: id }); + return res(ctx.status(200), ctx.json(response)); + }), ]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/icon-registry/icon-dictionary.json b/src/Umbraco.Web.UI.Client/src/packages/core/icon-registry/icon-dictionary.json index d35848792777..2cd9c3caeecd 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/icon-registry/icon-dictionary.json +++ b/src/Umbraco.Web.UI.Client/src/packages/core/icon-registry/icon-dictionary.json @@ -72,6 +72,10 @@ "name": "icon-attachment", "file": "paperclip.svg" }, + { + "name": "icon-audio-lines", + "file": "audio-lines.svg" + }, { "name": "icon-autofill", "file": "text-cursor-input.svg" @@ -1374,6 +1378,10 @@ "name": "icon-ordered-list", "file": "list-ordered.svg" }, + { + "name": "icon-origami", + "file": "origami.svg" + }, { "name": "icon-out", "file": "external-link.svg" @@ -2712,4 +2720,4 @@ "file": "icon-umbraco.svg" } ] -} +} \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/icon-registry/icons.ts b/src/Umbraco.Web.UI.Client/src/packages/core/icon-registry/icons.ts index 8855310df5ae..f02b1643b8a7 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/icon-registry/icons.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/icon-registry/icons.ts @@ -71,6 +71,10 @@ name: "icon-attachment", path: () => import("./icons/icon-attachment.js"), },{ +name: "icon-audio-lines", + +path: () => import("./icons/icon-audio-lines.js"), +},{ name: "icon-autofill", path: () => import("./icons/icon-autofill.js"), @@ -1299,6 +1303,10 @@ name: "icon-ordered-list", path: () => import("./icons/icon-ordered-list.js"), },{ +name: "icon-origami", + +path: () => import("./icons/icon-origami.js"), +},{ name: "icon-out", path: () => import("./icons/icon-out.js"), diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/icon-registry/icons/icon-audio-lines.ts b/src/Umbraco.Web.UI.Client/src/packages/core/icon-registry/icons/icon-audio-lines.ts new file mode 100644 index 000000000000..d2aa21c15467 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/icon-registry/icons/icon-audio-lines.ts @@ -0,0 +1,19 @@ +export default ` + + + + + + + + +`; \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/icon-registry/icons/icon-origami.ts b/src/Umbraco.Web.UI.Client/src/packages/core/icon-registry/icons/icon-origami.ts new file mode 100644 index 000000000000..bf9f34a255a4 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/icon-registry/icons/icon-origami.ts @@ -0,0 +1,16 @@ +export default ` + + + + + +`; \ No newline at end of file diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/Importing/StandardMvc-Package.xml b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/Importing/StandardMvc-Package.xml index 5bba7cfa4ec5..f3780e1df80f 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/Importing/StandardMvc-Package.xml +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/Importing/StandardMvc-Package.xml @@ -927,7 +927,7 @@ /* This is your basic query to select the nodes you want */ - var nodes = Model.Content.Children.Where(x => x.DocumentTypeAlias == "NewsArticle").OrderBy(x=>x.CreateDate); + var nodes = Model.Content.Children().Where(x => x.DocumentTypeAlias == "NewsArticle").OrderBy(x=>x.CreateDate); int totalNodes = nodes.Count(); int totalPages = (int)Math.Ceiling((double)totalNodes / (double)pageSize); @@ -1023,7 +1023,7 @@ x.IsVisible() && x.TemplateId > 0 && Umbraco.MemberHasAccess(x.Id, x.Path)); + var pages = Model.Content.Children().Where(x => x.IsVisible() && x.TemplateId > 0 && Umbraco.MemberHasAccess(x.Id, x.Path)); }
@@ -1347,7 +1347,7 @@ @helper traverse(IPublishedContent node) { - var cc = node.Children.Where(x=>x.IsVisible() && x.TemplateId > 0); + var cc = node.Children().Where(x=>x.IsVisible() && x.TemplateId > 0); if (cc.Count()>0) {