#U4-4153 Fixed Macro snippets refer to 'MediaCurrent' and 'Show', also polishes other snippets a bit
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
@inherits umbraco.MacroEngines.DynamicNodeContext
|
||||
|
||||
@*
|
||||
This snippet makes a breadcrumb of parents using an unordred html list.
|
||||
|
||||
How it works:
|
||||
- It uses the Ancestors() method to get all parents and then generates links so the visitor get go back
|
||||
- Finally it outputs the name of the current page (without a link)
|
||||
*@
|
||||
|
||||
@*
|
||||
This snippet makes a breadcrumb of parents using an unordred html list.
|
||||
|
||||
How it works:
|
||||
- It uses the Ancestors() method to get all parents and then generates links so the visitor get go back
|
||||
- Finally it outputs the name of the current page (without a link)
|
||||
*@
|
||||
|
||||
|
||||
@if (Model.Ancestors().Any())
|
||||
{
|
||||
{
|
||||
<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 page in Model.Ancestors().OrderBy("Level"))
|
||||
{
|
||||
<li><a href="@page.Url">@page.Name</a> <span class="divider">/</span></li>
|
||||
}
|
||||
}
|
||||
|
||||
@* Display the current page as the last item in the list *@
|
||||
<li class="active">@Model.Name</li>
|
||||
</ul>
|
||||
</ul>
|
||||
}
|
||||
@@ -11,7 +11,5 @@
|
||||
@Library.NodeById(1233)
|
||||
*@
|
||||
|
||||
|
||||
|
||||
@* The fun starts here *@
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
@inherits umbraco.MacroEngines.DynamicNodeContext
|
||||
|
||||
@*
|
||||
Macro to display a gallery from a media folder. Add the below parameter to the macro
|
||||
and use it to point the macro at a specific media folder to display it's content as
|
||||
a simple list.
|
||||
Macro to display a gallery from a media folder. Add the below parameter to the macro
|
||||
and use it to point the macro at a specific media folder to display it's content as
|
||||
a simple list.
|
||||
|
||||
Macro Parameters To Create, for this macro to work:
|
||||
Show:True Alias:mediaId Name:Media Folder ID Type:MediaCurrent
|
||||
Macro Parameters To Create, for this macro to work:
|
||||
Alias:mediaId Name:Media Folder ID Type:Single Media Picker
|
||||
*@
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@inherits umbraco.MacroEngines.DynamicNodeContext
|
||||
@*
|
||||
=== Macro Parameters To Create ===
|
||||
Show:True Alias:nodeId Name:Node ID Type:Content Picker
|
||||
Alias:nodeId Name:Node ID Type:Content Picker
|
||||
*@
|
||||
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
|
||||
<ul>
|
||||
@*OrderBy() takes the property to sort by and optionally order desc/asc *@
|
||||
|
||||
@* OrderBy() takes the property to sort by and optionally order desc/asc *@
|
||||
@foreach (var page in Model.Children.Where("Visible").OrderBy("CreateDate desc"))
|
||||
{
|
||||
<li><a href="@page.Url">@page.Name</a></li>
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
@inherits umbraco.MacroEngines.DynamicNodeContext
|
||||
|
||||
|
||||
<ul>
|
||||
@*OrderBy() takes the property to sort by*@
|
||||
@* OrderBy() takes the property to sort by *@
|
||||
@foreach (var page in Model.Children.Where("Visible").OrderBy("Name"))
|
||||
{
|
||||
<li><a href="@page.Url">@page.Name</a></li>
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
|
||||
@*
|
||||
Macro parameter to be set on the macro
|
||||
Show:True Alias:propertyAlias Name:Property Alias Type:Textstring
|
||||
Alias:propertyAlias Name:Property Alias Type:Textbox
|
||||
*@
|
||||
|
||||
|
||||
@{
|
||||
|
||||
@* Get the property alias we want to filter on from the macro parameter *@
|
||||
@@ -13,7 +12,6 @@
|
||||
var selection = Model.Children.Where("Visible").OrderBy(propertyAlias);
|
||||
}
|
||||
|
||||
|
||||
<ul>
|
||||
@foreach (var page in selection)
|
||||
{
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
Settings section).
|
||||
*@
|
||||
|
||||
|
||||
@{
|
||||
@*Build a query and return the visible items *@
|
||||
@* Build a query and return the visible items *@
|
||||
var selection= Model.Textpages.Where("Visible");
|
||||
|
||||
@*
|
||||
@@ -18,8 +17,7 @@
|
||||
*@
|
||||
}
|
||||
|
||||
|
||||
@*Determine if there are any nodes in the selection, then render list *@
|
||||
@* Determine if there are any nodes in the selection, then render list *@
|
||||
@if(selection.Any()){
|
||||
|
||||
<ul>
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
|
||||
|
||||
@inherits umbraco.MacroEngines.DynamicNodeContext
|
||||
|
||||
@*
|
||||
Macro Parameters To Create, for this macro to work:
|
||||
Show:True Alias:mediaId Name:Media Folder ID Type:MediaCurrent
|
||||
Macro Parameters To Create, for this macro to work:
|
||||
Alias:mediaId Name:Media Folder ID Type:Single Media Picker
|
||||
*@
|
||||
|
||||
|
||||
@if (Parameter.mediaId != null)
|
||||
{
|
||||
@* Get the media folder as a dynamic node *@
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
var selection = Model.PropertyWithPicker;
|
||||
}
|
||||
|
||||
|
||||
@* Lists each selected value from the picker as a link *@
|
||||
<ul>
|
||||
@foreach(var id in selection.Split(',')){
|
||||
|
||||
@@ -5,10 +5,9 @@
|
||||
Also highlights the current active page/section in the navigation with
|
||||
the css class "current".
|
||||
*@
|
||||
|
||||
|
||||
@{
|
||||
@*Get the root of the website *@
|
||||
@* Get the root of the website *@
|
||||
var root = Model.AncestorOrSelf(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,38 +1,34 @@
|
||||
@inherits umbraco.MacroEngines.DynamicNodeContext
|
||||
|
||||
@{
|
||||
@* Walk up the tree from the current page to get the root node *@
|
||||
var rootNode = Model.AncestorOrself(1);
|
||||
}
|
||||
@inherits umbraco.MacroEngines.DynamicNodeContext
|
||||
|
||||
@*Render the sitemap by passing the root node to the traverse helper*@
|
||||
<div class="sitemap">
|
||||
@* Render the sitemap by passing the root node to the traverse helper *@
|
||||
<div class="sitemap">
|
||||
@traverse(@Model.AncestorOrSelf())
|
||||
</div>
|
||||
|
||||
@* Helper method to travers through all descendants *@
|
||||
@helper traverse(dynamic node)
|
||||
{
|
||||
|
||||
@* If a MaxLevelForSitemap parameter is passed to the macro, otherwise default to 4 levels *@
|
||||
var maxLevelForSitemap = String.IsNullOrEmpty(Parameter.MaxLevelForSitemap) ? 4 : int.Parse(Parameter.MaxLevelForSitemap);
|
||||
|
||||
@* Select visible children *@
|
||||
var items = node.Children.Where("Visible").Where("Level <= " + maxLevelForSitemap);
|
||||
|
||||
|
||||
@*Helper method to travers through all descendants*@
|
||||
@helper traverse(dynamic node){
|
||||
@* If any items are returned, render a list *@
|
||||
if (items.Any())
|
||||
{
|
||||
<ul>
|
||||
@foreach (var item in items)
|
||||
{
|
||||
<li class="level-@item.Level">
|
||||
<a href="@item.Url">@item.Name</a>
|
||||
|
||||
@*If a MaxLevelForSitemap parameter is passed to the macro, otherwise default to 4 levels*@
|
||||
var maxLevelForSitemap = String.IsNullOrEmpty(Parameter.MaxLevelForSitemap) ? 4 : int.Parse(Parameter.MaxLevelForSitemap);
|
||||
|
||||
@*Select visible children *@
|
||||
var items = node.Children.Where("Visible").Where("Level <= " + maxLevelForSitemap);
|
||||
|
||||
|
||||
@*If any items are returned, render a list *@
|
||||
if (items.Any()) {
|
||||
<ul>
|
||||
@foreach (var item in items) {
|
||||
<li class="level-@item.Level">
|
||||
<a href="@item.Url">@item.Name</a>
|
||||
|
||||
@*Run the traverse helper again *@
|
||||
@traverse(item)
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
@*Run the traverse helper again *@
|
||||
@traverse(item)
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user