From 8194fb7b32fef091d0fb61b7aa5d190369752b9f Mon Sep 17 00:00:00 2001 From: per ploug Date: Tue, 23 Sep 2014 16:36:04 +0200 Subject: [PATCH] Canvas views --- .../Partials/Canvas/Editors/embed.cshtml | 3 ++ .../Partials/Canvas/Editors/macro.cshtml | 17 +++++++ .../Partials/Canvas/Editors/media.cshtml | 13 +++++ .../Views/Partials/Canvas/Editors/rte.cshtml | 4 ++ .../Partials/Canvas/Editors/textstring.cshtml | 20 ++++++++ .../Views/Partials/Canvas/bootstrap2.cshtml | 47 +++++++++++++++++++ .../Views/Partials/Canvas/bootstrap3.cshtml | 45 ++++++++++++++++++ 7 files changed, 149 insertions(+) create mode 100644 src/Umbraco.Web.UI/Views/Partials/Canvas/Editors/embed.cshtml create mode 100644 src/Umbraco.Web.UI/Views/Partials/Canvas/Editors/macro.cshtml create mode 100644 src/Umbraco.Web.UI/Views/Partials/Canvas/Editors/media.cshtml create mode 100644 src/Umbraco.Web.UI/Views/Partials/Canvas/Editors/rte.cshtml create mode 100644 src/Umbraco.Web.UI/Views/Partials/Canvas/Editors/textstring.cshtml create mode 100644 src/Umbraco.Web.UI/Views/Partials/Canvas/bootstrap2.cshtml create mode 100644 src/Umbraco.Web.UI/Views/Partials/Canvas/bootstrap3.cshtml diff --git a/src/Umbraco.Web.UI/Views/Partials/Canvas/Editors/embed.cshtml b/src/Umbraco.Web.UI/Views/Partials/Canvas/Editors/embed.cshtml new file mode 100644 index 0000000000..abdbf66c68 --- /dev/null +++ b/src/Umbraco.Web.UI/Views/Partials/Canvas/Editors/embed.cshtml @@ -0,0 +1,3 @@ +@model dynamic +@using Umbraco.Web.Templates +@Html.Raw(Model.value) \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Views/Partials/Canvas/Editors/macro.cshtml b/src/Umbraco.Web.UI/Views/Partials/Canvas/Editors/macro.cshtml new file mode 100644 index 0000000000..94ae154c87 --- /dev/null +++ b/src/Umbraco.Web.UI/Views/Partials/Canvas/Editors/macro.cshtml @@ -0,0 +1,17 @@ +@inherits UmbracoViewPage +@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); + } + + + @Umbraco.RenderMacro(macroAlias, parameters) + +} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Views/Partials/Canvas/Editors/media.cshtml b/src/Umbraco.Web.UI/Views/Partials/Canvas/Editors/media.cshtml new file mode 100644 index 0000000000..bc99b066de --- /dev/null +++ b/src/Umbraco.Web.UI/Views/Partials/Canvas/Editors/media.cshtml @@ -0,0 +1,13 @@ +@model dynamic +@using Umbraco.Web.Templates + +@if (Model.value != null) +{ +
+ @Model.value.caption +
+ if (Model.value.caption != null) + { +

@Model.value.caption

+ } +} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Views/Partials/Canvas/Editors/rte.cshtml b/src/Umbraco.Web.UI/Views/Partials/Canvas/Editors/rte.cshtml new file mode 100644 index 0000000000..37c162310a --- /dev/null +++ b/src/Umbraco.Web.UI/Views/Partials/Canvas/Editors/rte.cshtml @@ -0,0 +1,4 @@ +@model dynamic +@using Umbraco.Web.Templates + +@Html.Raw(TemplateUtilities.ParseInternalLinks(Model.value.ToString())) \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Views/Partials/Canvas/Editors/textstring.cshtml b/src/Umbraco.Web.UI/Views/Partials/Canvas/Editors/textstring.cshtml new file mode 100644 index 0000000000..0628510a5d --- /dev/null +++ b/src/Umbraco.Web.UI/Views/Partials/Canvas/Editors/textstring.cshtml @@ -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()); + + + @Html.Raw(markup) + +} +else +{ + +
@Model.value
+
+} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Views/Partials/Canvas/bootstrap2.cshtml b/src/Umbraco.Web.UI/Views/Partials/Canvas/bootstrap2.cshtml new file mode 100644 index 0000000000..cc2d0f7e7a --- /dev/null +++ b/src/Umbraco.Web.UI/Views/Partials/Canvas/bootstrap2.cshtml @@ -0,0 +1,47 @@ +@inherits UmbracoViewPage +@using Umbraco.Web.Templates +@using Newtonsoft.Json.Linq; + + +@if (Model != null && !string.IsNullOrEmpty(Model.ToString())) +{ + var onlyOneColumn = Model.sections != null ? ((System.Collections.ICollection)Model.sections).Count : 0; + +
+
+ @foreach (var s in Model.sections) + { +
+ @foreach (var row in s.rows) + { +
+
+
+ + @foreach (var area in row.areas) + { +
+ + @foreach (var control in area.controls) + { + if (control != null && control.editor != null && control.editor.view != null) + { + + string editor = "canvas/editors/" + control.editor.view.ToString(); + + @Html.Partial(editor, (object)control) + + } + } + +
+ } +
+
+
+ } +
+ } +
+
+} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Views/Partials/Canvas/bootstrap3.cshtml b/src/Umbraco.Web.UI/Views/Partials/Canvas/bootstrap3.cshtml new file mode 100644 index 0000000000..fad25edd86 --- /dev/null +++ b/src/Umbraco.Web.UI/Views/Partials/Canvas/bootstrap3.cshtml @@ -0,0 +1,45 @@ +@inherits UmbracoViewPage +@using Umbraco.Web.Templates + + +@if (Model != null && !string.IsNullOrEmpty(Model.ToString())) +{ + var onlyOneColumn = Model.sections != null ? ((System.Collections.ICollection)Model.sections).Count : 0; + +
+
+ @foreach (var s in Model.sections) + { +
+ @foreach (var row in s.rows) + { +
+
+
+ + @foreach (var area in row.areas) + { +
+ + @foreach (var control in area.controls) + { + if (control != null && control.editor != null && control.editor.view != null) + { + + string editor = "canvas/editors/" + control.editor.view.ToString(); + + @Html.Partial(editor, (object)control) + + } + } +
+ } +
+
+
+ } +
+ } +
+
+} \ No newline at end of file