Skip to content

Instantly share code, notes, and snippets.

@kgiszewski
Last active August 28, 2017 19:37
Show Gist options
  • Save kgiszewski/29db03b5f20e3b0858fbad55dcbc0989 to your computer and use it in GitHub Desktop.
Save kgiszewski/29db03b5f20e3b0858fbad55dcbc0989 to your computer and use it in GitHub Desktop.
public class AboutUsModel : RenderModel
{
public IPublishedContent MainImage { get; }
public string MainImageUrl { get; }
public AboutUsModel(IPublishedContent content)
: base(content)
{
MainImage = Content.GetHeaderImage("mainImage");
MainImageUrl = MainImage.Url.GetCropUrl(width: 1200).EnsureRelativeUrl();
}
}
@using Archetype.Extensions
@using Archetype.Models
@using Umbraco.Web
@inherits Umbraco.Web.Mvc.UmbracoViewPage<KGLLC.OakGrove.Models.AboutUsModel>
@{
Layout = "~/Views/OakGrove/Base.cshtml";
}
<div id="about-us-parallax" class="parallaxModule title" data-parallax="scroll" data-image-src="@Model.MainImageUrl">
<div class="container">
</div>
</div>
<div class="container margin-top-20">
</div>
@Html.RenderArchetypePartials(Model.Content.GetPropertyValue<ArchetypeModel>("modules"), "~/Views/OakGrove/Partials/Archetype/")
<div class="container margin-bottom-20">
</div>
using System.Web.Mvc;
using KGLLC.OakGrove.Models;
using Umbraco.Web.Models;
using Umbraco.Web.Mvc;
namespace KGLLC.OakGrove.Controllers
{
public class OakGroveAboutUsPageController : RenderMvcController
{
public override ActionResult Index(RenderModel model)
{
return View("~/Views/OakGrove/OakGroveAboutUsPage.cshtml", new AboutUsModel(model.Content));
}
}
}
@using KGLLC.Umbraco.Common.Extensions
@inherits Umbraco.Web.Mvc.UmbracoViewPage<Archetype.Models.ArchetypeFieldsetModel>
<section class="container richtext-module">
<div class="col-md-12">
@Html.Raw(Model.GetValue<string>("text"))
</div>
</section>
@kgiszewski
Copy link
Author

OakGroveAboutUsPage is the document type alias.

ArchetypeFieldsetModel class the Archetype partial should inherit.

@Html.RenderArchetypePartials(Model.Content.GetPropertyValue<ArchetypeModel>("modules"), "~/Views/OakGrove/Partials/Archetype/") <== modules is the document type property alias name.

"~/Views/OakGrove/Partials/Archetype/" is the path to the partials.

text is the Archetype property alias.

@kgiszewski
Copy link
Author

richtextModule is the fieldset alias for an Archetype.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment