Update Umbraco to 7.12.2

This commit is contained in:
2018-09-16 15:08:47 -04:00
parent 7ed7776432
commit 616ab81bad
764 changed files with 142787 additions and 66790 deletions
@@ -1,24 +1,25 @@
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@using Umbraco.Web
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@*
This snippet makes a breadcrumb of parents using an unordered html list.
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
- Finally it outputs the name of the current page (without a link)
*@
@{ var selection = CurrentPage.Ancestors(); }
@{ var selection = Model.Content.Ancestors().ToArray(); }
@if (selection.Any())
@if (selection.Length > 0)
{
<ul class="breadcrumb">
@* For each page in the ancestors collection which have been ordered by Level (so we start with the highest top node first) *@
@foreach (var item in selection.OrderBy("Level"))
@foreach (var item in selection.OrderBy(x => x.Level))
{
<li><a href="@item.Url">@item.Name</a> <span class="divider">/</span></li>
}
@* Display the current page as the last item in the list *@
<li class="active">@CurrentPage.Name</li>
<li class="active">@Model.Content.Name</li>
</ul>
}
@@ -1,50 +1,47 @@
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@*
Macro to display a gallery of images from media the media section.
Macro to display a gallery of images from the Media section.
Works with either a 'Single Media Picker' or a 'Multiple Media Picker' macro parameter (see below).
How it works:
- Confirm the macro parameter has been passed in with a value
- Loop through all the media Id's passed in (might be a single item, might be many)
- Loop through all the media Ids passed in (might be a single item, might be many)
- Display any individual images, as well as any folders of images
Macro Parameters To Create, for this macro to work:
Alias:mediaIds Name:Select folders and/or images Type: Multiple Media Picker
Type: (note: you can use a Single Media Picker if that's more appropriate to your needs)
Type: (note: You can use a Single Media Picker if that's more appropriate to your needs)
*@
@{ var mediaIds = Model.MacroParameters["mediaIds"]; }
@{ var mediaIds = Model.MacroParameters["mediaIds"] as string; }
@if (mediaIds != null)
{
<ul class="thumbnails">
@foreach (var mediaId in mediaIds.ToString().Split(','))
<div class="row">
@foreach (var mediaId in mediaIds.Split(','))
{
var media = Umbraco.Media(mediaId);
var media = Umbraco.TypedMedia(mediaId);
@* a single image *@
if (media.DocumentTypeAlias == "Image")
{
@Render(media);
@Render(media as Image);
}
@* a folder with images under it *@
if (media.Children("Image").Any())
foreach (var image in media.Children<Image>())
{
foreach (var image in media.Children("Image"))
{
@Render(image);
}
@Render(image);
}
}
</ul>
</div>
}
@helper Render(dynamic item)
@helper Render(Image item)
{
<li class="span2">
<a href="@item.umbracoFile.src" class="thumbnail">
<img src="@item.umbracoFile.src" alt="@item.Name" />
<div class="col-xs-6 col-md-3">
<a href="@item.Url" class="thumbnail">
<img src="@item.GetCropUrl(width:200, height:200)" alt="@item.Name" />
</a>
</li>
</div>
}
@@ -1,24 +1,25 @@
@using Umbraco.Web
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@*
This snippet makes a list of links to the of parents of the current page using an unordered html list.
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
- Finally it outputs the name of the current page (without a link)
*@
@{ var selection = CurrentPage.Ancestors(); }
@{ var selection = Model.Content.Ancestors().ToArray(); }
@if (selection.Any())
@if (selection.Length > 0)
{
<ul>
@* For each page in the ancestors collection which have been ordered by Level (so we start with the highest top node first) *@
@foreach (var item in selection.OrderBy("Level"))
@foreach (var item in selection.OrderBy(x => x.Level))
{
<li><a href="@item.Url">@item.Name</a> &raquo;</li>
}
@* Display the current page as the last item in the list *@
<li>@CurrentPage.Name</li>
<li>@Model.Content.Name</li>
</ul>
}
@@ -1,3 +1,4 @@
@using Umbraco.Web
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@*
@@ -13,20 +14,19 @@
*@
@{ var startNodeId = Model.MacroParameters["startNodeId"]; }
@if (startNodeId != null)
{
@* Get the starting page *@
var startNode = Umbraco.Content(startNodeId);
var selection = startNode.Children.Where("Visible");
var startNode = Umbraco.TypedContent(startNodeId);
var selection = startNode.Children.Where(x => x.IsVisible()).ToArray();
if (selection.Any())
if (selection.Length > 0)
{
<ul>
@foreach (var item in selection)
{
<li>
<a href="@item.Url">@item.Name</a>
</li>
<li><a href="@item.Url">@item.Name</a></li>
}
</ul>
}
@@ -1,8 +1,17 @@
@using Umbraco.Web
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{ var selection = CurrentPage.Children.Where("Visible"); }
@*
This snippet makes a list of links to the of children of the current page using an unordered HTML list.
@if (selection.Any())
How it works:
- It uses the Children method to get all child pages
- It then generates links so the visitor can go to each page
*@
@{ var selection = Model.Content.Children.Where(x => x.IsVisible()).ToArray(); }
@if (selection.Length > 0)
{
<ul>
@foreach (var item in selection)
@@ -1,11 +1,23 @@
@using Umbraco.Web
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{ var selection = CurrentPage.Children.Where("Visible").OrderBy("CreateDate desc"); }
@* OrderBy() takes the property to sort by and optionally order desc/asc *@
@*
This snippet makes a list of links to the of children of the current page using an unordered HTML list.
<ul>
@foreach (var item in selection)
{
<li><a href="@item.Url">@item.Name</a></li>
}
</ul>
How it works:
- It uses the Children method to get all child pages
- It then uses the OrderByDescending() method, which takes the property to sort. In this case the page's creation date.
- It then generates links so the visitor can go to each page
*@
@{ var selection = Model.Content.Children.Where(x => x.IsVisible()).OrderByDescending(x => x.CreateDate).ToArray(); }
@if (selection.Length > 0)
{
<ul>
@foreach (var item in selection)
{
<li><a href="@item.Url">@item.Name</a></li>
}
</ul>
}
@@ -1,11 +1,23 @@
@using Umbraco.Web
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{ var selection = CurrentPage.Children.Where("Visible").OrderBy("Name"); }
@* OrderBy() takes the property to sort by *@
@*
This snippet makes a list of links to the of children of the current page using an unordered HTML list.
<ul>
@foreach (var item in selection)
{
<li><a href="@item.Url">@item.Name</a></li>
}
</ul>
How it works:
- It uses the Children method to get all child pages
- It then uses the OrderBy() method, which takes the property to sort. In this case, the page's name.
- It then generates links so the visitor can go to each page
*@
@{ var selection = Model.Content.Children.Where(x => x.IsVisible()).OrderBy(x => x.Name).ToArray(); }
@if (selection.Length > 0)
{
<ul>
@foreach (var item in selection)
{
<li><a href="@item.Url">@item.Name</a></li>
}
</ul>
}
@@ -1,3 +1,4 @@
@using Umbraco.Web
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@*
@@ -15,12 +16,15 @@
@{ var propertyAlias = Model.MacroParameters["propertyAlias"]; }
@if (propertyAlias != null)
{
var selection = CurrentPage.Children.Where("Visible").OrderBy(propertyAlias);
var selection = Model.Content.Children.Where(x => x.IsVisible()).OrderBy(x => x.GetPropertyValue(propertyAlias.ToString())).ToArray();
<ul>
@foreach (var item in selection)
{
<li><a href="@item.Url">@item.Name</a></li>
}
</ul>
if (selection.Length > 0)
{
<ul>
@foreach (var item in selection)
{
<li><a href="@item.Url">@item.Name</a></li>
}
</ul>
}
}
@@ -1,19 +1,17 @@
@using Umbraco.Core.Models
@using Umbraco.Web
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@*
This snippet shows how simple it is to fetch only children of a certain Document Type using Razor.
Be sure to change "DocumentTypeAlias" below to match your needs, such as "TextPage" or "NewsItems".
This snippet shows how simple it is to fetch only children of a certain Document Type.
Be sure to change "IPublishedContent" below to match your needs, such as "TextPage" or "NewsItem".
(You can find the alias of your Document Type by editing it in the Settings section)
*@
@{ var selection = CurrentPage.Children("DocumentTypeAlias").Where("Visible"); }
@*
As an example of more querying, if you have a true/false property with the alias of shouldBeFeatured:
var selection= CurrentPage.Children("DocumentTypeAlias").Where("shouldBeFeatured == true").Where("Visible");
*@
@{ var selection = Model.Content.Children<IPublishedContent>().Where(x => x.IsVisible()).ToArray(); }
@if (selection.Any())
@if (selection.Length > 0)
{
<ul>
@foreach (var item in selection)
@@ -1,31 +1,36 @@
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using Umbraco.Core.Models
@using Umbraco.Web
@*
This snippet creates links for every single page (no matter how deep) below
the page currently being viewed by the website visitor, displayed as nested unordered html lists.
the page currently being viewed by the website visitor, displayed as nested unordered HTML lists.
*@
@{ var selection = CurrentPage.Children.Where("Visible"); }
@{ var selection = Model.Content.Children.Where(x => x.IsVisible()).ToArray(); }
@* Ensure that the Current Page has children *@
@if (selection.Any())
@if (selection.Length > 0)
{
@* Get the first page in the children, where the property umbracoNaviHide is not True *@
var naviLevel = CurrentPage.FirstChild().Where("Visible").Level;
var naviLevel = selection[0].Level;
@* Add in level for a CSS hook *@
<ul class="level-@naviLevel">
@* For each child page where the property umbracoNaviHide is not True *@
<ul class="level-@(naviLevel)">
@* Loop through the selection *@
@foreach (var item in selection)
{
<li>
<a href="@item.Url">@item.Name</a>
@* if this child page has any children, where the property umbracoNaviHide is not True *@
@if (item.Children.Where("Visible").Any())
{
@* Call our helper to display the children *@
@childPages(item.Children)
@{
var children = item.Children.Where(x => x.IsVisible()).ToArray();
if (children.Length > 0)
{
@* Call our helper to display the children *@
@ChildPages(children)
}
}
</li>
}
@@ -33,26 +38,29 @@
}
@helper childPages(dynamic selection)
@helper ChildPages(IPublishedContent[] selection)
{
@* Ensure that we have a collection of pages *@
if (selection.Any())
if (selection.Length > 0)
{
@* Get the first page in pages and get the level *@
var naviLevel = selection.First().Level;
@* Get the first page in pages and get the level *@
var naviLevel = selection[0].Level;
@* Add in level for a CSS hook *@
@* Add in level for a CSS hook *@
<ul class="level-@(naviLevel)">
@foreach (var item in selection.Where("Visible"))
@foreach (var item in selection)
{
<li>
<a href="@item.Url">@item.Name</a>
@* if the this page has any children, where the property umbracoNaviHide is not True *@
@if (item.Children.Where("Visible").Any())
{
@* Call our helper to display the children *@
@childPages(item.Children)
@* if the page has any children, where the property umbracoNaviHide is not True *@
@{
var children = item.Children.Where(x => x.IsVisible()).ToArray();
if (children.Length > 0)
{
@* Recurse and call our helper to display the children *@
@ChildPages(children)
}
}
</li>
}
@@ -5,7 +5,7 @@
How it works:
- Confirm the macro parameter has been passed in with a value
- Loop through all the media Id's passed in (might be a single item, might be many)
- Loop through all the media Ids passed in (might be a single item, might be many)
- Display any individual images, as well as any folders of images
Macro Parameters To Create, for this macro to work:
@@ -15,17 +15,17 @@
@{ var mediaId = Model.MacroParameters["mediaId"]; }
@if (mediaId != null)
{
@* Get all the media item associated with the id passed in *@
var media = Umbraco.Media(mediaId);
var selection = media.Children("Image");
@* Get the media item associated with the id passed in *@
var media = Umbraco.TypedMedia(mediaId);
var selection = media.Children<Image>().ToArray();
if (selection.Any())
if (selection.Length > 0)
{
<ul>
@foreach (var item in selection)
{
<li>
<img src="@item.umbracoFile" alt="@item.Name" />
<img src="@item.Url" alt="@item.Name" />
</li>
}
</ul>
@@ -1,21 +1,25 @@
@using Umbraco.Core.Models
@using Umbraco.Web
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@*
This snippet lists the items from a Multinode tree picker, using the pickers default settings.
Content Values stored as xml.
This snippet lists the items from a Multinode tree picker, using the picker's default settings.
Content Values stored as XML.
To get it working with any site's data structure, set the selection equal to the property which has the
multinode treepicker (so: replace "PropertyWithPicker" with the alias of your property).
*@
@{ var selection = CurrentPage.PropertyWithPicker.Split(','); }
@{ var selection = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("PropertyWithPicker").ToArray(); }
<ul>
@foreach (var id in selection)
{
var item = Umbraco.Content(id);
<li>
<a href="@item.Url">@item.Name</a>
</li>
}
</ul>
@if (selection.Length > 0)
{
<ul>
@foreach (var item in selection)
{
<li>
<a href="@item.Url">@item.Name</a>
</li>
}
</ul>
}
@@ -1,18 +1,22 @@
@using Umbraco.Web
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@*
This snippet displays a list of links of the pages immediately under the top-most page in the content tree.
This is the home page for a standard website.
It also highlights the current active page/section in the navigation with the css class "current".
It also highlights the current active page/section in the navigation with the CSS class "current".
*@
@{ var selection = CurrentPage.Site().Children.Where("Visible"); }
@{ var selection = Model.Content.Site().Children.Where(x => x.IsVisible()).ToArray(); }
<ul>
@foreach (var item in selection)
{
<li class="@(item.IsAncestorOrSelf(CurrentPage) ? "current" : null)">
<a href="@item.Url">@item.Name</a>
</li>
}
</ul>
@if (selection.Length > 0)
{
<ul>
@foreach (var item in selection)
{
<li class="@(item.IsAncestorOrSelf(Model.Content) ? "current" : null)">
<a href="@item.Url">@item.Name</a>
</li>
}
</ul>
}
@@ -47,7 +47,7 @@
@if (success)
{
@* This message will show if RedirectOnSucces is set to false (default) *@
<p>Registration succeeeded.</p>
<p>Registration succeeded.</p>
}
else
{
@@ -101,4 +101,4 @@ else
<button>Register</button>
</fieldset>
}
}
}
@@ -1,13 +1,15 @@
@using Umbraco.Core.Models
@using Umbraco.Web
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@*
This snippet makes a list of links of all visible pages of the site, as nested unordered html lists.
This snippet makes a list of links of all visible pages of the site, as nested unordered HTML lists.
How it works:
- It uses a custom Razor helper called Traverse() to select and display the markup and links.
*@
@{ var selection = CurrentPage.Site(); }
@{ var selection = Model.Content.Site(); }
<div class="sitemap">
@* Render the sitemap by passing the root node to the traverse helper, below *@
@@ -15,17 +17,17 @@
</div>
@* Helper method to travers through all descendants *@
@helper Traverse(dynamic node)
@* Helper method to traverse through all descendants *@
@helper Traverse(IPublishedContent node)
{
@* Update the level to reflect how deep you want the sitemap to go *@
var maxLevelForSitemap = 4;
const int maxLevelForSitemap = 4;
@* Select visible children *@
var selection = node.Children.Where("Visible").Where("Level <= " + maxLevelForSitemap);
var selection = node.Children.Where(x => x.IsVisible() && x.Level <= maxLevelForSitemap).ToArray();
@* If any items are returned, render a list *@
if (selection.Any())
if (selection.Length > 0)
{
<ul>
@foreach (var item in selection)