diff options
| -rw-r--r-- | Project-Unite/Controllers/BugsController.cs | 9 | ||||
| -rw-r--r-- | Project-Unite/Models/BugModels.cs | 8 | ||||
| -rw-r--r-- | Project-Unite/Project-Unite.csproj | 1 | ||||
| -rw-r--r-- | Project-Unite/Views/Bugs/ViewCategory.cshtml | 110 |
4 files changed, 128 insertions, 0 deletions
diff --git a/Project-Unite/Controllers/BugsController.cs b/Project-Unite/Controllers/BugsController.cs index 5345239..34de971 100644 --- a/Project-Unite/Controllers/BugsController.cs +++ b/Project-Unite/Controllers/BugsController.cs @@ -15,5 +15,14 @@ namespace Project_Unite.Controllers 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); + } } }
\ No newline at end of file diff --git a/Project-Unite/Models/BugModels.cs b/Project-Unite/Models/BugModels.cs index d109d2a..9a6b0ad 100644 --- a/Project-Unite/Models/BugModels.cs +++ b/Project-Unite/Models/BugModels.cs @@ -47,6 +47,14 @@ namespace Project_Unite.Models 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 diff --git a/Project-Unite/Project-Unite.csproj b/Project-Unite/Project-Unite.csproj index 5d1c8e9..4d72118 100644 --- a/Project-Unite/Project-Unite.csproj +++ b/Project-Unite/Project-Unite.csproj @@ -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\" /> diff --git a/Project-Unite/Views/Bugs/ViewCategory.cshtml b/Project-Unite/Views/Bugs/ViewCategory.cshtml new file mode 100644 index 0000000..0584bbc --- /dev/null +++ b/Project-Unite/Views/Bugs/ViewCategory.cshtml @@ -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 • + + @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 • + + @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; + } + • + + 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>
\ No newline at end of file |
