Refresh Pt 3c

This commit is contained in:
Thomas Hounsell 2015-03-30 22:32:35 +01:00
parent 8b0c517d37
commit 161dcbaf9e
5 changed files with 43 additions and 17 deletions

View File

@ -295,6 +295,7 @@
<SubType>Designer</SubType>
</Content>
<Content Include="Views\front\index.cshtml" />
<Content Include="Views\front\viewGroup.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />

View File

@ -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;
}
}
}

View File

@ -8,18 +8,18 @@
@foreach (var group in Model)
{
<div class="col-sm-2">
<h3 class="build-group-title"><a href="#"><span class="icon"><i class="fa fa-plus-square"></i></span> @group.Key.ToString()</a></h3>
<h3 class="build-group-title"><a href="@Url.Action("viewGroup", new { major = group.Key.Major, minor = group.Key.Minor, number = group.Key.Build, revision = group.Key.Revision })"><span class="icon"><i class="fa fa-plus-square"></i></span> @group.Key.ToString()</a></h3>
<p>
@if (group.Any(k => k.BuildTime.HasValue))
{
var maxDate = group.Max(k => k.BuildTime).Value;
if (maxDate.AddDays(28) > DateTime.Now)
{
<span title="@maxDate.ToString("dd MMMM yyyy")"><i class="fa fa-calendar fa-fw"></i> @maxDate.Humanize()</span><br />
<span title="@maxDate.ToString("d MMMM yyyy")"><i class="fa fa-calendar fa-fw"></i> @maxDate.Humanize()</span><br />
}
else
{
<span title="@maxDate.Humanize()"><i class="fa fa-calendar fa-fw"></i> @maxDate.ToString("dd MMMM yyyy")</span><br />
<span title="@maxDate.Humanize()"><i class="fa fa-calendar fa-fw"></i> @maxDate.ToString("d MMMM yyyy")</span><br />
}
}
<i class="fa fa-server fa-fw"></i> @group.Count().ToString() builds

View File

@ -1,11 +1,30 @@
@model IEnumerable<BuildFeed.Models.Build>
@model IGrouping<BuildFeed.Models.BuildGroup, BuildFeed.Models.Build>
@using Humanizer;
@{
Layout = null;
ViewBag.Title = string.Format("{0} | BuildFeed", Model.Key.ToString());
}
<ul>
@foreach (var build in Model)
<h1>@Model.Key.ToString()</h1>
<div class="row">
@foreach (var build in Model.OrderBy(b => b.BuildTime))
{
<li>@build.FullBuildString</li>
<div class="col-sm-3">
<h3 class="build-group-title">@build.Lab</h3>
@if (build.BuildTime.HasValue)
{
<p>
<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>
</p>
}
<p>
<a href="#" class="btn btn-info btn-xs">Info</a>
<a href="#" class="btn btn-primary btn-xs">Edit</a>
<a href="#" class="btn btn-danger btn-xs">Delete</a>
</p>
</div>
}
</ul>
</div>

View File

@ -47,7 +47,7 @@ h1
#page-footer
{
font-size: 12px;
margin-top: 1em;
margin-top: 3em;
}
.form-horizontal .control-label