summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-04-14 14:22:51 -0400
committerMichael <[email protected]>2017-04-14 14:22:51 -0400
commit52245ffb86b6d1585c4e4c82e6bf1b3c03c8846a (patch)
treeab8d55e8f76bdfa1f34705b60286a5da1a77bcc2
parentc5506fc9f9efcf960cced980230d6c038b226f1a (diff)
downloadproject-unite-52245ffb86b6d1585c4e4c82e6bf1b3c03c8846a.tar.gz
project-unite-52245ffb86b6d1585c4e4c82e6bf1b3c03c8846a.tar.bz2
project-unite-52245ffb86b6d1585c4e4c82e6bf1b3c03c8846a.zip
Bugtracker work
-rw-r--r--Project-Unite/Controllers/BugsController.cs19
-rw-r--r--Project-Unite/Models/BugModels.cs124
-rw-r--r--Project-Unite/Models/IdentityModels.cs2
-rw-r--r--Project-Unite/Project-Unite.csproj5
-rw-r--r--Project-Unite/Views/Bugs/Index.cshtml27
-rw-r--r--Project-Unite/Views/Bugs/_BugBar.cshtml6
-rw-r--r--Project-Unite/Views/Bugs/_Sidebar.cshtml10
7 files changed, 193 insertions, 0 deletions
diff --git a/Project-Unite/Controllers/BugsController.cs b/Project-Unite/Controllers/BugsController.cs
new file mode 100644
index 0000000..5345239
--- /dev/null
+++ b/Project-Unite/Controllers/BugsController.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+using Project_Unite.Models;
+
+namespace Project_Unite.Controllers
+{
+ public class BugsController : Controller
+ {
+ // GET: Bugs
+ public ActionResult Index()
+ {
+ var db = new ApplicationDbContext();
+ return View(db.BugTags);
+ }
+ }
+} \ No newline at end of file
diff --git a/Project-Unite/Models/BugModels.cs b/Project-Unite/Models/BugModels.cs
new file mode 100644
index 0000000..d109d2a
--- /dev/null
+++ b/Project-Unite/Models/BugModels.cs
@@ -0,0 +1,124 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+
+namespace Project_Unite.Models
+{
+ public class Bug
+ {
+ public string Id { get; set; }
+ /// <summary>
+ /// Just a funny name for "what category is this bug in?"
+ /// </summary>
+ public string Species { get; set; }
+ public int Urgency { get; set; }
+ public string Name { get; set; }
+
+ public ForumPost[] Comments
+ {
+ get
+ {
+ return new ApplicationDbContext().ForumPosts.Where(x => x.Parent == this.Id).ToArray();
+ }
+ }
+
+ public DateTime ReportedAt { get; set; }
+ public string ReleaseId { get; set; }
+ public string Reporter { get; set; }
+ public bool Open { get; set; }
+ public DateTime ClosedAt { get; set; }
+ public string ClosedBy { get; set; }
+ }
+
+ public class BugTag
+ {
+ public string Id { get; set; }
+ public string Name { get; set; }
+ public string ColorHex { get; set; }
+ public string Description { get; set; }
+
+ public Bug[] Open
+ {
+ get
+ {
+ return new ApplicationDbContext().Bugs.Where(x => x.Species == this.Id && x.Open == true).ToArray();
+ }
+ }
+ }
+
+ public class PostBugViewModel
+ {
+ [Required(AllowEmptyStrings = false, ErrorMessage ="You must specify a name for your bug.")]
+ [MaxLength(75, ErrorMessage = "Your bug's name must have at most 75 characters.")]
+ public string Name { get; set; }
+
+ [Required(AllowEmptyStrings = false, ErrorMessage ="Please describe your bug.")]
+ [AllowHtml]
+ [MinLength(20, ErrorMessage = "Your bug's description must have at least 20 characters in it.")]
+ public string Description { get; set; }
+
+
+ public string SpeciesId { get; set; }
+
+ public string VersionId { get; set; }
+
+ public string Urgency { get; set; }
+
+ public List<SelectListItem> Urgencies
+ {
+ get
+ {
+ var items = new List<SelectListItem>();
+ string[] list = new[] { "Minor", "Moderate", "Major", "Critical" };
+ for (int i = 0; i < list.Length; i++)
+ {
+ items.Add(new SelectListItem
+ {
+ Text = list[i],
+ Value = i.ToString()
+ });
+ }
+ return items;
+ }
+ }
+
+ public List<SelectListItem> Species
+ {
+ get
+ {
+ var db = new ApplicationDbContext();
+ var items = new List<SelectListItem>();
+ foreach (var itm in db.BugTags.OrderBy(x => x.Name))
+ {
+ items.Add(new SelectListItem
+ {
+ Text = itm.Name,
+ Value = itm.Id
+ });
+ }
+ return items;
+ }
+ }
+
+ public List<SelectListItem> Versions
+ {
+ get
+ {
+ var db = new ApplicationDbContext();
+ var items = new List<SelectListItem>();
+ foreach(var itm in db.Downloads.OrderByDescending(x => x.PostDate))
+ {
+ items.Add(new SelectListItem
+ {
+ Text = itm.Name,
+ Value = itm.Id
+ });
+ }
+ return items;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Project-Unite/Models/IdentityModels.cs b/Project-Unite/Models/IdentityModels.cs
index 42f9e30..f864527 100644
--- a/Project-Unite/Models/IdentityModels.cs
+++ b/Project-Unite/Models/IdentityModels.cs
@@ -219,6 +219,8 @@ namespace Project_Unite.Models
return new ApplicationDbContext();
}
+ public DbSet<Bug> Bugs { get; set; }
+ public DbSet<BugTag> BugTags { get; set; }
public DbSet<BlogPost> BlogPosts { get; set; }
public DbSet<ReadPost> ReadPosts { get; set; }
public DbSet<Download> Downloads { get; set; }
diff --git a/Project-Unite/Project-Unite.csproj b/Project-Unite/Project-Unite.csproj
index cde0944..5d1c8e9 100644
--- a/Project-Unite/Project-Unite.csproj
+++ b/Project-Unite/Project-Unite.csproj
@@ -244,6 +244,7 @@
<Compile Include="Controllers\AdminController.cs" />
<Compile Include="Controllers\APIController.cs" />
<Compile Include="Controllers\BlogController.cs" />
+ <Compile Include="Controllers\BugsController.cs" />
<Compile Include="Controllers\DeveloperController.cs" />
<Compile Include="Controllers\DownloadController.cs" />
<Compile Include="Controllers\ForumController.cs" />
@@ -426,6 +427,7 @@
<Compile Include="Models\AddUserToRoleViewModel.cs" />
<Compile Include="Models\AdminViewModels.cs" />
<Compile Include="Models\BlogModels.cs" />
+ <Compile Include="Models\BugModels.cs" />
<Compile Include="Models\Download.cs" />
<Compile Include="Models\ForumCategory.cs" />
<Compile Include="Models\ForumViewModels.cs" />
@@ -559,6 +561,9 @@
<Content Include="Views\Blog\ViewBlog.cshtml" />
<Content Include="Views\Blog\Index.cshtml" />
<Content Include="Views\Blog\PostBlog.cshtml" />
+ <Content Include="Views\Bugs\Index.cshtml" />
+ <Content Include="Views\Bugs\_BugBar.cshtml" />
+ <Content Include="Views\Bugs\_Sidebar.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
diff --git a/Project-Unite/Views/Bugs/Index.cshtml b/Project-Unite/Views/Bugs/Index.cshtml
new file mode 100644
index 0000000..0e7754d
--- /dev/null
+++ b/Project-Unite/Views/Bugs/Index.cshtml
@@ -0,0 +1,27 @@
+@model IEnumerable<Project_Unite.Models.BugTag>
+@{
+ ViewBag.Title = "Bugtracker";
+}
+
+<h2>Bugtracker</h2>
+
+@{
+ Html.RenderPartial("~/Views/Bugs/_BugBar.cshtml");
+}
+
+<div class="row">
+ <div class="col-xs-3">
+@{
+ Html.RenderPartial("~/Views/Bugs/_Sidebar.cshtml", Model);
+}
+ </div>
+
+ <div class="col-xs-9">
+ <h3>Welcome to the ShiftOS bug tracker.</h3>
+
+ <p>ShiftOS is a game about an evolving operating system, and an evolving world. However, ShiftOS itself is evolving with new features everyday.</p>
+
+ <p>We at ShiftOS strive to create a stable experience and most bugs are taken care of before they ever leave the development environment. However, sometimes we make mistakes. I mean, we're all human, right? Anyways, if you find a mistake we've made in ShiftOS, this is the best spot to place it.</p>
+
+ </div>
+</div> \ No newline at end of file
diff --git a/Project-Unite/Views/Bugs/_BugBar.cshtml b/Project-Unite/Views/Bugs/_BugBar.cshtml
new file mode 100644
index 0000000..ec3d7c2
--- /dev/null
+++ b/Project-Unite/Views/Bugs/_BugBar.cshtml
@@ -0,0 +1,6 @@
+@if (Request.IsAuthenticated)
+{
+ <ul class="nav nav-pills">
+ <li><a href="@Url.Action("PostBug")"><span class="glyphicon glyphicon-plus"></span> Post a bug</a></li>
+ </ul>
+} \ No newline at end of file
diff --git a/Project-Unite/Views/Bugs/_Sidebar.cshtml b/Project-Unite/Views/Bugs/_Sidebar.cshtml
new file mode 100644
index 0000000..36db4e8
--- /dev/null
+++ b/Project-Unite/Views/Bugs/_Sidebar.cshtml
@@ -0,0 +1,10 @@
+@model IEnumerable<Project_Unite.Models.BugTag>
+
+<h3>Categories</h3>
+
+<ul>
+ @foreach (var cat in Model)
+ {
+ <li><a href="@Url.Action("ViewCategory", new { id = cat.Id })">@cat.Name (@cat.Open.Count())</a></li>
+ }
+</ul> \ No newline at end of file