diff --git a/BuildFeed.csproj b/BuildFeed.csproj index f603841..97be7bc 100644 --- a/BuildFeed.csproj +++ b/BuildFeed.csproj @@ -307,6 +307,8 @@ + + diff --git a/Controllers/buildController.cs b/Controllers/buildController.cs index a49502e..9507168 100644 --- a/Controllers/buildController.cs +++ b/Controllers/buildController.cs @@ -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 }); } } } diff --git a/Controllers/frontController.cs b/Controllers/frontController.cs index 767ee11..c1101ba 100644 --- a/Controllers/frontController.cs +++ b/Controllers/frontController.cs @@ -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() { diff --git a/Views/front/viewBuild.cshtml b/Views/front/viewBuild.cshtml index c3d2a25..927cf33 100644 --- a/Views/front/viewBuild.cshtml +++ b/Views/front/viewBuild.cshtml @@ -76,7 +76,7 @@ @@ -102,7 +102,7 @@ @Html.LabelFor(model => model.SourceType, new { @class = "control-label" })

@Html.DisplayFor(model => model.SourceType, "Enumeration")
- Find more builds sourced from @Html.DisplayFor(model => model.SourceType, "Enumeration") + Find more builds sourced from @Html.DisplayFor(model => model.SourceType, "Enumeration")

diff --git a/Views/front/viewGroup.cshtml b/Views/front/viewGroup.cshtml index 3a8ee6c..b905e99 100644 --- a/Views/front/viewGroup.cshtml +++ b/Views/front/viewGroup.cshtml @@ -17,6 +17,8 @@ @build.BuildTime.Value.ToString("d MMMM yyyy")
@build.BuildTime.Value.ToString("h:mm tt")
} +

+

@if (build.IsLeaked) { Leaked @@ -29,7 +31,7 @@

Info Edit - Delete + Delete

} diff --git a/Views/front/viewLab.cshtml b/Views/front/viewLab.cshtml new file mode 100644 index 0000000..1df324e --- /dev/null +++ b/Views/front/viewLab.cshtml @@ -0,0 +1,63 @@ +@model IEnumerable +@using Humanizer; +@{ + ViewBag.Title = string.Format("Builds from {0} | BuildFeed", ViewBag.ItemId); +} + +@section head +{ + @if (ViewBag.MetaItem != null) + { + + + } + else + { + + + } +} + +

@string.Format("Builds from {0}", ViewBag.ItemId)

+@if (ViewBag.MetaItem != null && !string.IsNullOrWhiteSpace(ViewBag.MetaItem.PageContent)) +{ +

About

+ @Html.Raw(ViewBag.MetaItem.PageContent) +} +

Share

+
+

Listing

+
+ @foreach (var build in Model) + { +
+

@string.Format("{0}.{1}.{2}.{3}", build.MajorVersion, build.MinorVersion, build.Number, build.Revision)

+

+ @if (build.BuildTime.HasValue) + { + @build.BuildTime.Value.ToString("d MMMM yyyy")
+ @build.BuildTime.Value.ToString("h:mm tt")
+ } +

+

+ @if (build.IsLeaked) + { + Leaked + } + else + { + Unleaked + } +

+

+ Info + Edit + Delete +

+
+ } +
+@section scripts +{ + +} \ No newline at end of file diff --git a/Views/front/viewSource.cshtml b/Views/front/viewSource.cshtml new file mode 100644 index 0000000..b81ea97 --- /dev/null +++ b/Views/front/viewSource.cshtml @@ -0,0 +1,62 @@ +@model IEnumerable +@using Humanizer; +@{ + ViewBag.Title = string.Format("{0} | BuildFeed", ViewBag.ItemId); +} + +@section head +{ + @if (ViewBag.MetaItem != null) + { + + + } +} + +

@ViewBag.ItemId

+@if (ViewBag.MetaItem != null && !string.IsNullOrWhiteSpace(ViewBag.MetaItem.PageContent)) +{ +

About

+ @Html.Raw(ViewBag.MetaItem.PageContent) +} +

Share

+
+

Listing

+
+ @foreach (var build in Model) + { +
+

@string.Format("{0}.{1}.{2}.{3}", build.MajorVersion, build.MinorVersion, build.Number, build.Revision)

+

+ @if (!string.IsNullOrEmpty(build.Lab)) + { + @build.Lab
+ } + @if (build.BuildTime.HasValue) + { + @build.BuildTime.Value.ToString("d MMMM yyyy")
+ @build.BuildTime.Value.ToString("h:mm tt")
+ } +

+

+ @if (build.IsLeaked) + { + Leaked + } + else + { + Unleaked + } +

+

+ Info + Edit + Delete +

+
+ } +
+@section scripts +{ + +} \ No newline at end of file diff --git a/Views/shared/DisplayTemplates/Enumeration.cshtml b/Views/shared/DisplayTemplates/Enumeration.cshtml index e52d573..e6cf9d2 100644 --- a/Views/shared/DisplayTemplates/Enumeration.cshtml +++ b/Views/shared/DisplayTemplates/Enumeration.cshtml @@ -2,4 +2,4 @@ @model Enum -@DisplayHelpers.GetDisplayTextForEnum(ViewData.Model) +@DisplayHelpers.GetDisplayTextForEnum(ViewData.Model) \ No newline at end of file diff --git a/Views/support/sitemap.cshtml b/Views/support/sitemap.cshtml index 090521b..1c86bdd 100644 --- a/Views/support/sitemap.cshtml +++ b/Views/support/sitemap.cshtml @@ -14,7 +14,7 @@
    @foreach (var build in Model.Builds) { -
  • @Html.ActionLink(build.Name, "info", new { controller = "build", id = build.Id })
  • +
  • @Html.ActionLink(build.Name, "viewBuild", new { controller = "front", id = build.Id })
  • }
diff --git a/Views/support/stats.cshtml b/Views/support/stats.cshtml index 7298780..159c2a5 100644 --- a/Views/support/stats.cshtml +++ b/Views/support/stats.cshtml @@ -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",