Merge pull request #3007 from callumbwhyte/updating-macro-templates
Updating macro templates for V8
This commit is contained in:
@@ -389,9 +389,6 @@
|
||||
<Content Include="Umbraco\PartialViewMacros\Templates\Login.cshtml" />
|
||||
<Content Include="Umbraco\PartialViewMacros\Templates\LoginStatus.cshtml" />
|
||||
<Content Include="Umbraco\PartialViewMacros\Templates\RegisterMember.cshtml" />
|
||||
<Content Include="Umbraco\PartialViewMacros\Templates\Empty %28ForUseWithCustomViews%29.cshtml">
|
||||
<SubType>Code</SubType>
|
||||
</Content>
|
||||
<Content Include="Umbraco\PartialViewMacros\Templates\ListAncestorsFromCurrentPage.cshtml" />
|
||||
<Content Include="Umbraco\PartialViewMacros\Templates\Breadcrumb.cshtml" />
|
||||
<Content Include="Umbraco\PartialViewMacros\Templates\Gallery.cshtml" />
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
@using Umbraco.Web
|
||||
@inherits Umbraco.Web.Macros.PartialViewMacroPage
|
||||
|
||||
@*
|
||||
This snippet makes a breadcrumb of parents using an unordered HTML list.
|
||||
|
||||
@@ -22,4 +23,4 @@
|
||||
@* Display the current page as the last item in the list *@
|
||||
<li class="active">@Model.Content.Name</li>
|
||||
</ul>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
@inherits Umbraco.Web.Macros.PartialViewMacroPage
|
||||
|
||||
@using System.Web.Mvc.Html
|
||||
@using System.Web.Mvc.Html
|
||||
@using ClientDependency.Core.Mvc
|
||||
@using Umbraco.Web
|
||||
@using Umbraco.Web.Controllers
|
||||
@inherits Umbraco.Web.Macros.PartialViewMacroPage
|
||||
|
||||
@{
|
||||
var profileModel = Members.GetCurrentMemberProfileModel();
|
||||
@@ -11,8 +10,8 @@
|
||||
Html.EnableClientValidation();
|
||||
Html.EnableUnobtrusiveJavaScript();
|
||||
Html.RequiresJs("/umbraco/lib/jquery/jquery.min.js");
|
||||
Html.RequiresJs("/Umbraco/lib/jquery-validate/jquery.validate.min.js");
|
||||
Html.RequiresJs("/Umbraco/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js");
|
||||
Html.RequiresJs("/umbraco/lib/jquery-validate/jquery.validate.min.js");
|
||||
Html.RequiresJs("/umbraco/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js");
|
||||
|
||||
var success = TempData["ProfileUpdateSuccess"] != null;
|
||||
}
|
||||
@@ -21,18 +20,18 @@
|
||||
@Html.RenderJsHere()
|
||||
|
||||
@if (Members.IsLoggedIn() && profileModel != null)
|
||||
{
|
||||
{
|
||||
if (success)
|
||||
{
|
||||
@* This message will show if RedirectOnSucces is set to false (default) *@
|
||||
<p>Profile updated</p>
|
||||
}
|
||||
|
||||
|
||||
using (Html.BeginUmbracoForm<UmbProfileController>("HandleUpdateProfile"))
|
||||
{
|
||||
<fieldset>
|
||||
<legend>Edit profile</legend>
|
||||
|
||||
|
||||
@Html.ValidationSummary("profileModel", true)
|
||||
|
||||
@Html.LabelFor(m => profileModel.Name)
|
||||
@@ -48,10 +47,10 @@
|
||||
@for (var i = 0; i < profileModel.MemberProperties.Count; i++)
|
||||
{
|
||||
@Html.LabelFor(m => profileModel.MemberProperties[i].Value, profileModel.MemberProperties[i].Name)
|
||||
@*
|
||||
By default this will render a textbox but if you want to change the editor template for this property you can
|
||||
@*
|
||||
By default this will render a textbox but if you want to change the editor template for this property you can
|
||||
easily change it. For example, if you wanted to render a custom editor for this field called "MyEditor" you would
|
||||
create a file at ~/Views/Shared/EditorTemplates/MyEditor.cshtml", then you will change the next line of code to
|
||||
create a file at ~/Views/Shared/EditorTemplates/MyEditor.cshtml", then you will change the next line of code to
|
||||
render your specific editor template like:
|
||||
@Html.EditorFor(m => profileModel.MemberProperties[i].Value, "MyEditor")
|
||||
*@
|
||||
@@ -62,5 +61,5 @@
|
||||
|
||||
<button>Save</button>
|
||||
</fieldset>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
@inherits Umbraco.Web.Mvc.UmbracoViewPage<dynamic>
|
||||
@@ -1 +1 @@
|
||||
@inherits Umbraco.Web.Macros.PartialViewMacroPage
|
||||
@inherits Umbraco.Web.Macros.PartialViewMacroPage
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
@using Umbraco.Core.Models.PublishedContent
|
||||
@using Umbraco.Web
|
||||
@inherits Umbraco.Web.Macros.PartialViewMacroPage
|
||||
|
||||
@*
|
||||
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).
|
||||
@@ -20,16 +23,16 @@
|
||||
<div class="row">
|
||||
@foreach (var mediaId in mediaIds.Split(','))
|
||||
{
|
||||
var media = Umbraco.TypedMedia(mediaId);
|
||||
var media = Umbraco.Media(mediaId);
|
||||
|
||||
@* a single image *@
|
||||
if (media.DocumentTypeAlias == "Image")
|
||||
if (media.IsDocumentType("Image"))
|
||||
{
|
||||
@Render(media as Image);
|
||||
@Render(media);
|
||||
}
|
||||
|
||||
@* a folder with images under it *@
|
||||
foreach (var image in media.Children<Image>())
|
||||
foreach (var image in media.Children())
|
||||
{
|
||||
@Render(image);
|
||||
}
|
||||
@@ -37,11 +40,11 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
@helper Render(Image item)
|
||||
@helper Render(IPublishedContent item)
|
||||
{
|
||||
<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>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
@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.
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
@if (startNodeId != null)
|
||||
{
|
||||
@* Get the starting page *@
|
||||
var startNode = Umbraco.TypedContent(startNodeId);
|
||||
var startNode = Umbraco.Content(startNodeId);
|
||||
var selection = startNode.Children.Where(x => x.IsVisible()).ToArray();
|
||||
|
||||
if (selection.Length > 0)
|
||||
@@ -30,4 +30,4 @@
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@using Umbraco.Web
|
||||
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
|
||||
@inherits Umbraco.Web.Macros.PartialViewMacroPage
|
||||
|
||||
@*
|
||||
This snippet makes a list of links to the of children of the current page using an unordered HTML list.
|
||||
@@ -20,4 +20,4 @@
|
||||
<li><a href="@item.Url">@item.Name</a></li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
*@
|
||||
|
||||
@{ var propertyAlias = Model.MacroParameters["propertyAlias"]; }
|
||||
|
||||
@if (propertyAlias != null)
|
||||
{
|
||||
var selection = Model.Content.Children.Where(x => x.IsVisible()).OrderBy(x => x.GetPropertyValue(propertyAlias.ToString())).ToArray();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@using Umbraco.Core.Models
|
||||
@using Umbraco.Core.Models.PublishedContent
|
||||
@using Umbraco.Web
|
||||
@inherits Umbraco.Web.Macros.PartialViewMacroPage
|
||||
|
||||
@@ -20,4 +20,3 @@
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
|
||||
@using Umbraco.Core.Models
|
||||
@using Umbraco.Core.Models.PublishedContent
|
||||
@using Umbraco.Web
|
||||
@inherits Umbraco.Web.Macros.PartialViewMacroPage
|
||||
|
||||
@*
|
||||
This snippet creates links for every single page (no matter how deep) below
|
||||
@@ -37,16 +37,15 @@
|
||||
</ul>
|
||||
}
|
||||
|
||||
|
||||
@helper ChildPages(IPublishedContent[] selection)
|
||||
{
|
||||
@* Ensure that we have a collection of pages *@
|
||||
if (selection.Length > 0)
|
||||
{
|
||||
@* Get the first page in pages and get the 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)
|
||||
{
|
||||
@@ -58,7 +57,7 @@
|
||||
var children = item.Children.Where(x => x.IsVisible()).ToArray();
|
||||
if (children.Length > 0)
|
||||
{
|
||||
@* Recurse and call our helper to display the children *@
|
||||
@* Recurse and call our helper to display the children *@
|
||||
@ChildPages(children)
|
||||
}
|
||||
}
|
||||
@@ -66,4 +65,4 @@
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,11 +13,12 @@
|
||||
*@
|
||||
|
||||
@{ var mediaId = Model.MacroParameters["mediaId"]; }
|
||||
|
||||
@if (mediaId != null)
|
||||
{
|
||||
@* Get the media item associated with the id passed in *@
|
||||
var media = Umbraco.TypedMedia(mediaId);
|
||||
var selection = media.Children<Image>().ToArray();
|
||||
var media = Umbraco.Media(mediaId);
|
||||
var selection = media.Children.ToArray();
|
||||
|
||||
if (selection.Length > 0)
|
||||
{
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
@inherits Umbraco.Web.Macros.PartialViewMacroPage
|
||||
|
||||
@using System.Web.Mvc.Html
|
||||
@using System.Web.Mvc.Html
|
||||
@using ClientDependency.Core.Mvc
|
||||
@using Umbraco.Web
|
||||
@using Umbraco.Web.Models
|
||||
@using Umbraco.Web.Controllers
|
||||
@inherits Umbraco.Web.Macros.PartialViewMacroPage
|
||||
|
||||
@{
|
||||
var loginModel = new LoginModel();
|
||||
@@ -12,8 +11,8 @@
|
||||
Html.EnableClientValidation();
|
||||
Html.EnableUnobtrusiveJavaScript();
|
||||
Html.RequiresJs("/umbraco/lib/jquery/jquery.min.js");
|
||||
Html.RequiresJs("/Umbraco/lib/jquery-validate/jquery.validate.min.js");
|
||||
Html.RequiresJs("/Umbraco/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js");
|
||||
Html.RequiresJs("/umbraco/lib/jquery-validate/jquery.validate.min.js");
|
||||
Html.RequiresJs("/umbraco/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js");
|
||||
}
|
||||
|
||||
@* NOTE: This RenderJsHere code should be put on your main template page where the rest of your script tags are placed *@
|
||||
@@ -23,7 +22,7 @@
|
||||
{
|
||||
<fieldset>
|
||||
<legend>Login</legend>
|
||||
|
||||
|
||||
@Html.ValidationSummary("loginModel", true)
|
||||
|
||||
@Html.LabelFor(m => loginModel.Username)
|
||||
@@ -37,5 +36,5 @@
|
||||
<br />
|
||||
|
||||
<button>Login</button>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
@inherits Umbraco.Web.Macros.PartialViewMacroPage
|
||||
@using System.Web.Mvc.Html
|
||||
@using System.Web.Mvc.Html
|
||||
@using ClientDependency.Core.Mvc
|
||||
@using Umbraco.Web
|
||||
@using Umbraco.Web.Models
|
||||
@using Umbraco.Web.Controllers
|
||||
@inherits Umbraco.Web.Macros.PartialViewMacroPage
|
||||
|
||||
@{
|
||||
var loginStatusModel = Members.GetCurrentLoginStatus();
|
||||
@@ -19,8 +19,8 @@
|
||||
@*
|
||||
Here you can specify a redirect URL for after logging out, by default umbraco will simply
|
||||
redirect to the current page. Example to redirect to the home page:
|
||||
|
||||
logoutModel.RedirectUrl = "/";
|
||||
|
||||
logoutModel.RedirectUrl = "/";
|
||||
*@
|
||||
}
|
||||
|
||||
@@ -33,11 +33,11 @@
|
||||
|
||||
using (Html.BeginUmbracoForm<UmbLoginStatusController>("HandleLogout"))
|
||||
{
|
||||
<fieldset>
|
||||
<legend>Logout</legend>
|
||||
<button>Logout</button>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Logout</legend>
|
||||
<button>Logout</button>
|
||||
</fieldset>
|
||||
|
||||
@Html.HiddenFor(m => logoutModel.RedirectUrl)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@using Umbraco.Core.Models
|
||||
@using Umbraco.Core.Models.PublishedContent
|
||||
@using Umbraco.Web
|
||||
@inherits Umbraco.Web.Macros.PartialViewMacroPage
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
multinode treepicker (so: replace "PropertyWithPicker" with the alias of your property).
|
||||
*@
|
||||
|
||||
@{ var selection = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("PropertyWithPicker").ToArray(); }
|
||||
@{ var selection = Model.Content.Value<IEnumerable<IPublishedContent>>("PropertyWithPicker").ToArray(); }
|
||||
|
||||
@if (selection.Length > 0)
|
||||
{
|
||||
@@ -22,4 +22,4 @@
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
It also highlights the current active page/section in the navigation with the CSS class "current".
|
||||
*@
|
||||
|
||||
@{ var selection = Model.Content.Site().Children.Where(x => x.IsVisible()).ToArray(); }
|
||||
@{ var selection = Model.Content.Root().Children.Where(x => x.IsVisible()).ToArray(); }
|
||||
|
||||
@if (selection.Length > 0)
|
||||
{
|
||||
|
||||
@@ -1,51 +1,50 @@
|
||||
@inherits Umbraco.Web.Macros.PartialViewMacroPage
|
||||
|
||||
@using System.Web.Mvc.Html
|
||||
@using System.Web.Mvc.Html
|
||||
@using ClientDependency.Core.Mvc
|
||||
@using Umbraco.Web
|
||||
@using Umbraco.Web.Controllers
|
||||
@inherits Umbraco.Web.Macros.PartialViewMacroPage
|
||||
|
||||
@{
|
||||
@*
|
||||
You can specify a custom member type alias in the constructor, the default is 'Member'
|
||||
You can specify a custom member type alias in the constructor, the default is 'Member'
|
||||
for example, to use 'Custom Member' you'd use this syntax:
|
||||
|
||||
|
||||
var registerModel = Members.CreateRegistrationModel("Custom Member");
|
||||
*@
|
||||
|
||||
|
||||
var registerModel = Members.CreateRegistrationModel();
|
||||
|
||||
|
||||
@*
|
||||
Configurable here:
|
||||
|
||||
registerModel.RedirectUrl - Optional. What path to redirect to if registration is successful.
|
||||
By default the member will be redirected to the current umbraco page
|
||||
Configurable here:
|
||||
|
||||
registerModel.RedirectUrl - Optional. What path to redirect to if registration is successful.
|
||||
By default the member will be redirected to the current umbraco page
|
||||
unless this is specified.
|
||||
|
||||
|
||||
registerModel.UsernameIsEmail - the default is true
|
||||
if you want the username to be different from the email
|
||||
address, set this to true and add a new Username field in
|
||||
the form below
|
||||
|
||||
|
||||
@Html.LabelFor(m => registerModel.Username)
|
||||
@Html.TextBoxFor(m => registerModel.Username)
|
||||
@Html.ValidationMessageFor(m => registerModel.Username)
|
||||
*@
|
||||
|
||||
|
||||
Html.EnableClientValidation();
|
||||
Html.EnableUnobtrusiveJavaScript();
|
||||
Html.RequiresJs("/umbraco/lib/jquery/jquery.min.js");
|
||||
Html.RequiresJs("/Umbraco/lib/jquery-validate/jquery.validate.min.js");
|
||||
Html.RequiresJs("/Umbraco/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js");
|
||||
|
||||
Html.RequiresJs("/umbraco/lib/jquery-validate/jquery.validate.min.js");
|
||||
Html.RequiresJs("/umbraco/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js");
|
||||
|
||||
var success = TempData["FormSuccess"] != null;
|
||||
}
|
||||
|
||||
@*NOTE: This RenderJsHere code should be put on your main template page where the rest of your script tags are placed*@
|
||||
@Html.RenderJsHere()
|
||||
|
||||
@if (success)
|
||||
{
|
||||
@if (success)
|
||||
{
|
||||
@* This message will show if RedirectOnSucces is set to false (default) *@
|
||||
<p>Registration succeeded.</p>
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@using Umbraco.Core.Models
|
||||
@using Umbraco.Core.Models.PublishedContent
|
||||
@using Umbraco.Web
|
||||
@inherits Umbraco.Web.Macros.PartialViewMacroPage
|
||||
|
||||
@@ -9,14 +9,13 @@
|
||||
- It uses a custom Razor helper called Traverse() to select and display the markup and links.
|
||||
*@
|
||||
|
||||
@{ var selection = Model.Content.Site(); }
|
||||
@{ var selection = Model.Content.Root(); }
|
||||
|
||||
<div class="sitemap">
|
||||
@* Render the sitemap by passing the root node to the traverse helper, below *@
|
||||
@Traverse(selection)
|
||||
</div>
|
||||
|
||||
|
||||
@* Helper method to traverse through all descendants *@
|
||||
@helper Traverse(IPublishedContent node)
|
||||
{
|
||||
@@ -41,4 +40,4 @@
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Web.Mvc;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Web.Models;
|
||||
using Umbraco.Web.Models;
|
||||
using Umbraco.Web.Mvc;
|
||||
|
||||
namespace Umbraco.Web.Macros
|
||||
|
||||
Reference in New Issue
Block a user