Front Page re-organisation

This commit is contained in:
Thomas Hounsell 2017-05-13 12:17:19 +01:00
parent ba396bfcfb
commit 7d49efbb08
7 changed files with 149 additions and 91 deletions

View File

@ -136,28 +136,27 @@ public async Task<List<Build>> SelectBuildsByOrder(int limit = -1, int skip = 0)
}
[DataObjectMethod(DataObjectMethodType.Select, false)]
public async Task<FrontPage> SelectFrontPage()
public async Task<FrontPage> SelectFrontPage(ProjectFamily family)
{
FrontPage fp = new FrontPage();
IFindFluent<Build, Build> query = _buildCollection.Find(new BsonDocument
{
{ "$where", "!this.LabUrl.contains(\"xbox\")"},
{
nameof(Build.LabUrl), new BsonDocument
{
{"$in", new BsonArray(ConfigurationManager.AppSettings["site:OSGLab"].Split(';'))}
}
nameof(Build.Family), family
}
}).Sort(sortByCompileDate).Limit(1);
fp.CurrentCanary = await query.FirstOrDefaultAsync();
query = _buildCollection.Find(new BsonDocument
{
{ "$where", "!this.LabUrl.contains(\"xbox\")"},
{
nameof(Build.LabUrl), new BsonDocument
{
{"$in", new BsonArray(ConfigurationManager.AppSettings["site:InsiderLab"].Split(';'))}
}
nameof(Build.Family), family
},
{
nameof(Build.MajorVersion), 10
},
{
nameof(Build.SourceType), new BsonDocument
@ -176,11 +175,9 @@ public async Task<FrontPage> SelectFrontPage()
query = _buildCollection.Find(new BsonDocument
{
{ "$where", "((this.MajorVersion === 10 && this.LabUrl.contains(\"_release\")) || this.MajorVersion < 10) && !this.LabUrl.contains(\"xbox\")"},
{
nameof(Build.LabUrl), new BsonDocument
{
{"$in", new BsonArray(ConfigurationManager.AppSettings["site:ReleaseLab"].Split(';'))}
}
nameof(Build.Family), family
},
{
nameof(Build.SourceType), new BsonDocument
@ -197,14 +194,11 @@ public async Task<FrontPage> SelectFrontPage()
}).Sort(sortByCompileDate).Limit(1);
fp.CurrentRelease = await query.FirstOrDefaultAsync();
query = _buildCollection.Find(new BsonDocument
{
{ "$where", "this.LabUrl.contains(\"xbox\")"},
{
nameof(Build.LabUrl), new BsonDocument
{
{"$in", new BsonArray(ConfigurationManager.AppSettings["site:XboxLab"].Split(';'))}
}
nameof(Build.Family), family
}
}).Sort(sortByCompileDate).Limit(1);
fp.CurrentXbox = await query.FirstOrDefaultAsync();

View File

@ -1,9 +1,14 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26403.7
VisualStudioVersion = 15.0.26430.4
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuildFeed", "BuildFeed\BuildFeed.csproj", "{CDDCF754-ECAA-4A66-ADAA-62957A57A51B}"
ProjectSection(ProjectDependencies) = postProject
{3485B33A-6C3A-4535-9D85-4696914AD504} = {3485B33A-6C3A-4535-9D85-4696914AD504}
{7E2B4F61-1C11-4471-AF80-5480E94C0664} = {7E2B4F61-1C11-4471-AF80-5480E94C0664}
{7C67BFB9-1B3B-4676-A58D-10573DA82CFE} = {7C67BFB9-1B3B-4676-A58D-10573DA82CFE}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MongoAuth", "Authentication\MongoAuth\MongoAuth.csproj", "{7C67BFB9-1B3B-4676-A58D-10573DA82CFE}"
EndProject

View File

@ -38,8 +38,14 @@ public FrontController()
#endif
public async Task<ActionResult> Index()
{
FrontPage fp = await _bModel.SelectFrontPage();
return View("Index", fp);
var items = new Dictionary<ProjectFamily, FrontPage>
{
{ProjectFamily.Redstone3, await _bModel.SelectFrontPage(ProjectFamily.Redstone3)},
{ProjectFamily.Feature2, await _bModel.SelectFrontPage(ProjectFamily.Feature2)},
{ProjectFamily.Redstone2, await _bModel.SelectFrontPage(ProjectFamily.Redstone2)},
{ProjectFamily.Redstone, await _bModel.SelectFrontPage(ProjectFamily.Redstone)}
};
return View(nameof(Index), items);
}
[Route("page-{page:int:min(1)}/", Order = 0)]

View File

@ -1,4 +1,8 @@
@model BuildFeed.Model.View.FrontPage
@using BuildFeed.Code
@using BuildFeed.Controllers
@using BuildFeed.Model
@using BuildFeed.Model.View
@model Dictionary<BuildFeed.Model.ProjectFamily, BuildFeed.Model.View.FrontPage>
@{
ViewBag.Title = string.Format(VariantTerms.Front_HomeH1, InvariantTerms.SiteName);
}
@ -10,70 +14,82 @@
<h1>@string.Format(VariantTerms.Front_HomeH1, InvariantTerms.SiteName)</h1>
<h3>@VariantTerms.Front_LatestBuilds</h3>
<div class="latest-flex">
@if (Model.CurrentCanary != null)
{
<a href="@Url.Action("ViewBuild", new
{
Model.CurrentCanary.Id
})" class="latest-flex-item latest-flex-red">
<h3 class="latest-flex-title">@VariantTerms.Front_CurrentCanary</h3>
<div class="latest-flex-detail">
<p class="latest-flex-build">@(Model.CurrentCanary.Number).@(Model.CurrentCanary.Revision)</p>
<p class="latest-flex-lab">@Model.CurrentCanary.Lab</p>
<p class="latest-flex-time">@(Model.CurrentCanary.BuildTime?.ToString("HH:mm, dddd dd MMMM yyyy"))</p>
</div>
</a>
}
@if (Model.CurrentInsider != null)
{
<a href="@Url.Action("ViewBuild", new
{
Model.CurrentInsider.Id
})" class="latest-flex-item latest-flex-yellow">
<h3 class="latest-flex-title">@VariantTerms.Front_CurrentInsider</h3>
<div class="latest-flex-detail">
<p class="latest-flex-build">@(Model.CurrentInsider.Number).@(Model.CurrentInsider.Revision)</p>
<p class="latest-flex-lab">@Model.CurrentInsider.Lab</p>
<p class="latest-flex-time">@(Model.CurrentInsider.BuildTime?.ToString("HH:mm, dddd dd MMMM yyyy"))</p>
</div>
</a>
}
@if (Model.CurrentRelease != null)
{
<a href="@Url.Action("ViewBuild", new
{
Model.CurrentRelease.Id
})" class="latest-flex-item latest-flex-blue">
<h3 class="latest-flex-title">@VariantTerms.Front_CurrentRelease</h3>
<div class="latest-flex-detail">
<p class="latest-flex-build">@(Model.CurrentRelease.Number).@(Model.CurrentRelease.Revision)</p>
<p class="latest-flex-lab">@Model.CurrentRelease.Lab</p>
<p class="latest-flex-time">@(Model.CurrentRelease.BuildTime?.ToString("HH:mm, dddd dd MMMM yyyy"))</p>
</div>
</a>
}
@if (Model.CurrentXbox != null)
{
<a href="@Url.Action("ViewBuild", new
{
Model.CurrentXbox.Id
})" class="latest-flex-item latest-flex-green">
<h3 class="latest-flex-title">@VariantTerms.Front_CurrentXbox</h3>
<div class="latest-flex-detail">
<p class="latest-flex-build">@(Model.CurrentXbox.Number).@(Model.CurrentXbox.Revision)</p>
<p class="latest-flex-lab">@Model.CurrentXbox.Lab</p>
<p class="latest-flex-time">@(Model.CurrentXbox.BuildTime?.ToString("HH:mm, dddd dd MMMM yyyy"))</p>
</div>
</a>
}
</div>
<a href="@Url.Action("IndexPage", new
{
Page = 1
})" class="latest-full">
@VariantTerms.Front_FullBuildListing
</a>
<div class="trim-wrapper">
<div class="latest-family-wrapper">
@foreach (KeyValuePair<ProjectFamily, FrontPage> item in Model)
{
FrontPage family = item.Value;
<div class="latest-family">
<h3>@MvcExtensions.GetDisplayTextForEnum(item.Key)</h3>
<div class="latest-flex">
@if (family.CurrentCanary != null && family.CurrentCanary.Id != family.CurrentInsider?.Id)
{
<a href="@Url.Action(nameof(FrontController.ViewBuild), new
{
family.CurrentCanary.Id
})" class="latest-flex-item latest-flex-red">
<h4 class="latest-flex-title">@VariantTerms.Front_CurrentCanary</h4>
<div class="latest-flex-detail">
<p class="latest-flex-build">@(family.CurrentCanary.Number).@(family.CurrentCanary.Revision)</p>
<p class="latest-flex-lab">@family.CurrentCanary.Lab</p>
<p class="latest-flex-time">@(family.CurrentCanary.BuildTime?.ToString("HH:mm, dddd dd MMMM yyyy"))</p>
</div>
</a>
}
@if (family.CurrentInsider != null && family.CurrentInsider.Id != family.CurrentRelease?.Id)
{
<a href="@Url.Action(nameof(FrontController.ViewBuild), new
{
family.CurrentInsider.Id
})" class="latest-flex-item latest-flex-yellow">
<h4 class="latest-flex-title">@VariantTerms.Front_CurrentInsider</h4>
<div class="latest-flex-detail">
<p class="latest-flex-build">@(family.CurrentInsider.Number).@(family.CurrentInsider.Revision)</p>
<p class="latest-flex-lab">@family.CurrentInsider.Lab</p>
<p class="latest-flex-time">@(family.CurrentInsider.BuildTime?.ToString("HH:mm, dddd dd MMMM yyyy"))</p>
</div>
</a>
}
@if (family.CurrentRelease != null)
{
<a href="@Url.Action(nameof(FrontController.ViewBuild), new
{
family.CurrentRelease.Id
})" class="latest-flex-item latest-flex-blue">
<h4 class="latest-flex-title">@VariantTerms.Front_CurrentRelease</h4>
<div class="latest-flex-detail">
<p class="latest-flex-build">@(family.CurrentRelease.Number).@(family.CurrentRelease.Revision)</p>
<p class="latest-flex-lab">@family.CurrentRelease.Lab</p>
<p class="latest-flex-time">@(family.CurrentRelease.BuildTime?.ToString("HH:mm, dddd dd MMMM yyyy"))</p>
</div>
</a>
}
@if (family.CurrentXbox != null)
{
<a href="@Url.Action(nameof(FrontController.ViewBuild), new
{
family.CurrentXbox.Id
})" class="latest-flex-item latest-flex-green">
<h4 class="latest-flex-title">@VariantTerms.Front_CurrentXbox</h4>
<div class="latest-flex-detail">
<p class="latest-flex-build">@(family.CurrentXbox.Number).@(family.CurrentXbox.Revision)</p>
<p class="latest-flex-lab">@family.CurrentXbox.Lab</p>
<p class="latest-flex-time">@(family.CurrentXbox.BuildTime?.ToString("HH:mm, dddd dd MMMM yyyy"))</p>
</div>
</a>
}
</div>
</div>
}
</div>
</div>
<h3>@VariantTerms.Front_Share</h3>
<div class="addthis_sharing_toolbox"></div>
<br />

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -107,6 +107,10 @@ table
}
}
.trim-wrapper
{
overflow: hidden;
}
.container
{
@ -114,7 +118,6 @@ table
max-width: 88%;
margin: 0 auto;
position: relative;
overflow: hidden;
}
.no-wrapping
@ -340,6 +343,17 @@ article
}
}
h2
{
text-align: center;
font-size: 3em;
font-weight: bold;
margin: 1em 0 #{(2em / 3)};
text-transform: uppercase;
letter-spacing: #{(1em / 6)};
border-bottom: $border-size solid;
}
h3
{
font-size: 2em;
@ -422,12 +436,33 @@ article
}
}
.latest-family-wrapper
{
display: flex;
flex-wrap: wrap;
margin-right: -4em;
overflow: hidden;
.latest-family
{
flex-grow: 1;
margin-right: 4em;
> h3
{
margin-bottom: 0.5em;
text-transform: none;
letter-spacing: 2px;
}
}
}
.latest-flex
{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin: 2em -2em 0 0;
justify-content: flex-start;
margin: 0 -2em 0 0;
.latest-flex-item
{
@ -444,8 +479,10 @@ article
text-decoration: none;
}
h3.latest-flex-title
h4.latest-flex-title
{
text-transform: uppercase;
letter-spacing: #{(1em / 4)};
border-bottom: 0;
margin: 0;
padding: 0;
@ -461,7 +498,7 @@ article
{
border-color: $strong-red;
h3.latest-flex-title
h4.latest-flex-title
{
background: $strong-red;
}
@ -471,7 +508,7 @@ article
{
border-color: $strong-yellow;
h3.latest-flex-title
h4.latest-flex-title
{
background: $strong-yellow;
}
@ -481,7 +518,7 @@ article
{
border-color: $strong-blue;
h3.latest-flex-title
h4.latest-flex-title
{
background: $strong-blue;
}
@ -491,7 +528,7 @@ article
{
border-color: $strong-green;
h3.latest-flex-title
h4.latest-flex-title
{
background: $strong-green;
}
@ -532,7 +569,7 @@ article
font-weight: normal;
text-align: center;
color: #fff;
margin: 0 0 2em;
margin: 0;
padding: #{(2em / 3)};
&:hover,