-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Layout.cshtml
174 lines (163 loc) · 5.98 KB
/
Layout.cshtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
@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");
Style.Include("default-grid.css");
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
***************************************************************/
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>
@tag.EndElement