Refresh Pt 5c

This commit is contained in:
Thomas Hounsell 2015-05-04 12:16:36 +01:00
parent f4cd963a0f
commit 2650353aba
10 changed files with 165 additions and 18 deletions

View File

@ -307,6 +307,8 @@
<Content Include="Views\front\index.cshtml" />
<Content Include="Views\front\viewGroup.cshtml" />
<Content Include="Views\front\viewBuild.cshtml" />
<Content Include="Views\front\viewLab.cshtml" />
<Content Include="Views\front\viewSource.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />

View File

@ -13,7 +13,7 @@ public class buildController : Controller
public ActionResult index(int page = 1)
{
return RedirectToAction("index", "front");
return RedirectToActionPermanent("index", "front");
}
public ActionResult year(int year, int page = 1)
@ -29,15 +29,7 @@ public ActionResult year(int year, int page = 1)
public ActionResult lab(string lab, int page = 1)
{
var builds = Build.SelectInBuildOrder().Where(b => b.Lab != null && (b.Lab.ToLower() == lab.ToLower()));
var pageBuilds = builds.Skip((page - 1) * pageSize).Take(pageSize);
ViewBag.PageNumber = page;
ViewBag.PageCount = Math.Ceiling(Convert.ToDouble(builds.Count()) / Convert.ToDouble(pageSize));
ViewBag.MetaItem = MetaItem.SelectById(new MetaItemKey() { Type = MetaType.Lab, Value = lab });
return View("index", pageBuilds);
return RedirectToActionPermanent("viewLab", "front", new { lab = lab });
}
public ActionResult version(int major, int minor, int page = 1)
@ -67,7 +59,7 @@ public ActionResult source(TypeOfSource source, int page = 1)
public ActionResult info(int id)
{
return RedirectToAction("viewBuild", "front", new { id = id });
return RedirectToActionPermanent("viewBuild", "front", new { id = id });
}
}
}

View File

@ -69,6 +69,32 @@ public ActionResult viewBuild(long id)
return View(b);
}
[Route("lab/{lab}/")]
#if !DEBUG
[OutputCache(Duration = 600, VaryByParam = "none")]
#endif
public ActionResult viewLab(string lab)
{
ViewBag.MetaItem = MetaItem.SelectById(new MetaItemKey() { Type = MetaType.Lab, Value = lab });
ViewBag.ItemId = lab;
var builds = Build.SelectInBuildOrder().Where(b => b.Lab != null && (b.Lab.ToLower() == lab.ToLower()));
return View(builds);
}
[Route("source/{source}/")]
#if !DEBUG
[OutputCache(Duration = 600, VaryByParam = "none")]
#endif
public ActionResult viewSource(TypeOfSource source)
{
ViewBag.MetaItem = MetaItem.SelectById(new MetaItemKey() { Type = MetaType.Source, Value = source.ToString() });
ViewBag.ItemId = DisplayHelpers.GetDisplayTextForEnum(source);
var builds = Build.SelectInBuildOrder().Where(b => b.SourceType == source);
return View(builds);
}
[Route("add/"), Authorize]
public ActionResult addBuild()
{

View File

@ -76,7 +76,7 @@
<div class="col-sm-8">
<p class="form-control-static">
@Model.Lab<br />
<a href="@Url.Action("lab", new { lab = Model.Lab })" class="more-link"><i class="fa fa-plus-square-o fa-sm"></i> Find more builds from @Model.Lab</a>
<a href="@Url.Action("viewLab", new { lab = Model.Lab })" class="more-link"><i class="fa fa-plus-square-o fa-sm"></i> Find more builds from @Model.Lab</a>
</p>
</div>
</div>
@ -102,7 +102,7 @@
@Html.LabelFor(model => model.SourceType, new { @class = "control-label" })
<p class="form-control-static">
@Html.DisplayFor(model => model.SourceType, "Enumeration")<br />
<a href="@Url.Action("source", new { source = Model.SourceType })" class="more-link"><i class="fa fa-plus-square-o fa-sm"></i> Find more builds sourced from @Html.DisplayFor(model => model.SourceType, "Enumeration")</a>
<a href="@Url.Action("viewSource", new { source = Model.SourceType })" class="more-link"><i class="fa fa-plus-square-o fa-sm"></i> Find more builds sourced from @Html.DisplayFor(model => model.SourceType, "Enumeration")</a>
</p>
</div>

View File

@ -17,6 +17,8 @@
<span title="@build.BuildTime.Value.Humanize()"><i class="fa fa-calendar fa-fw"></i> @build.BuildTime.Value.ToString("d MMMM yyyy")</span><br />
<span title="@build.BuildTime.Value.Humanize()"><i class="fa fa-clock-o fa-fw"></i> @build.BuildTime.Value.ToString("h:mm tt")</span><br />
}
</p>
<p>
@if (build.IsLeaked)
{
<span class="label label-success label-build-status">Leaked</span>
@ -29,7 +31,7 @@
<p>
<a href="@Url.Action("viewBuild", new { id = build.Id })" class="btn btn-info btn-xs">Info</a>
<a href="@Url.Action("editBuild", new { id = build.Id })" class="btn btn-primary btn-xs">Edit</a>
<a href="#" class="btn btn-danger btn-xs">Delete</a>
<a href="@Url.Action("deleteBuild", new { id = build.Id })" class="btn btn-danger btn-xs">Delete</a>
</p>
</div>
}

View File

@ -0,0 +1,63 @@
@model IEnumerable<BuildFeed.Models.Build>
@using Humanizer;
@{
ViewBag.Title = string.Format("Builds from {0} | BuildFeed", ViewBag.ItemId);
}
@section head
{
@if (ViewBag.MetaItem != null)
{
<meta name="description" content="@ViewBag.MetaItem.MetaDescription" />
<meta property="og:description" content="@ViewBag.MetaItem.MetaDescription" />
}
else
{
<meta name="description" content="Check out all the known builds to come out of the Windows development lab @ViewBag.ItemId through BuildFeed, a collaborative Windows build list" />
<meta property="og:description" content="Check out all the known builds to come out of the Windows development lab @ViewBag.ItemId through BuildFeed, a collaborative Windows build list" />
}
}
<h2>@string.Format("Builds from {0}", ViewBag.ItemId)</h2>
@if (ViewBag.MetaItem != null && !string.IsNullOrWhiteSpace(ViewBag.MetaItem.PageContent))
{
<h3>About</h3>
@Html.Raw(ViewBag.MetaItem.PageContent)
}
<h3>Share</h3>
<div class="addthis_sharing_toolbox"></div>
<h3>Listing</h3>
<div class="row">
@foreach (var build in Model)
{
<div class="col-sm-3">
<h3 class="build-group-title">@string.Format("{0}.{1}.{2}.{3}", build.MajorVersion, build.MinorVersion, build.Number, build.Revision)</h3>
<p>
@if (build.BuildTime.HasValue)
{
<span title="@build.BuildTime.Value.Humanize()"><i class="fa fa-calendar fa-fw"></i> @build.BuildTime.Value.ToString("d MMMM yyyy")</span><br />
<span title="@build.BuildTime.Value.Humanize()"><i class="fa fa-clock-o fa-fw"></i> @build.BuildTime.Value.ToString("h:mm tt")</span><br />
}
</p>
<p>
@if (build.IsLeaked)
{
<span class="label label-success label-build-status">Leaked</span>
}
else
{
<span class="label label-danger label-build-status">Unleaked</span>
}
</p>
<p>
<a href="@Url.Action("viewBuild", new { id = build.Id })" class="btn btn-info btn-xs">Info</a>
<a href="@Url.Action("editBuild", new { id = build.Id })" class="btn btn-primary btn-xs">Edit</a>
<a href="@Url.Action("deleteBuild", new { id = build.Id })" class="btn btn-danger btn-xs">Delete</a>
</p>
</div>
}
</div>
@section scripts
{
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5431719a661cbfd0" async="async"></script>
}

View File

@ -0,0 +1,62 @@
@model IEnumerable<BuildFeed.Models.Build>
@using Humanizer;
@{
ViewBag.Title = string.Format("{0} | BuildFeed", ViewBag.ItemId);
}
@section head
{
@if (ViewBag.MetaItem != null)
{
<meta name="description" content="@ViewBag.MetaItem.MetaDescription" />
<meta property="og:description" content="@ViewBag.MetaItem.MetaDescription" />
}
}
<h2>@ViewBag.ItemId</h2>
@if (ViewBag.MetaItem != null && !string.IsNullOrWhiteSpace(ViewBag.MetaItem.PageContent))
{
<h3>About</h3>
@Html.Raw(ViewBag.MetaItem.PageContent)
}
<h3>Share</h3>
<div class="addthis_sharing_toolbox"></div>
<h3>Listing</h3>
<div class="row">
@foreach (var build in Model)
{
<div class="col-sm-3">
<h3 class="build-group-title">@string.Format("{0}.{1}.{2}.{3}", build.MajorVersion, build.MinorVersion, build.Number, build.Revision)</h3>
<p>
@if (!string.IsNullOrEmpty(build.Lab))
{
<span><i class="fa fa-code-fork fa-fw"></i> @build.Lab</span><br />
}
@if (build.BuildTime.HasValue)
{
<span title="@build.BuildTime.Value.Humanize()"><i class="fa fa-calendar fa-fw"></i> @build.BuildTime.Value.ToString("d MMMM yyyy")</span><br />
<span title="@build.BuildTime.Value.Humanize()"><i class="fa fa-clock-o fa-fw"></i> @build.BuildTime.Value.ToString("h:mm tt")</span><br />
}
</p>
<p>
@if (build.IsLeaked)
{
<span class="label label-success label-build-status">Leaked</span>
}
else
{
<span class="label label-danger label-build-status">Unleaked</span>
}
</p>
<p>
<a href="@Url.Action("viewBuild", new { id = build.Id })" class="btn btn-info btn-xs">Info</a>
<a href="@Url.Action("editBuild", new { id = build.Id })" class="btn btn-primary btn-xs">Edit</a>
<a href="@Url.Action("deleteBuild", new { id = build.Id })" class="btn btn-danger btn-xs">Delete</a>
</p>
</div>
}
</div>
@section scripts
{
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5431719a661cbfd0" async="async"></script>
}

View File

@ -2,4 +2,4 @@
@model Enum
@DisplayHelpers.GetDisplayTextForEnum(ViewData.Model)
@DisplayHelpers.GetDisplayTextForEnum(ViewData.Model)

View File

@ -14,7 +14,7 @@
<ul id="sitemap-builds" class="collapse">
@foreach (var build in Model.Builds)
{
<li>@Html.ActionLink(build.Name, "info", new { controller = "build", id = build.Id })</li>
<li>@Html.ActionLink(build.Name, "viewBuild", new { controller = "front", id = build.Id })</li>
}
</ul>
</li>

View File

@ -29,7 +29,7 @@
Chart.defaults.Line.scaleShowGridLines = false;
var additionData = {
labels: [ @Html.Raw(string.Join(", ", Model.AdditionsByMonth.Select(m => m.Month % 4 != 1 ? "\"\"" : string.Format("\"Week {0}, {1}\"", m.Month, m.Year)).ToArray())) ],
labels: [ @Html.Raw(string.Join(", ", Model.AdditionsByMonth.Select(m => m.Month % 4 != 1 ? "\"\"" : string.Format("\"Week {0}, {1}\"", m.Month, m.Year)).ToArray()))],
datasets: [
{
label: "Additions to BuildFeed",
@ -46,7 +46,7 @@
var compiledData = {
labels: [ @Html.Raw(string.Join(", ", Model.CompilesByMonth.Select(m => string.Format("\"{0} {1}\"", System.Globalization.DateTimeFormatInfo.InvariantInfo.GetMonthName(m.Month), m.Year)).ToArray())) ],
labels: [ @Html.Raw(string.Join(", ", Model.CompilesByMonth.Select(m => string.Format("\"{0} {1}\"", System.Globalization.DateTimeFormatInfo.InvariantInfo.GetMonthName(m.Month), m.Year)).ToArray()))],
datasets: [
{
label: "Builds compiled",