mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Tidying up TheThemeMachine layout code block a little
--HG-- branch : dev
This commit is contained in:
@@ -378,41 +378,19 @@ nav ul
|
||||
/* Secondary
|
||||
***************************************************************/
|
||||
|
||||
/* Has Aside */
|
||||
.has-aside-two #layout-content
|
||||
{
|
||||
width: 600px;
|
||||
float: left;
|
||||
}
|
||||
/* Aside Zones */
|
||||
/* If zone 1 is on */
|
||||
.aside-1 #layout-content { float: right; width: 600px; }
|
||||
.aside-1 .aside-first { float: left; width: 360px; }
|
||||
|
||||
.has-aside-two .aside-second
|
||||
{
|
||||
width: 360px;
|
||||
float: right;
|
||||
}
|
||||
/* If zone 2 is on */
|
||||
.aside-2 #layout-content { float: left; width: 600px; }
|
||||
.aside-2 .aside-second { float: right; width: 360px; }
|
||||
|
||||
.has-aside-one #layout-content {
|
||||
width: 600px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.has-aside-one .aside-first {
|
||||
width: 360px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.has-asides #layout-content
|
||||
{
|
||||
width: 600px;
|
||||
}
|
||||
.has-asides .aside-first, .has-asides .aside-second
|
||||
{
|
||||
width: 180px;
|
||||
}
|
||||
.has-asides .aside-first, .has-asides .aside-second, .has-asides #layout-content
|
||||
{
|
||||
float:left;
|
||||
}
|
||||
/* If zones 1, 2 are on */
|
||||
.aside-12 #layout-content { width: 600px; }
|
||||
.aside-12 .aside-first, .aside-12 .aside-second { width: 180px; }
|
||||
.aside-12 .aside-first, .aside-12 .aside-second, .aside-12 #layout-content { float:left; }
|
||||
|
||||
/* Tripel Zones*/
|
||||
#layout-tripel > div { float:left; width:960px; }
|
||||
|
@@ -0,0 +1 @@
|
||||
<div class="credits"><span class="poweredby">@T("Powered by <a href=\"{0}\" title=\"Welcome to the New World Order\" target=\"_blank\">Orchard</a>", "http://www.orchardproject.net")</span> <span class="copyright">@T("© The Theme Machine 2010.")</span></div>
|
@@ -0,0 +1,4 @@
|
||||
@{
|
||||
var homeUrl = Href("~/");
|
||||
}
|
||||
<h1 id="branding"><a href="@homeUrl">@WorkContext.CurrentSite.SiteName</a></h1>
|
@@ -1,67 +1,57 @@
|
||||
@functions {
|
||||
string CalcuClassify(string[] zoneNames, string classNamePrefix)
|
||||
{
|
||||
// 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
|
||||
***************************************************************/
|
||||
|
||||
Style.Include("http://fonts.googleapis.com/css?family=Lobster&subset=latin");
|
||||
Style.Include("site.css");
|
||||
|
||||
// cool stuff goes up here
|
||||
var homeUrl = Href("~/");
|
||||
/* Some useful shortcuts or settings
|
||||
***************************************************************/
|
||||
|
||||
// Zone is an alias for Display
|
||||
Func<dynamic, dynamic> Zone = x => Display(x);
|
||||
Func<dynamic, dynamic> Zone = x => Display(x); // Zone as an alias for Display to help make it obvious when we're displaying zones
|
||||
|
||||
//Add classes to the wrapper div to toggle zones on and off
|
||||
if (Model.AsideFirst != null && Model.AsideSecond == null) {
|
||||
Model.Classes.Add("has-aside-one");
|
||||
}
|
||||
else if (Model.AsideFirst == null && Model.AsideSecond != null) {
|
||||
Model.Classes.Add("has-aside-two");
|
||||
}
|
||||
else if (Model.AsideFirst != null && Model.AsideSecond != null) {
|
||||
Model.Classes.Add("has-asides");
|
||||
}
|
||||
else {
|
||||
/* 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);
|
||||
}
|
||||
|
||||
// Debug Quad
|
||||
// {WorkContext.Layout.FooterQuadSecond.Add("2 This is some test text to see if zones are working. This is some test text to see if zones are working.");}
|
||||
// {WorkContext.Layout.FooterQuadFirst.Add("1 This is some test text to see if zones are working. This is some test text to see if zones are working.");}
|
||||
// {WorkContext.Layout.FooterQuadThird.Add("3 This is some test text to see if zones are working. This is some test text to see if zones are working.");}
|
||||
|
||||
//Add classes to the wrapper div to toggle quad widget zones on and off
|
||||
var tripelClass = CalcuClassify(new [] {"TripelFirst", "TripelSecond", "TripelThird"}, "tripel-");
|
||||
//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-");
|
||||
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
|
||||
***************************************************************/
|
||||
|
||||
Model.Id = "layout-wrapper";
|
||||
var tag = Tag (Model, "div");
|
||||
|
||||
// needs to be the page title, not page (head) title...
|
||||
// Adds text and html to the header zone
|
||||
using(Capture(branding => WorkContext.Layout.Header.Add(branding) )) {
|
||||
<h1 id="branding"><a href="@homeUrl">@WorkContext.CurrentSite.SiteName</a></h1>
|
||||
}
|
||||
using(Capture(pbo => WorkContext.Layout.Footer.Add(pbo) )) {
|
||||
<div class="credits"><span class="poweredby">Powered by <a href="http://www.orchardproject.net" title="Welcome to the New World Order" target="_blank">Orchard</a></span> <span class="copyright">© The Theme Machine 2010.</span></div>
|
||||
}
|
||||
|
||||
WorkContext.Layout.Footer.Add(New.User());
|
||||
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">
|
||||
|
@@ -62,6 +62,8 @@
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<None Include="TheAdmin\Views\Menu.cshtml" />
|
||||
<None Include="TheThemeMachine\Views\Branding.cshtml" />
|
||||
<None Include="TheThemeMachine\Views\BadgeOfHonor.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="TheAdmin\Styles\images\icons.png" />
|
||||
@@ -91,10 +93,7 @@
|
||||
<Content Include="TheAdmin\Views\Header.cshtml" />
|
||||
<Content Include="TheThemeMachine\Views\Layout.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="TheThemeMachine\Views\Items\" />
|
||||
<Folder Include="TheThemeMachine\Views\Parts\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
Reference in New Issue
Block a user