Skip to content

Commit a474193

Browse files
author
mac
committed
Added BlogPost and Landing Page hander files
1 parent fdd6bc0 commit a474193

7 files changed

Lines changed: 231 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/MasterPages/SiteTemplates/Template1.Master" AutoEventWireup="true" CodeBehind="Blog.aspx.cs" Inherits="WebApplication.Views.MediaTypeHandlers.Blog" %>
2+
3+
<asp:Content ID="Content1" ContentPlaceHolderID="HeaderContentPlaceHolder" runat="server">
4+
</asp:Content>
5+
<asp:Content ID="Content2" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
6+
<div class="blog">
7+
8+
<asp:ListView runat="server" ID="BlogPosts" ItemType="FrameworkLibrary.Page">
9+
<LayoutTemplate>
10+
<div class="blog-post-list">
11+
<ul>
12+
<asp:PlaceHolder runat="server" ID="itemPlaceHolder" />
13+
</ul>
14+
</div>
15+
</LayoutTemplate>
16+
<ItemTemplate>
17+
<li>
18+
<h3><a href="<%# Item.AbsoluteUrl %>"><%# Item.SectionTitle %></a></h3>
19+
<em><%# Item.RenderShortCode("{Field:ArticlePublishDate}") %></em>
20+
<%# Item.ShortDescription %>
21+
<a class="btn aqua no-margin" href="<%# Item.AbsoluteUrl %>">Read More</a>
22+
</li>
23+
</ItemTemplate>
24+
</asp:ListView>
25+
26+
<asp:ListView runat="server" ID="BlogCategories" ItemType="FrameworkLibrary.Page">
27+
<LayoutTemplate>
28+
<div class="blog-categories">
29+
<h3>Categories</h3>
30+
<ul>
31+
<asp:PlaceHolder runat="server" ID="itemPlaceHolder" />
32+
</ul>
33+
</div>
34+
</LayoutTemplate>
35+
<ItemTemplate>
36+
<li>
37+
<a href="<%# Item.AbsoluteUrl %>" class='<%# (Item.ID == CurrentMediaDetail.ID)? "current":"" %>'><%# Item.SectionTitle %></a>
38+
</li>
39+
</ItemTemplate>
40+
</asp:ListView>
41+
</div>
42+
<div class="blog-pager">
43+
<Site:Pager runat="server" PageSize="10" PagedControlID="BlogPosts" />
44+
</div>
45+
</asp:Content>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using System.Web.UI;
6+
using System.Web.UI.WebControls;
7+
using FrameworkLibrary;
8+
9+
namespace WebApplication.Views.MediaTypeHandlers
10+
{
11+
public partial class Blog : FrontEndBasePage
12+
{
13+
protected void Page_Init(object sender, EventArgs e)
14+
{
15+
//DynamicContent.Controls.Add(this.ParseControl(MediaDetailsMapper.ParseSpecialTags(CurrentMediaDetail)));
16+
17+
var blogCategoriesMediaTypeId = 26;
18+
var blogPostMediaTypeId = 24;
19+
20+
BlogCategories.DataSource = MediaDetailsMapper.GetAllActiveByMediaType(blogCategoriesMediaTypeId).ToList();
21+
BlogCategories.DataBind();
22+
23+
IEnumerable<IMediaDetail> blogPosts = new List<IMediaDetail>();
24+
25+
if(CurrentMediaDetail.MediaType.ID == blogCategoriesMediaTypeId)
26+
{
27+
blogPosts = CurrentMediaDetail.ChildMediaDetails.OrderByDescending(i=>i.DateCreated).ToList();
28+
}
29+
else
30+
{
31+
blogPosts = MediaDetailsMapper.GetAllActiveByMediaType(blogPostMediaTypeId).OrderByDescending(i=>i.DateCreated).ToList();
32+
}
33+
34+
BlogPosts.DataSource = blogPosts;
35+
BlogPosts.DataBind();
36+
}
37+
38+
public new FrameworkLibrary.Page CurrentMediaDetail
39+
{
40+
get { return (FrameworkLibrary.Page)base.CurrentMediaDetail; }
41+
}
42+
}
43+
}

WebApplication/Views/MediaTypeHandlers/Blog.aspx.designer.cs

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LandingPage.aspx.cs" Inherits="WebApplication.Views.MediaTypeHandlers.LandingPage" %>
2+
3+
<%@ Import Namespace="WebApplication" %>
4+
<!DOCTYPE html>
5+
<html lang="en-US" class="no-js">
6+
<head runat="server">
7+
<Site:CommonIncludes ID="CommonIncludes" runat="server" />
8+
<asp:PlaceHolder ID="CssIncludes" runat="server"></asp:PlaceHolder>
9+
<asp:PlaceHolder ID="JsIncludes" runat="server"></asp:PlaceHolder>
10+
<asp:PlaceHolder ID="MetaIncludes" runat="server"></asp:PlaceHolder>
11+
</head>
12+
<body>
13+
<%= FrontEndBasePage.GetSettings().GlobalCodeInBody %>
14+
15+
<form id="form2" runat="server">
16+
<asp:ScriptManager runat="server" />
17+
18+
<div class="landing-page">
19+
<asp:PlaceHolder runat="server" ID="DynamicContent" />
20+
</div>
21+
</form>
22+
</body>
23+
</html>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using FrameworkLibrary;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Web;
6+
using System.Web.UI;
7+
using System.Web.UI.WebControls;
8+
9+
namespace WebApplication.Views.MediaTypeHandlers
10+
{
11+
public partial class LandingPage : BasePage
12+
{
13+
protected void Page_Init(object sender, EventArgs e)
14+
{
15+
DynamicContent.Controls.Add(this.ParseControl(MediaDetailsMapper.ParseSpecialTags(CurrentMediaDetail)));
16+
}
17+
}
18+
}

WebApplication/Views/MediaTypeHandlers/LandingPage.aspx.designer.cs

Lines changed: 69 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
21.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)