2015-12-13 22:21:02 +01:00
@functions {
// To support the layout classifaction below. Implementing as a razor function because we can, could otherwise be a Func<string[], string, string> in the code block following.
string CalcuClassify(string[] zoneNames, string classNamePrefix) {
var zoneCounter = 0;
var zoneNumsFilled = string.Join("", zoneNames.Select(zoneName => { ++zoneCounter; return Model[zoneName] != null ? zoneCounter.ToString() : "";}).ToArray());
return HasText(zoneNumsFilled) ? classNamePrefix + zoneNumsFilled : "";
}
}
@{
/* Global includes for the theme
***************************************************************/
SetMeta(httpEquiv: "X-UA-Compatible", content: "IE=edge,chrome=1");
Style.Include("//fonts.googleapis.com/css?family=Lobster&subset=latin");
2016-01-13 15:47:39 -08:00
Style.Include("default-grid.css");
2015-12-13 22:21:02 +01:00
Style.Include("site.css");
/* Some useful shortcuts or settings
***************************************************************/
Func<dynamic, dynamic> Zone = x => Display(x); // Zone as an alias for Display to help make it obvious when we're displaying zones
/* Layout classification based on filled zones
***************************************************************/
//Add classes to the wrapper div to toggle aside widget zones on and off
var asideClass = CalcuClassify(new [] {"AsideFirst", "AsideSecond"}, "aside-"); // for aside-1, aside-2 or aside-12 if any of the aside zones are filled
if (HasText(asideClass)) {
Model.Classes.Add(asideClass);
}
//Add classes to the wrapper div to toggle tripel widget zones on and off
var tripelClass = CalcuClassify(new [] {"TripelFirst", "TripelSecond", "TripelThird"}, "tripel-"); // for tripel-1, triple-2, etc. if any of the tripel zones are filled
if (HasText(tripelClass)) {
Model.Classes.Add(tripelClass);
}
//Add classes to the wrapper div to toggle quad widget zones on and off
var footerQuadClass = CalcuClassify(new [] {"FooterQuadFirst", "FooterQuadSecond", "FooterQuadThird", "FooterQuadFourth"}, "split-"); // for quad-1, quad-2, etc. if any of the quad zones are filled
if (HasText(footerQuadClass)) {
Model.Classes.Add(footerQuadClass);
}
/* Inserting some ad hoc shapes
***************************************************************/
WorkContext.Layout.Header.Add(New.Branding(), "5"); // Site name and link to the home page
WorkContext.Layout.Footer.Add(New.BadgeOfHonor(), "5"); // Powered by Orchard
WorkContext.Layout.Footer.Add(New.User(), "10"); // Login and dashboard links
/* Last bit of code to prep the layout wrapper
***************************************************************/
2016-01-13 15:47:39 -08:00
2015-12-13 22:21:02 +01:00
Model.Id = "layout-wrapper";
var tag = Tag(Model, "div"); // using Tag so the layout div gets the classes, id and other attributes added to the Model
}
@tag.StartElement
@if (Model.Header != null) {
<header id="layout-header" class="group">
<div id="header">
@Zone(Model.Header)
</div>
</header>
}
@if (Model.Navigation != null) {
<div id="layout-navigation" class="group">
@Zone(Model.Navigation)
</div>
}
@if (Model.Featured != null) {
<div id="layout-featured" class="group">
@Zone(Model.Featured)
</div>
}
@if (Model.BeforeMain != null) {
<div id="layout-before-main" class="group">
@Zone(Model.BeforeMain)
</div>
}
<div id="layout-main-container">
<div id="layout-main" class="group">
@if (Model.AsideFirst != null) {
<aside id="aside-first" class="aside-first group">
@Zone(Model.AsideFirst)
</aside>
}
<div id="layout-content" class="group">
@if (Model.Messages != null) {
<div id="messages">
@Zone(Model.Messages)
</div>
}
@if (Model.BeforeContent != null) {
<div id="before-content">
@Zone(Model.BeforeContent)
</div>
}
@* the model content for the page is in the Content zone @ the default position (nothing, zero, zilch) *@
@if (Model.Content != null) {
<div id="content" class="group">
@Zone(Model.Content)
</div>
}
@if (Model.AfterContent != null) {
<div id="after-content">
@Zone(Model.AfterContent)
</div>
}
</div>
@if (Model.AsideSecond != null) {
<aside id="aside-second" class="aside-second">
@Zone(Model.AsideSecond)
</aside>
}
</div>
</div>
@if (Model.AfterMain != null) {
<div id="layout-after-main" class="group">
@Zone(Model.AfterMain)
</div>
}
@if (Model.TripelFirst != null || Model.TripelSecond != null || Model.TripelThird != null) {
<div id="layout-tripel-container">
<div id="layout-tripel" class="group">@* as in beer *@
@if (Model.TripelFirst != null) {
<div id="tripel-first">
@Zone(Model.TripelFirst)
</div>
}
@if (Model.TripelSecond != null) {
<div id="tripel-second">
@Zone(Model.TripelSecond)
</div>
}
@if (Model.TripelThird != null) {
<div id="tripel-third">
@Zone(Model.TripelThird)
</div>
}
</div>
</div>
}
<div id="layout-footer" class="group">
<footer id="footer">
<div id="footer-quad" class="group">
@if (Model.FooterQuadFirst != null) {
<div id="footer-quad-first">
@Zone(Model.FooterQuadFirst)
</div>
}
@if (Model.FooterQuadSecond != null) {
<div id="footer-quad-second">
@Zone(Model.FooterQuadSecond)
</div>
}
@if (Model.FooterQuadThird != null) {
<div id="footer-quad-third">
@Zone(Model.FooterQuadThird)
</div>
}
@if (Model.FooterQuadFourth != null) {
<div id="footer-quad-fourth">
@Zone(Model.FooterQuadFourth)
</div>
}
</div>
@if(Model.Footer != null) {
<div id="footer-sig" class="group">
@Zone(Model.Footer)
</div>
}
</footer>
</div>
2010-10-14 12:03:45 -07:00
@tag.EndElement