Also clean up v6 snippets

This commit is contained in:
Sebastiaan Janssen
2014-03-07 09:46:33 +01:00
parent 1511ad58b2
commit a48fe40675
19 changed files with 73 additions and 101 deletions

View File

@@ -3,7 +3,6 @@
@using System.Web.Mvc.Html
@using ClientDependency.Core.Mvc
@using Umbraco.Web
@using Umbraco.Web.Models
@using Umbraco.Web.Controllers
@{
@@ -16,7 +15,6 @@
Html.RequiresJs("/umbraco_client/Application/JQuery/jquery.validate.unobtrusive.min.js");
var success = TempData["ProfileUpdateSuccess"] != null;
}
@*NOTE: This RenderJsHere code should be put on your main template page where the rest of your script tags are placed*@
@@ -26,7 +24,7 @@
{
if (success)
{
// This message will show if RedirectOnSucces is set to false (default)
@* This message will show if RedirectOnSucces is set to false (default) *@
<p>Profile updated</p>
}

View File

@@ -1,7 +1,7 @@
@inherits Umbraco.Web.Macros.PartialViewMacroPage
<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 CurrentPage.Children.Where("Visible").OrderBy("CreateDate desc"))
{

View File

@@ -1,6 +1,6 @@
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
<ul>
@*OrderBy() takes the property to sort by*@
@* OrderBy() takes the property to sort by *@
@foreach (var page in CurrentPage.Children.Where("Visible").OrderBy("Name"))
{
<li><a href="@page.Url">@page.Name</a></li>

View File

@@ -4,15 +4,12 @@
Show:True Alias:propertyAlias Name:Property Alias Type:Textstring
*@
@{
@* Get the property alias we want to filter on from the macro parameter *@
var propertyAlias = Model.MacroParameters["propertyAlias"];
var selection = CurrentPage.Children.Where("Visible").OrderBy(propertyAlias);
}
<ul>
@foreach (var page in selection)
{

View File

@@ -7,7 +7,6 @@
Settings section).
*@
@{
@*Build a query and return the visible items *@
var selection= CurrentPage.Textpages.Where("Visible");
@@ -18,7 +17,6 @@
*@
}
@*Determine if there are any nodes in the selection, then render list *@
@if(selection.Any()){

View File

@@ -16,7 +16,7 @@
Html.RequiresJs("/umbraco_client/Application/JQuery/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*@
@* NOTE: This RenderJsHere code should be put on your main template page where the rest of your script tags are placed *@
@Html.RenderJsHere()
@using (Html.BeginUmbracoForm<UmbLoginController>("HandleLogin"))

View File

@@ -16,16 +16,15 @@
var logoutModel = new PostRedirectModel();
/*
* 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 = "/";
*
*/
@*
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 = "/";
*@
}
@*NOTE: This RenderJsHere code should be put on your main template page where the rest of your script tags are placed*@
@* NOTE: This RenderJsHere code should be put on your main template page where the rest of your script tags are placed *@
@Html.RenderJsHere()
@if (loginStatusModel.IsLoggedIn)

View File

@@ -6,9 +6,8 @@
the css class "current".
*@
@{
@*Get the root of the website *@
@* Get the root of the website *@
var root = CurrentPage.AncestorOrSelf(1);
}

View File

@@ -3,37 +3,34 @@
@using System.Web.Mvc.Html
@using ClientDependency.Core.Mvc
@using Umbraco.Web
@using Umbraco.Web.Models
@using Umbraco.Web.Controllers
@{
@*
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:
/*
* 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("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
* 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)
*/
@*
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();
@@ -49,16 +46,16 @@
@if (success)
{
// This message will show if RedirectOnSucces is set to false (default)
@* This message will show if RedirectOnSucces is set to false (default) *@
<p>Registration succeeeded.</p>
}
else
{
}
else
{
using (Html.BeginUmbracoForm<UmbRegisterController>("HandleRegisterMember"))
{
<fieldset>
<legend>Register Member</legend>
@Html.ValidationSummary("registerModel", true)
@Html.LabelFor(m => registerModel.Name)
@@ -75,8 +72,9 @@ else
@Html.PasswordFor(m => registerModel.Password)
@Html.ValidationMessageFor(m => registerModel.Password)
<br />
@if (registerModel.MemberProperties != null) {
@if (registerModel.MemberProperties != null)
{
for (var i = 0; i < registerModel.MemberProperties.Count; i++)
{
@Html.LabelFor(m => registerModel.MemberProperties[i].Value, registerModel.MemberProperties[i].Name)
@@ -87,10 +85,10 @@ else
}
@Html.HiddenFor(m => registerModel.MemberTypeAlias)
@Html.HiddenFor(m => registerModel.RedirectUrl)
@Html.HiddenFor(m => registerModel.RedirectUrl)
@Html.HiddenFor(m => registerModel.UsernameIsEmail)
<button>Register</button>
</fieldset>
</fieldset>
}
}

View File

@@ -1,20 +1,20 @@
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@*Render the sitemap by passing the root node to the traverse helper*@
@* Render the sitemap by passing the root node to the traverse helper *@
<div class="sitemap">
@Traverse(CurrentPage.AncestorOrSelf())
</div>
@*Helper method to travers through all descendants*@
@* Helper method to travers through all descendants *@
@helper Traverse(dynamic node)
{
@* Update the level to reflect how deep you want the sitemap to go *@
var maxLevelForSitemap = 4;
@*Select visible children *@
@* Select visible children *@
var items = node.Children.Where("Visible").Where("Level <= " + maxLevelForSitemap);
@*If any items are returned, render a list *@
@* If any items are returned, render a list *@
if (items.Any())
{
<ul>
@@ -23,7 +23,7 @@
<li class="level-@item.Level">
<a href="@item.Url">@item.Name</a>
@*Run the traverse helper again *@
@* Run the traverse helper again *@
@Traverse(item)
</li>
}

View File

@@ -11,7 +11,5 @@
@Library.NodeById(1233)
*@
@* The fun starts here *@

View File

@@ -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>

View File

@@ -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>

View File

@@ -5,7 +5,6 @@
Show:True Alias:propertyAlias Name:Property Alias Type:Textstring
*@
@{
@* 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)
{

View File

@@ -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>

View File

@@ -1,5 +1,3 @@
@inherits umbraco.MacroEngines.DynamicNodeContext
@*
@@ -7,7 +5,6 @@ Macro Parameters To Create, for this macro to work:
Show:True Alias:mediaId Name:Media Folder ID Type:MediaCurrent
*@
@if (Parameter.mediaId != null)
{
@* Get the media folder as a dynamic node *@

View File

@@ -12,7 +12,6 @@
var selection = Model.PropertyWithPicker;
}
@* Lists each selected value from the picker as a link *@
<ul>
@foreach(var id in selection){

View File

@@ -6,9 +6,8 @@
the css class "current".
*@
@{
@*Get the root of the website *@
@* Get the root of the website *@
var root = Model.AncestorOrSelf(1);
}

View File

@@ -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);
}
@*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)
{
@*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);
@* 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);
@* 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>
@* 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)
@*Run the traverse helper again *@
@traverse(item)
</li>
}
</ul>
</ul>
}
}