diff --git a/BuildFeed.csproj b/BuildFeed.csproj index 18964b2..97a6d3c 100644 --- a/BuildFeed.csproj +++ b/BuildFeed.csproj @@ -295,6 +295,7 @@ Designer + diff --git a/Controllers/frontController.cs b/Controllers/frontController.cs index 0ffc543..0a90cd7 100644 --- a/Controllers/frontController.cs +++ b/Controllers/frontController.cs @@ -38,14 +38,20 @@ bg.Key.Revision descending public ActionResult viewGroup(byte major, byte minor, ushort number, ushort? revision = null) { var builds = from b in Build.Select() - where b.MajorVersion == major - where b.MinorVersion == minor - where b.Number == number - where b.Revision == revision - orderby b.BuildTime descending - select b; + group b by new BuildGroup() + { + Major = b.MajorVersion, + Minor = b.MinorVersion, + Build = b.Number, + Revision = b.Revision + } into bg + where bg.Key.Major == major + where bg.Key.Minor == minor + where bg.Key.Build == number + where bg.Key.Revision == revision + select bg; - return PartialView(builds); + return builds.Count() == 1 ? View(builds.Single()) as ActionResult : Redirect("~/") as ActionResult; } } } \ No newline at end of file diff --git a/Views/front/index.cshtml b/Views/front/index.cshtml index 0271712..9beab9c 100644 --- a/Views/front/index.cshtml +++ b/Views/front/index.cshtml @@ -8,18 +8,18 @@ @foreach (var group in Model) {
-

@group.Key.ToString()

+

@group.Key.ToString()

@if (group.Any(k => k.BuildTime.HasValue)) { var maxDate = group.Max(k => k.BuildTime).Value; if (maxDate.AddDays(28) > DateTime.Now) { - @maxDate.Humanize()
+ @maxDate.Humanize()
} else { - @maxDate.ToString("dd MMMM yyyy")
+ @maxDate.ToString("d MMMM yyyy")
} } @group.Count().ToString() builds diff --git a/Views/front/viewGroup.cshtml b/Views/front/viewGroup.cshtml index 9a30514..c79b5e2 100644 --- a/Views/front/viewGroup.cshtml +++ b/Views/front/viewGroup.cshtml @@ -1,11 +1,30 @@ -@model IEnumerable +@model IGrouping +@using Humanizer; @{ - Layout = null; + ViewBag.Title = string.Format("{0} | BuildFeed", Model.Key.ToString()); } -

    - @foreach (var build in Model) +

    @Model.Key.ToString()

    + +
    + @foreach (var build in Model.OrderBy(b => b.BuildTime)) { -
  • @build.FullBuildString
  • +
    +

    @build.Lab

    + @if (build.BuildTime.HasValue) + { +

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

    + } + +

    + Info + Edit + Delete +

    +
    } -
\ No newline at end of file +
+ diff --git a/content/style.css b/content/style.css index 231c07e..a22973e 100644 --- a/content/style.css +++ b/content/style.css @@ -47,7 +47,7 @@ h1 #page-footer { font-size: 12px; - margin-top: 1em; + margin-top: 3em; } .form-horizontal .control-label