diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/embed.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/embed.cshtml new file mode 100644 index 0000000000..abdbf66c68 --- /dev/null +++ b/src/Umbraco.Web.UI/Views/Partials/Grid/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/Grid/Editors/macro.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/macro.cshtml new file mode 100644 index 0000000000..60db09cc3a --- /dev/null +++ b/src/Umbraco.Web.UI/Views/Partials/Grid/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.marcoParamsDictionary) + { + 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/Grid/Editors/media.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/media.cshtml new file mode 100644 index 0000000000..bc99b066de --- /dev/null +++ b/src/Umbraco.Web.UI/Views/Partials/Grid/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/Grid/Editors/rte.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/rte.cshtml new file mode 100644 index 0000000000..37c162310a --- /dev/null +++ b/src/Umbraco.Web.UI/Views/Partials/Grid/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/Grid/Editors/textstring.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/textstring.cshtml new file mode 100644 index 0000000000..0628510a5d --- /dev/null +++ b/src/Umbraco.Web.UI/Views/Partials/Grid/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/Grid/basic.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/basic.cshtml new file mode 100644 index 0000000000..5f282702bb --- /dev/null +++ b/src/Umbraco.Web.UI/Views/Partials/Grid/basic.cshtml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/bootstrap2.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/bootstrap2.cshtml new file mode 100644 index 0000000000..beb89b59e9 --- /dev/null +++ b/src/Umbraco.Web.UI/Views/Partials/Grid/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 = "grid/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/Grid/bootstrap3.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/bootstrap3.cshtml index 91dd2c02e2..7710c46a5d 100644 --- a/src/Umbraco.Web.UI/Views/Partials/Grid/bootstrap3.cshtml +++ b/src/Umbraco.Web.UI/Views/Partials/Grid/bootstrap3.cshtml @@ -26,78 +26,12 @@ if (control != null && control.editor != null && control.editor.view != null) { - string editor = control.editor.view.ToString(); - - switch (editor) - { - case "rte": - - @Html.Raw(TemplateUtilities.ParseInternalLinks(control.value.ToString())) - - break; - case "macro": - if (control.value != null) - { - string macroAlias = control.value.macroAlias.ToString(); - ViewDataDictionary parameters = new ViewDataDictionary(); - foreach (dynamic mpd in control.value.marcoParamsDictionary) - { - parameters.Add(mpd.Name, mpd.Value); - } - - - @Umbraco.RenderMacro(macroAlias, parameters) - - } - break; - case "textstring": - - if (control.editor.config.markup != null) - { - string markup = control.editor.config.markup.ToString(); - - markup = markup.Replace("#value#", control.value.ToString()); - markup = markup.Replace("#style#", control.editor.config.style.ToString()); - - - @Html.Raw(markup) - - } - else - { - -
@control.value
-
- } - - break; - case "media": - - @if (control.value != null) - { -
- -
- if (control.value.caption != null) - { -

@control.value.caption

- } - } -
- break; - case "embed": - - @Html.Raw(control.value) - - break; - default: - break; - } - + string editor = "grid/editors/" + control.editor.view.ToString(); + + @Html.Partial(editor, (object)control) + } - } - }