Last active
January 18, 2017 21:35
-
-
Save wiedikerli/13d8b6a2e420884445dd3fe26fa0c39a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@model GridControl | |
@{ | |
string view = Model.Editor.Render != null ? Model.Editor.Render.ToString() : Model.Editor.View.ToString(); | |
view = view.ToLower().Replace(".html", ".cshtml"); | |
if (!view.Contains("/")) | |
{ | |
view = "grid/editors/" + view; | |
} | |
} | |
@Html.Partial(view, Model.JObject, new ViewDataDictionary(this.ViewData)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@inherits ModulesViewPage<CallToActionCall> | |
@if (Model != null) | |
{ | |
using (Html.OptenModule(Model, "call-to-action -call-1")) | |
{ | |
<div class="row flex-row"> | |
<div class="col-md-10 col-sm-8"> | |
@if (Model.Title.IsNullOrWhiteSpace() == false) | |
{ | |
<h2 class="call-to-action-title text-uppercase">@Html.Raw(Model.Title)</h2> | |
} | |
@if (Model.Subtitle.IsNullOrWhiteSpace() == false) | |
{ | |
<h2 class="call-to-action-subtitle text-uppercase">@Html.Raw(Model.Subtitle)</h2> | |
} | |
</div> | |
<div class="col-md-2 col-sm-4"> | |
@if (Model.Links != null && Model.Links.Any()) | |
{ | |
<ul class="call-to-action-button-list"> | |
@foreach (var link in Model.Links) | |
{ | |
<li> | |
@link.AsLink(htmlAttributes: new { @class = "btn btn-primary btn-block call-to-action-button text-uppercase", target = link.Target }) | |
</li> | |
} | |
</ul> | |
} | |
</div> | |
</div> | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@inherits UmbracoViewPage<GridDataModel> | |
@if (Model != null && Model.Sections != null) | |
{ | |
foreach (var section in Model.Sections) | |
{ | |
foreach (var row in section.Rows) | |
{ | |
foreach (var area in row.Areas) | |
{ | |
foreach (var control in area.Controls) | |
{ | |
if (control != null && control.Editor != null && control.Editor.View != null) | |
{ | |
@Html.Partial("grid/editors/base", control) | |
} | |
} | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Web.Mvc; | |
using Umbraco.Core.Models.PublishedContent; | |
using Umbraco.Web.Mvc; | |
namespace Opten.Modules.Web.Mvc | |
{ | |
public abstract class ModulesViewPage<TModel> : UmbracoViewPage<TModel> where TModel:PublishedContentModel | |
{ | |
// maps model | |
protected override void SetViewData(ViewDataDictionary viewData) | |
{ | |
viewData.Model = (TModel)Activator.CreateInstance(typeof(TModel), new object[] { viewData.Model }); | |
// set the view data | |
base.SetViewData(viewData); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment