Merge pull request #1 from hounsell/master

sync
This commit is contained in:
kulaLin 2017-05-14 14:19:18 +08:00 committed by GitHub
commit 2bdc5bb841
17 changed files with 185 additions and 121 deletions

View File

@ -140,7 +140,7 @@ private void GenerateFamily()
{
Family = ProjectFamily.Redstone2;
}
else if(Lab?.StartsWith("rs1", StringComparison.InvariantCultureIgnoreCase) ?? false)
else if (Lab?.StartsWith("rs1", StringComparison.InvariantCultureIgnoreCase) ?? false)
{
Family = ProjectFamily.Redstone;
}

View File

@ -29,7 +29,8 @@ public class BuildDetails
public string Lab { get; set; }
[Display(ResourceType = typeof(VariantTerms), Name = nameof(VariantTerms.Model_BuildTime))]
[DisplayFormat(ConvertEmptyStringToNull = true, ApplyFormatInEditMode = true,
[DisplayFormat(ConvertEmptyStringToNull = true,
ApplyFormatInEditMode = true,
DataFormatString = "{0:yyMMdd-HHmm}")]
public DateTime? BuildTime { get; set; }

View File

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Linq;
using System.Threading.Tasks;
using BuildFeed.Model.View;
@ -136,28 +135,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 +174,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 +193,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

@ -48,7 +48,7 @@ public enum ProjectFamily
[Display(Name = "Redstone 2 (Feature Update)")]
Feature2 = 41,
[Display(Name = "Redstone 3")]
[Display(Name = "Redstone 3", Description = "Windows 10 (Fall Creators Update)")]
Redstone3 = 50
}
}

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

@ -86,7 +86,9 @@ public static string ToString(byte[] input)
{
returnArray[arrayIndex++] = ValueToChar(nextChar);
while (arrayIndex != charCount)
{
returnArray[arrayIndex++] = '='; //padding
}
}
return new string(returnArray);

View File

@ -10,7 +10,8 @@ namespace BuildFeed.Code
{
public static class MvcExtensions
{
public static IHtmlString CheckboxListForEnum<T>(this HtmlHelper html, string id, T currentItem) where T : struct
public static IHtmlString CheckboxListForEnum<T>(this HtmlHelper html, string id, T currentItem)
where T : struct
{
StringBuilder sb = new StringBuilder();
@ -53,7 +54,12 @@ public static IHtmlString CheckboxListForEnum<T>(this HtmlHelper html, string id
public static string GetDisplayTextForEnum(object o)
{
string result = null;
DisplayAttribute display = o.GetType().GetMember(o.ToString()).First().GetCustomAttributes(false).OfType<DisplayAttribute>().LastOrDefault();
DisplayAttribute display = o.GetType()
.GetMember(o.ToString())
.First()
.GetCustomAttributes(false)
.OfType<DisplayAttribute>()
.LastOrDefault();
if (display != null)
{

View File

@ -22,7 +22,7 @@ public static void PushNewBuild(this OneSignalClient osc, Build build, string ur
#if DEBUG
"Testers"
#else
"All"
"All"
#endif
},
Headings =

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 />

View File

@ -4,8 +4,8 @@
@{
bool isRtl = CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft;
Response.PushPromise("/res/css/default.css");
Response.PushPromise(VirtualPathUtility.ToAbsolute(((Theme)ViewBag.Theme).CssPath));
Response.PushPromise("/res/css/default.css?20170517");
Response.PushPromise(VirtualPathUtility.ToAbsolute(((Theme)ViewBag.Theme).CssPath) + "?20170517");
if (isRtl)
{
Response.PushPromise("/res/css/rtl.css");
@ -23,8 +23,8 @@
<meta name="format-detection" content="telephone=no" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>@ViewBag.Title</title>
<link href="/res/css/default.css" rel="stylesheet" type="text/css" />
<link href="@(VirtualPathUtility.ToAbsolute(((Theme)ViewBag.Theme).CssPath))" rel="stylesheet" type="text/css" />
<link href="/res/css/default.css?20170517" rel="stylesheet" type="text/css" />
<link href="@(VirtualPathUtility.ToAbsolute(((Theme)ViewBag.Theme).CssPath))?20170517" rel="stylesheet" type="text/css" />
@if (isRtl)
{
<link href="/res/css/rtl.css" rel="stylesheet" type="text/css" />

View File

@ -87,9 +87,10 @@
<dd>Fuhrer_Adolf&ensp;<a target="_blank" rel="nofollow" href="https://twitter.com/Fuhrer_Adolf"><i class="fa fa-twitter"></i></a></dd>
<dt>Vietnamese (@System.Globalization.CultureInfo.GetCultureInfo("vi").NativeName) Translation</dt>
<dd>Trần Kim Long Hải&ensp;<a target="_blank" rel="nofollow" href="https://twitter.com/trankimlonghai"><i class="fa fa-twitter"></i></a></dd>
<dt>Chinese - Simplified (@System.Globalization.CultureInfo.GetCultureInfo("zh-cn").NativeName) Translation</dt>
<dt>Chinese - Simplified (@System.Globalization.CultureInfo.GetCultureInfo("zh-hans").NativeName) Translation</dt>
<dd>Zheng He&ensp;<a target="_blank" rel="nofollow" href="http://www.betaworld.cn/"><i class="fa fa-globe"></i></a></dd>
<dt>Chinese - Traditional (@System.Globalization.CultureInfo.GetCultureInfo("zh-tw").NativeName) Translation</dt>
<dt>Chinese - Traditional (@System.Globalization.CultureInfo.GetCultureInfo("zh-hant").NativeName) Translation</dt>
<dd>Andrew Huang&ensp;<a target="_blank" rel="nofollow" href="https://twitter.com/AndrewDev8383"><i class="fa fa-twitter"></i></a>&ensp;<a target="_blank" rel="nofollow" href="http://isite.tw/"><i class="fa fa-globe"></i></a></dd>
<dd>Link Chu&ensp;<a target="_blank" rel="nofollow" href="https://twitter.com/iliGPU"><i class="fa fa-twitter"></i></a>&ensp;<a target="_blank" rel="nofollow" href="https://github.com/kulaLin"><i class="fa fa-github"></i></a></dd>
</dl>
</div>

View File

@ -1,4 +1,5 @@
@using BuildFeed.Model.View
@using BuildFeed.Controllers
@using BuildFeed.Model.View
@model BuildFeed.Model.View.SitemapData
@{
ViewBag.Title = $"{VariantTerms.Common_Sitemap} | {InvariantTerms.SiteName}";
@ -8,11 +9,11 @@
<ul>
<li>
@Html.ActionLink("BuildFeed", "index", "build")
@Html.ActionLink("BuildFeed", nameof(FrontController.Index), "Front")
<ul>
<li>
<a href="#sitemap-builds" data-toggle="collapse">Builds</a>
<ul id="sitemap-builds" class="collapse">
<a href="#sitemap-builds">Builds</a>
<ul id="sitemap-builds">
@foreach (SitemapDataBuildGroup buildGroup in Model.Builds)
{
<li>
@ -42,8 +43,8 @@
@foreach (KeyValuePair<string, SitemapPagedAction[]> item in Model.Actions)
{
<li>
<a href="#sitemap-@item.Key.ToLower()" data-toggle="collapse">@item.Key</a>
<ul id="sitemap-@item.Key.ToLower()" class="collapse">
<a href="#sitemap-@item.Key.ToLower()">@item.Key</a>
<ul id="sitemap-@item.Key.ToLower()">
@foreach (SitemapPagedAction action in item.Value)
{
if (string.IsNullOrEmpty(action.Name))
@ -59,8 +60,8 @@
else
{
<li>
<a href="#sitemap-@action.UniqueId" data-toggle="collapse">@action.Name</a>
<ul id="sitemap-@action.UniqueId" class="collapse">
<a href="#sitemap-@action.UniqueId">@action.Name</a>
<ul id="sitemap-@action.UniqueId">
<li>@Html.ActionLink("Page 1", action.Action, action.UrlParams)</li>
@for (int i = 2; i <= action.Pages; i++)
{
@ -76,8 +77,8 @@
</li>
}
<li>
<a href="#sitemap-rss" data-toggle="collapse">@VariantTerms.Common_RssFeeds</a>
<ul id="sitemap-rss" class="collapse">
<a href="#sitemap-rss">@VariantTerms.Common_RssFeeds</a>
<ul id="sitemap-rss">
<li>
<a href="@Url.Action("Index", new
{
@ -107,8 +108,8 @@
<i class="fa fa-sm fa-rss"></i> @VariantTerms.Support_HighestVersion</a>
</li>
<li>
<a href="#rss-labs" data-toggle="collapse">@VariantTerms.Model_LabString</a>
<ul id="rss-labs" class="collapse">
<a href="#rss-labs">@VariantTerms.Model_LabString</a>
<ul id="rss-labs">
@foreach (string lab in Model.Labs)
{
<li>

View File

@ -8,10 +8,6 @@
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="data:MongoDB" value="BuildFeed" />
<add key="site:OSGLab" value="rs_prerelease" />
<add key="site:InsiderLab" value="rs_prerelease" />
<add key="site:ReleaseLab" value="rs2_release;rs2_release_svc_sec;rs2_release_svc_escrow" />
<add key="site:XboxLab" value="rs2_release_xbox_1705" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.7">
@ -91,9 +87,9 @@
<add name="X-Content-Type-Options" value="nosniff" />
<add name="X-Frame-Options" value="DENY" />
<add name="X-XSS-Protection" value="1; mode=block" />
<add name="Referrer-Policy" value="strict-origin-when-cross-origin" />
</customHeaders>
</httpProtocol>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />

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,