Add WebCms
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
|
||||
@{
|
||||
var home = CurrentPage.Site();
|
||||
}
|
||||
|
||||
@if (home.Children.Where("Visible").Any())
|
||||
{
|
||||
@* For each child page under the home node, where the property umbracoNaviHide is not True *@
|
||||
foreach (var childPage in home.Children.Where("Visible"))
|
||||
{
|
||||
<div class="col-xs-6 col-sm-3">
|
||||
@if (childPage.Children.Where("Visible").Any())
|
||||
{
|
||||
<strong>@childPage.Name</strong>
|
||||
@childPages(childPage.Children)
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
<div class="col-xs-6 col-sm-3">
|
||||
<strong>Find us</strong>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="https://twitter.com/umbracoproject" target="_blank">Twitter</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://www.facebook.com/Umbraco" target="_blank">Facebook</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://umbraco.com/?utm_source=core&utm_medium=starterkit&utm_content=topic-link&utm_campaign=fanoe" target="_blank">Umbraco.com</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@helper childPages(dynamic pages)
|
||||
{
|
||||
@* Ensure that we have a collection of pages *@
|
||||
if (pages.Any())
|
||||
{
|
||||
<ul>
|
||||
@foreach (var page in pages.Where("Visible"))
|
||||
{
|
||||
<li>
|
||||
<a href="@page.Url">@page.Name</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
@inherits UmbracoViewPage<dynamic>
|
||||
@using Umbraco.Web.Templates
|
||||
@using Newtonsoft.Json.Linq
|
||||
|
||||
@if (Model != null && Model.sections != null)
|
||||
{
|
||||
var oneColumn = ((System.Collections.ICollection)Model.sections).Count == 1;
|
||||
|
||||
<div class="umb-grid">
|
||||
@if (oneColumn)
|
||||
{
|
||||
foreach (var section in Model.sections) {
|
||||
<div class="grid-section">
|
||||
@foreach (var row in section.rows) {
|
||||
@renderRow(row, true);
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}else {
|
||||
<div class="container">
|
||||
<div class="row clearfix">
|
||||
@foreach (var s in Model.sections) {
|
||||
<div class="grid-section">
|
||||
<div class="@("span" + s.grid) column">
|
||||
@foreach (var row in s.rows) {
|
||||
@renderRow(row, false);
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
@helper renderRow(dynamic row, bool singleColumn){
|
||||
<div @RenderElementAttributes(row)>
|
||||
@Umbraco.If(singleColumn, "<div class='container'>")
|
||||
<div class="row clearfix">
|
||||
@foreach ( var area in row.areas ) {
|
||||
<div class="@("span" + area.grid) column">
|
||||
<div @RenderElementAttributes(area)>
|
||||
@foreach (var control in area.controls) {
|
||||
if (control !=null && control.editor != null && control.editor.view != null ) {
|
||||
<text>@Html.Partial("grid/editors/base", (object)control)</text>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>}
|
||||
</div>
|
||||
@Umbraco.If(singleColumn, "</div>")
|
||||
</div>
|
||||
}
|
||||
|
||||
@functions {
|
||||
public static MvcHtmlString RenderElementAttributes(dynamic contentItem)
|
||||
{
|
||||
var attrs = new List<string>();
|
||||
JObject cfg = contentItem.config;
|
||||
|
||||
if(cfg != null)
|
||||
foreach (JProperty property in cfg.Properties()) {
|
||||
attrs.Add(property.Name + "='" + property.Value.ToString() + "'");
|
||||
}
|
||||
|
||||
JObject style = contentItem.styles;
|
||||
|
||||
if (style != null) {
|
||||
var cssVals = new List<string>();
|
||||
foreach (JProperty property in style.Properties())
|
||||
cssVals.Add(property.Name + ":" + property.Value.ToString() + ";");
|
||||
|
||||
if (cssVals.Any())
|
||||
attrs.Add("style='" + string.Join(" ", cssVals) + "'");
|
||||
}
|
||||
|
||||
return new MvcHtmlString(string.Join(" ", attrs));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
@inherits UmbracoViewPage<dynamic>
|
||||
@using Umbraco.Web.Templates
|
||||
@using Newtonsoft.Json.Linq
|
||||
|
||||
@if (Model != null && Model.sections != null)
|
||||
{
|
||||
var oneColumn = ((System.Collections.ICollection)Model.sections).Count == 1;
|
||||
|
||||
<div class="umb-grid">
|
||||
@if (oneColumn)
|
||||
{
|
||||
foreach (var section in Model.sections) {
|
||||
<div class="grid-section">
|
||||
@foreach (var row in section.rows) {
|
||||
@renderRow(row, true);
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}else {
|
||||
<div class="container">
|
||||
<div class="row clearfix">
|
||||
@foreach (var s in Model.sections) {
|
||||
<div class="grid-section">
|
||||
<div class="col-md-@s.grid column">
|
||||
@foreach (var row in s.rows) {
|
||||
@renderRow(row, false);
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
@helper renderRow(dynamic row, bool singleColumn){
|
||||
<div @RenderElementAttributes(row)>
|
||||
@Umbraco.If(singleColumn, "<div class='container'>")
|
||||
<div class="row clearfix">
|
||||
@foreach ( var area in row.areas ) {
|
||||
<div class="col-md-@area.grid column">
|
||||
<div @RenderElementAttributes(area)>
|
||||
@foreach (var control in area.controls) {
|
||||
if (control !=null && control.editor != null && control.editor.view != null ) {
|
||||
<text>@Html.Partial("grid/editors/base", (object)control)</text>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>}
|
||||
</div>
|
||||
@Umbraco.If(singleColumn, "</div>")
|
||||
</div>
|
||||
}
|
||||
|
||||
@functions {
|
||||
public static MvcHtmlString RenderElementAttributes(dynamic contentItem)
|
||||
{
|
||||
var attrs = new List<string>();
|
||||
JObject cfg = contentItem.config;
|
||||
|
||||
if(cfg != null)
|
||||
foreach (JProperty property in cfg.Properties()) {
|
||||
attrs.Add(property.Name + "='" + property.Value.ToString() + "'");
|
||||
}
|
||||
|
||||
JObject style = contentItem.styles;
|
||||
|
||||
if (style != null) {
|
||||
var cssVals = new List<string>();
|
||||
foreach (JProperty property in style.Properties())
|
||||
cssVals.Add(property.Name + ":" + property.Value.ToString() + ";");
|
||||
|
||||
if (cssVals.Any())
|
||||
attrs.Add("style='" + string.Join(" ", cssVals) + "'");
|
||||
}
|
||||
|
||||
return new MvcHtmlString(string.Join(" ", attrs));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
@model dynamic
|
||||
@using Umbraco.Web.Templates
|
||||
|
||||
@functions {
|
||||
public static string EditorView(dynamic contentItem)
|
||||
{
|
||||
string view = contentItem.editor.render != null ? contentItem.editor.render.ToString() : contentItem.editor.view.ToString();
|
||||
view = view.ToLower().Replace(".html", ".cshtml");
|
||||
|
||||
if (!view.Contains("/")) {
|
||||
view = "grid/editors/" + view;
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
||||
@try
|
||||
{
|
||||
string editor = EditorView(Model);
|
||||
<text>@Html.Partial(editor, (object)Model)</text>
|
||||
}
|
||||
catch (Exception ex) {
|
||||
<pre>@ex.ToString()</pre>
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@model dynamic
|
||||
@using Umbraco.Web.Templates
|
||||
|
||||
|
||||
<div class="video-wrapper">
|
||||
@Html.Raw(Model.value)
|
||||
</div>
|
||||
@@ -0,0 +1,17 @@
|
||||
@inherits UmbracoViewPage<dynamic>
|
||||
@using Umbraco.Web.Templates
|
||||
|
||||
|
||||
@if (Model.value != null)
|
||||
{
|
||||
string macroAlias = Model.value.macroAlias.ToString();
|
||||
ViewDataDictionary parameters = new ViewDataDictionary();
|
||||
foreach (dynamic mpd in Model.value.macroParamsDictionary)
|
||||
{
|
||||
parameters.Add(mpd.Name, mpd.Value);
|
||||
}
|
||||
|
||||
<text>
|
||||
@Umbraco.RenderMacro(macroAlias, parameters)
|
||||
</text>
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
@model dynamic
|
||||
@using Umbraco.Web.Templates
|
||||
|
||||
@if (Model.value != null)
|
||||
{
|
||||
var url = Model.value.image;
|
||||
if(Model.editor.config != null && Model.editor.config.size != null){
|
||||
url += "?width=" + Model.editor.config.size.width;
|
||||
url += "&height=" + Model.editor.config.size.height;
|
||||
|
||||
if(Model.value.focalPoint != null){
|
||||
url += "¢er=" + Model.value.focalPoint.top +"," + Model.value.focalPoint.left;
|
||||
url += "&mode=crop";
|
||||
}
|
||||
}
|
||||
|
||||
<img src="@url" alt="@Model.value.caption">
|
||||
|
||||
if (Model.value.caption != null)
|
||||
{
|
||||
<p class="caption">@Model.value.caption</p>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
@model dynamic
|
||||
@using Umbraco.Web.Templates
|
||||
|
||||
@Html.Raw(TemplateUtilities.ParseInternalLinks(Model.value.ToString()))
|
||||
@@ -0,0 +1,20 @@
|
||||
@model dynamic
|
||||
@using Umbraco.Web.Templates
|
||||
|
||||
@if (Model.editor.config.markup != null)
|
||||
{
|
||||
string markup = Model.editor.config.markup.ToString();
|
||||
|
||||
markup = markup.Replace("#value#", Model.value.ToString());
|
||||
markup = markup.Replace("#style#", Model.editor.config.style.ToString());
|
||||
|
||||
<text>
|
||||
@Html.Raw(markup)
|
||||
</text>
|
||||
}
|
||||
else
|
||||
{
|
||||
<text>
|
||||
<div style="@Model.editor.config.style">@Model.value</div>
|
||||
</text>
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
@inherits UmbracoViewPage<dynamic>
|
||||
@using Umbraco.Web.Templates
|
||||
@using Newtonsoft.Json.Linq
|
||||
|
||||
@if (Model != null && Model.sections != null)
|
||||
{
|
||||
var oneColumn = ((System.Collections.ICollection)Model.sections).Count == 1;
|
||||
|
||||
<div class="umb-grid">
|
||||
@if (oneColumn)
|
||||
{
|
||||
foreach (var section in Model.sections)
|
||||
{
|
||||
<div class="grid-section">
|
||||
@foreach (var row in section.rows)
|
||||
{
|
||||
@renderRow(row, true);
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="container">
|
||||
<div class="row clearfix">
|
||||
@foreach (var s in Model.sections)
|
||||
{
|
||||
<div class="grid-section">
|
||||
<div class="col-md-@s.grid column">
|
||||
@foreach (var row in s.rows)
|
||||
{
|
||||
@renderRow(row, false);
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
@helper renderRow(dynamic row, bool singleColumn)
|
||||
{
|
||||
<div @RenderElementAttributes(row)>
|
||||
@Umbraco.If(singleColumn, "<div class='container'>")
|
||||
<div class="row clearfix">
|
||||
@foreach ( var area in row.areas ) {
|
||||
<div class="col-md-@area.grid column">
|
||||
<div @RenderElementAttributes(area)>
|
||||
@foreach (var control in area.controls) {
|
||||
if (control !=null && control.editor != null && control.editor.view != null ) {
|
||||
<text>@Html.Partial("grid/editors/base", (object)control)</text>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>}
|
||||
</div>
|
||||
@Umbraco.If(singleColumn, "</div>")
|
||||
</div>
|
||||
}
|
||||
|
||||
@functions
|
||||
{
|
||||
public static MvcHtmlString RenderElementAttributes(dynamic contentItem)
|
||||
{
|
||||
var attrs = new List<string>();
|
||||
JObject cfg = contentItem.config;
|
||||
|
||||
if(cfg != null)
|
||||
{
|
||||
foreach (JProperty property in cfg.Properties())
|
||||
{
|
||||
attrs.Add(property.Name + "='" + property.Value.ToString() + "'");
|
||||
}
|
||||
}
|
||||
|
||||
JObject style = contentItem.styles;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
var cssVals = new List<string>();
|
||||
foreach (JProperty property in style.Properties())
|
||||
{
|
||||
cssVals.Add(property.Name + ":" + property.Value.ToString() + ";");
|
||||
}
|
||||
|
||||
if (cssVals.Any())
|
||||
{
|
||||
attrs.Add("style='" + string.Join(" ", cssVals) + "'");
|
||||
}
|
||||
}
|
||||
|
||||
return new MvcHtmlString(string.Join(" ", attrs));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
|
||||
@{ var home = CurrentPage.Site(); }
|
||||
|
||||
@if (home.Children.Any())
|
||||
{
|
||||
@* Get the first page in the children *@
|
||||
var naviLevel = home.Children.First().Level;
|
||||
|
||||
@* Add in level for a CSS hook *@
|
||||
<ul class="level-@naviLevel">
|
||||
@* For each child page under the home node *@
|
||||
@foreach (var childPage in home.Children)
|
||||
{
|
||||
if (childPage.Children.Any())
|
||||
{
|
||||
<li class="has-child @(childPage.IsAncestorOrSelf(CurrentPage) ? "selected" : null)">
|
||||
@if(childPage.DocumentTypeAlias == "LandingPage")
|
||||
{
|
||||
<span>@childPage.Name</span>
|
||||
@childPages(childPage.Children)
|
||||
} else {
|
||||
<a href="@childPage.Url">@childPage.Name</a>
|
||||
}
|
||||
</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li class="@(childPage.IsAncestorOrSelf(CurrentPage) ? "selected" : null)">
|
||||
<a href="@childPage.Url">@childPage.Name</a>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
|
||||
@helper childPages(dynamic pages)
|
||||
{
|
||||
@* Ensure that we have a collection of pages *@
|
||||
if (pages.Any())
|
||||
{
|
||||
@* Get the first page in pages and get the level *@
|
||||
var naviLevel = pages.First().Level;
|
||||
|
||||
@* Add in level for a CSS hook *@
|
||||
<ul class="sublevel level-@(naviLevel)">
|
||||
@foreach (var page in pages)
|
||||
{
|
||||
<li>
|
||||
<a href="@page.Url">@page.Name</a>
|
||||
|
||||
@* if the current page has any children *@
|
||||
@if (page.Children.Any())
|
||||
{
|
||||
@* Call our helper to display the children *@
|
||||
@childPages(page.Children)
|
||||
}
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user