mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +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
|
/* Secondary
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
/* Has Aside */
|
/* Aside Zones */
|
||||||
.has-aside-two #layout-content
|
/* If zone 1 is on */
|
||||||
{
|
.aside-1 #layout-content { float: right; width: 600px; }
|
||||||
width: 600px;
|
.aside-1 .aside-first { float: left; width: 360px; }
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.has-aside-two .aside-second
|
/* If zone 2 is on */
|
||||||
{
|
.aside-2 #layout-content { float: left; width: 600px; }
|
||||||
width: 360px;
|
.aside-2 .aside-second { float: right; width: 360px; }
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.has-aside-one #layout-content {
|
/* If zones 1, 2 are on */
|
||||||
width: 600px;
|
.aside-12 #layout-content { width: 600px; }
|
||||||
float: right;
|
.aside-12 .aside-first, .aside-12 .aside-second { width: 180px; }
|
||||||
}
|
.aside-12 .aside-first, .aside-12 .aside-second, .aside-12 #layout-content { float:left; }
|
||||||
|
|
||||||
.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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Tripel Zones*/
|
/* Tripel Zones*/
|
||||||
#layout-tripel > div { float:left; width:960px; }
|
#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 {
|
@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 zoneCounter = 0;
|
||||||
var zoneNumsFilled = string.Join("", zoneNames.Select(zoneName => { ++zoneCounter; return Model[zoneName] != null ? zoneCounter.ToString() : "";}).ToArray());
|
var zoneNumsFilled = string.Join("", zoneNames.Select(zoneName => { ++zoneCounter; return Model[zoneName] != null ? zoneCounter.ToString() : "";}).ToArray());
|
||||||
return HasText(zoneNumsFilled) ? classNamePrefix + zoneNumsFilled : "";
|
return HasText(zoneNumsFilled) ? classNamePrefix + zoneNumsFilled : "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@{
|
@{
|
||||||
|
/* Global includes for the theme
|
||||||
|
***************************************************************/
|
||||||
|
|
||||||
Style.Include("http://fonts.googleapis.com/css?family=Lobster&subset=latin");
|
Style.Include("http://fonts.googleapis.com/css?family=Lobster&subset=latin");
|
||||||
Style.Include("site.css");
|
Style.Include("site.css");
|
||||||
|
|
||||||
// cool stuff goes up here
|
/* Some useful shortcuts or settings
|
||||||
var homeUrl = Href("~/");
|
***************************************************************/
|
||||||
|
|
||||||
// Zone is an alias for Display
|
Func<dynamic, dynamic> Zone = x => Display(x); // Zone as an alias for Display to help make it obvious when we're displaying zones
|
||||||
Func<dynamic, dynamic> Zone = x => Display(x);
|
|
||||||
|
|
||||||
//Add classes to the wrapper div to toggle zones on and off
|
/* Layout classification based on filled zones
|
||||||
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 {
|
|
||||||
|
|
||||||
|
//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
|
//Add classes to the wrapper div to toggle tripel widget zones on and off
|
||||||
// {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.");}
|
var tripelClass = CalcuClassify(new [] {"TripelFirst", "TripelSecond", "TripelThird"}, "tripel-"); // for tripel-1, triple-2, etc. if any of the tripel zones are filled
|
||||||
// {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-");
|
|
||||||
if (HasText(tripelClass)) {
|
if (HasText(tripelClass)) {
|
||||||
Model.Classes.Add(tripelClass);
|
Model.Classes.Add(tripelClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add classes to the wrapper div to toggle quad widget zones on and off
|
//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)) {
|
if (HasText(footerQuadClass)) {
|
||||||
Model.Classes.Add(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";
|
Model.Id = "layout-wrapper";
|
||||||
var tag = Tag (Model, "div");
|
var tag = Tag(Model, "div"); // using Tag so the layout div gets the classes, id and other attributes added to the Model
|
||||||
|
|
||||||
// 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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@tag.StartElement
|
@tag.StartElement
|
||||||
@if (Model.Header != null) {
|
@if (Model.Header != null) {
|
||||||
<header id="layout-header" class="group">
|
<header id="layout-header" class="group">
|
||||||
|
|||||||
@@ -62,6 +62,8 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Content>
|
</Content>
|
||||||
<None Include="TheAdmin\Views\Menu.cshtml" />
|
<None Include="TheAdmin\Views\Menu.cshtml" />
|
||||||
|
<None Include="TheThemeMachine\Views\Branding.cshtml" />
|
||||||
|
<None Include="TheThemeMachine\Views\BadgeOfHonor.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="TheAdmin\Styles\images\icons.png" />
|
<Content Include="TheAdmin\Styles\images\icons.png" />
|
||||||
@@ -91,10 +93,7 @@
|
|||||||
<Content Include="TheAdmin\Views\Header.cshtml" />
|
<Content Include="TheAdmin\Views\Header.cshtml" />
|
||||||
<Content Include="TheThemeMachine\Views\Layout.cshtml" />
|
<Content Include="TheThemeMachine\Views\Layout.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup />
|
||||||
<Folder Include="TheThemeMachine\Views\Items\" />
|
|
||||||
<Folder Include="TheThemeMachine\Views\Parts\" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.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.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
|||||||
Reference in New Issue
Block a user