Add Bug List

This commit is contained in:
Michael 2017-04-14 14:44:08 -04:00
parent 52245ffb86
commit dc233f9db9
4 changed files with 128 additions and 0 deletions

View file

@ -15,5 +15,14 @@ public ActionResult Index()
var db = new ApplicationDbContext();
return View(db.BugTags);
}
public ActionResult ViewCategory(string id)
{
var db = new ApplicationDbContext();
var cat = db.BugTags.FirstOrDefault(x => x.Id == id);
if (cat == null)
return new HttpStatusCodeResult(404);
return View(cat);
}
}
}

View file

@ -47,6 +47,14 @@ public Bug[] Open
return new ApplicationDbContext().Bugs.Where(x => x.Species == this.Id && x.Open == true).ToArray();
}
}
public Bug[] Closed
{
get
{
return new ApplicationDbContext().Bugs.Where(x => x.Species == this.Id && x.Open == false).ToArray();
}
}
}
public class PostBugViewModel

View file

@ -564,6 +564,7 @@
<Content Include="Views\Bugs\Index.cshtml" />
<Content Include="Views\Bugs\_BugBar.cshtml" />
<Content Include="Views\Bugs\_Sidebar.cshtml" />
<Content Include="Views\Bugs\ViewCategory.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />

View file

@ -0,0 +1,110 @@
@model Project_Unite.Models.BugTag
@{
ViewBag.Title = "Bugtracker";
var tags = new Project_Unite.Models.ApplicationDbContext().BugTags;
}
<h2>Bugtracker</h2>
@{
Html.RenderPartial("~/Views/Bugs/_BugBar.cshtml");
}
<div class="row">
<div class="col-xs-3">
@{
Html.RenderPartial("~/Views/Bugs/_Sidebar.cshtml", tags);
}
</div>
<div class="col-xs-9">
<h3>@Model.Name</h3>
<p>@Model.Description</p>
<p><strong>@Model.Open.Length</strong> open, <strong>@Model.Closed.Length</strong> closed.</p>
@*Open bugs.*@
<table class="table">
<tr>
<th style="width:65%;">Open</th>
<th>Actions</th>
</tr>
@foreach(var open in Model.Open.OrderByDescending(x => x.Urgency))
{
<tr>
<td>
@Html.ActionLink(open.Name, "ViewBug", new { id = open.Id })<br/>
<p>Opened by @Html.UserLink(open.Reporter) at @open.ReportedAt &bull;
@switch (open.Urgency)
{
case 0:
<strong>Minor</strong>
break;
case 1:
<strong>Moderate</strong>
break;
case 2:
<strong>Major</strong>
break;
case 3:
<strong>Critical</strong>
break;
default:
<strong>A bug occurred in the bug reporter and thus an urgency couldn't be decided.</strong>
break;
}
</p>
</td>
<td><a href="@Url.Action("CloseBug", new { id = open.Id })" class="btn btn-default"><span class="glyphicon glyphicon-check"></span> Close Bug</a></td>
</tr>
}
</table>
<hr/>
<table class="table">
<tr>
<th style="width:65%;">Closed</th>
<th>Actions</th>
</tr>
@foreach (var open in Model.Closed.OrderByDescending(x => x.Urgency))
{
<tr class="disabled">
<td>
@Html.ActionLink(open.Name, "ViewBug", new { id = open.Id })<br />
<p>
Opened by @Html.UserLink(open.Reporter) at @open.ReportedAt &bull;
@switch (open.Urgency)
{
case 0:
<strong>Minor</strong>
break;
case 1:
<strong>Moderate</strong>
break;
case 2:
<strong>Major</strong>
break;
case 3:
<strong>Critical</strong>
break;
default:
<strong>A bug occurred in the bug reporter and thus an urgency couldn't be decided.</strong>
break;
}
&bull;
Closed by @Html.UserLink(open.ClosedBy) at @open.ClosedAt
</p>
</td>
<td><a href="@Url.Action("OpenBug", new { id = open.Id })" class="btn btn-default"><span class="glyphicon glyphicon-unchecked"></span> Reopen Bug</a></td>
</tr>
}
</table>
</div>
</div>