Skip to content

Commit 6aee868

Browse files
committed
Introduced views into Ignia.Topics.Web.Host
There's actually only one view I'm bothering to create, since this is already an exercise in formality, and that's for the most ubiquitous `Page.aspx`. Other views are easy to produce based off the template, should anyone ever have the desire. That said, we should really be putting the `Ignia.Topics.Web` projec to pasture at this point.
1 parent df0637c commit 6aee868

File tree

7 files changed

+215
-10
lines changed

7 files changed

+215
-10
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Layout.master.cs" Inherits="Ignia.Topics.Web.Host.Common.Templates.Layout" %>
2+
3+
<html>
4+
<head runat="server">
5+
<meta charset="UTF-8">
6+
<title></title>
7+
<meta name="keywords" content="<%# PageTopic.Attributes.GetValue("MetaKeywords") %>" />
8+
<meta name="description" content="<%# PageTopic.Attributes.GetValue("MetaDescription") %>" />
9+
<asp:ContentPlaceHolder ID="Head" runat="server"></asp:ContentPlaceHolder>
10+
</head>
11+
<body vocab="http://schema.org/" typeof="WebPage">
12+
13+
<!-- Site Navigation Area -->
14+
<navigation id="SiteNavigation">
15+
<vc:menu />
16+
</navigation>
17+
<!-- /Site Navigation Area -->
18+
19+
<!-- Main Site Content Area -->
20+
<main id="MainContentArea" class="page content" role="main">
21+
22+
<!-- Page Header Area -->
23+
<section id="PageHeaderSection">
24+
<vc:page-level-navigation />
25+
</section>
26+
<!-- /Page Header Area -->
27+
28+
<article itemscope itemtype="http://schema.org/WebPageElement" itemprop="mainContentOfPage" class="grid-container">
29+
<h1><%# PageTopic.Title %></h1>
30+
<p class="subtitle"><%# PageTopic.Attributes.GetValue("Subtitle") %></p>
31+
<section class="body">
32+
33+
<asp:ContentPlaceHolder ID="Content" runat="server"></asp:ContentPlaceHolder>
34+
35+
<h2>Attributes</h2>
36+
<asp:Repeater ID="Attributes" runat="server">
37+
<ItemTemplate>
38+
<li><b><%# ((AttributeValue)Container.DataItem).Key %>:</b> <%# ((AttributeValue)Container.DataItem).Value %></li>
39+
</ItemTemplate>
40+
</asp:Repeater>
41+
42+
<h2>Relationships</h2>
43+
<asp:Repeater ID="Relationships" runat="server">
44+
<ItemTemplate>
45+
<h3><%# ((NamedTopicCollection)Container.DataItem).Name %></h3>
46+
<asp:Repeater ID="Relationship" DataSource=<%# ((NamedTopicCollection)Container.DataItem) %> runat="server">
47+
<ItemTemplate>
48+
<li><b><%# ((Topic)Container.DataItem).Title %></b> (<%# ((Topic)Container.DataItem).GetUniqueKey() %></li>
49+
</ItemTemplate>
50+
</asp:Repeater>
51+
52+
</ItemTemplate>
53+
</asp:Repeater>
54+
55+
<h2>Body</h2>
56+
<%# PageTopic.Attributes.GetValue("Body") %>
57+
58+
</section>
59+
</article>
60+
</main>
61+
<!-- /Main Site Content Area -->
62+
63+
<asp:ContentPlaceHolder ID="Scripts" runat="server"></asp:ContentPlaceHolder>
64+
65+
</body>
66+
</html>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*==============================================================================================================================
2+
| Author Ignia, LLC
3+
| Client Ignia, LLC
4+
| Project OnTopicSample OnTopic Site
5+
\=============================================================================================================================*/
6+
using System;
7+
using System.Linq;
8+
using System.Web.UI;
9+
10+
namespace Ignia.Topics.Web.Host.Common.Templates {
11+
12+
/*============================================================================================================================
13+
| CLASS: LAYOUT MASTER
14+
\---------------------------------------------------------------------------------------------------------------------------*/
15+
/// <summary>
16+
/// Provides properties and functionality necessary for use with the master page template and dependent pages.
17+
/// </summary>
18+
public partial class Layout: System.Web.UI.MasterPage {
19+
20+
21+
/*==========================================================================================================================
22+
| PAGE LOAD
23+
\-------------------------------------------------------------------------------------------------------------------------*/
24+
void Page_Load(Object Src, EventArgs E) {
25+
26+
/*------------------------------------------------------------------------------------------------------------------------
27+
| Set page title
28+
\-----------------------------------------------------------------------------------------------------------------------*/
29+
Page.Title = Page.Title;
30+
31+
/*------------------------------------------------------------------------------------------------------------------------
32+
| Set data sources
33+
\-----------------------------------------------------------------------------------------------------------------------*/
34+
Attributes.DataSource = PageTopic.Attributes.Where(t => t.Key != "Body");
35+
Relationships.DataSource = PageTopic.Relationships;
36+
37+
/*------------------------------------------------------------------------------------------------------------------------
38+
| Ensure data binding
39+
\-----------------------------------------------------------------------------------------------------------------------*/
40+
this.DataBind();
41+
42+
}
43+
44+
/*==========================================================================================================================
45+
| PROPERTY: PAGE TOPIC
46+
\-------------------------------------------------------------------------------------------------------------------------*/
47+
/// <summary>
48+
/// Identifies the topic associated with the page based on the RouteData. If the topic cannot be identified then a null
49+
/// reference is returned.
50+
/// </summary>
51+
public Topic PageTopic {
52+
get {
53+
if (Page is TopicPage) {
54+
return ((TopicPage)Page).Topic;
55+
}
56+
return TopicRepository.DataProvider.Load("Web");
57+
}
58+
}
59+
60+
}
61+
}

Ignia.Topics.Web.Host/Common/Templates/Layout.master.designer.cs

Lines changed: 60 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<%@ Page Title="" Language="C#" MasterPageFile="~/Common/Templates/Layout.master" AutoEventWireup="true" Inherits="Ignia.Topics.Web.TopicPage" %>
2+
3+
<%@ MasterType virtualPath="~/Common/Templates/Layout.Master" %>
4+
5+
<asp:Content ID="Content" ContentPlaceHolderID="Content" runat="server">
6+
</asp:Content>
7+
8+
<asp:Content ID="Head" ContentPlaceHolderID="head" runat="server">
9+
</asp:Content>

Ignia.Topics.Web.Host/Global.asax.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ public class Global : System.Web.HttpApplication {
2828
[Obsolete]
2929
protected void Application_Start(object sender, EventArgs e) {
3030

31-
/*------------------------------------------------------------------------------------------------------------------------
32-
| ESTABLISH ERROR TRACKING VARIABLES
33-
\-----------------------------------------------------------------------------------------------------------------------*/
34-
Application["Debug"] = false;
35-
Application["ErrorTime"] = DateTime.Now;
36-
Application["ErrorCount"] = 0;
37-
3831
/*------------------------------------------------------------------------------------------------------------------------
3932
| CONFIGURE REPOSITORY
4033
\-----------------------------------------------------------------------------------------------------------------------*/

Ignia.Topics.Web.Host/Ignia.Topics.Web.Host.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,26 @@
7070
</Reference>
7171
</ItemGroup>
7272
<ItemGroup>
73+
<Content Include="Common\Templates\Page.aspx" />
7374
<Content Include="Global.asax" />
7475
<Content Include="Web.config" />
7576
</ItemGroup>
7677
<ItemGroup>
78+
<Compile Include="Common\Templates\Layout.master.cs">
79+
<DependentUpon>Layout.master</DependentUpon>
80+
<SubType>ASPXCodeBehind</SubType>
81+
</Compile>
82+
<Compile Include="Common\Templates\Layout.master.designer.cs">
83+
<DependentUpon>Layout.master</DependentUpon>
84+
</Compile>
7785
<Compile Include="Global.asax.cs">
7886
<DependentUpon>Global.asax</DependentUpon>
7987
</Compile>
8088
<Compile Include="Properties\AssemblyInfo.cs" />
8189
</ItemGroup>
8290
<ItemGroup>
8391
<Content Include="Configuration\ConnectionStrings.config" />
92+
<Content Include="Common\Templates\Layout.master" />
8493
<None Include="packages.config" />
8594
<None Include="Web.Debug.config">
8695
<DependentUpon>Web.config</DependentUpon>
@@ -91,6 +100,7 @@
91100
</ItemGroup>
92101
<ItemGroup>
93102
<Folder Include="App_Data\" />
103+
<Folder Include="Common\Controls\" />
94104
<Folder Include="Models\" />
95105
</ItemGroup>
96106
<ItemGroup>

Ignia.Topics.Web.Host/Web.config

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@
55

66
<system.web>
77

8-
<compilation debug="true" targetFramework="4.8"/>
9-
<httpRuntime targetFramework="4.8"/>
8+
<compilation debug="true" targetFramework="4.8">
9+
<assemblies>
10+
<add assembly="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" />
11+
</assemblies>
12+
</compilation>
13+
<httpRuntime targetFramework="4.8" />
1014

11-
<pages pageBaseType="Ignia.Topics.Web.TopicPage" theme="Default">
15+
<pages pageBaseType="Ignia.Topics.Web.TopicPage">
1216
<namespaces>
1317
<add namespace="Ignia.Topics" />
18+
<add namespace="Ignia.Topics.Attributes" />
19+
<add namespace="Ignia.Topics.Collections" />
1420
<add namespace="Ignia.Topics.Web" />
1521
</namespaces>
1622
<controls>

0 commit comments

Comments
 (0)