summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Project-Unite/Controllers/DeveloperController.cs19
-rw-r--r--Project-Unite/Models/WikiModels.cs22
-rw-r--r--Project-Unite/Project-Unite.csproj1
-rw-r--r--Project-Unite/Views/Developer/Wiki.cshtml34
4 files changed, 76 insertions, 0 deletions
diff --git a/Project-Unite/Controllers/DeveloperController.cs b/Project-Unite/Controllers/DeveloperController.cs
index 62be944..9e3d6c0 100644
--- a/Project-Unite/Controllers/DeveloperController.cs
+++ b/Project-Unite/Controllers/DeveloperController.cs
@@ -15,18 +15,24 @@ namespace Project_Unite.Controllers
// GET: Developer
public ActionResult Index()
{
+ if (!ACL.Granted(User.Identity.Name, "CanAccessDevCP"))
+ return new HttpStatusCodeResult(403);
ViewBag.Developer = true;
return View();
}
public ActionResult Releases()
{
+ if (!ACL.Granted(User.Identity.Name, "CanAccessDevCP"))
+ return new HttpStatusCodeResult(403);
var db = new ApplicationDbContext();
return View(db.Downloads);
}
public ActionResult AddRelease()
{
+ if (!ACL.Granted(User.Identity.Name, "CanAccessDevCP"))
+ return new HttpStatusCodeResult(403);
if (!ACL.Granted(User.Identity.Name, "CanReleaseBuild"))
return new HttpStatusCodeResult(403);
ViewBag.Developer = true;
@@ -41,6 +47,8 @@ namespace Project_Unite.Controllers
[ValidateAntiForgeryToken]
public ActionResult AddRelease(PostDownloadViewModel model)
{
+ if (!ACL.Granted(User.Identity.Name, "CanAccessDevCP"))
+ return new HttpStatusCodeResult(403);
if (!ACL.Granted(User.Identity.Name, "CanReleaseBuild"))
return new HttpStatusCodeResult(403);
if (!ModelState.IsValid)
@@ -121,6 +129,17 @@ namespace Project_Unite.Controllers
return RedirectToAction("Releases");
}
+
+ [Authorize]
+ public ActionResult Wiki()
+ {
+ if (!ACL.Granted(User.Identity.Name, "CanAccessDevCP"))
+ return new HttpStatusCodeResult(403);
+ ViewBag.Developer = true;
+ var db = new ApplicationDbContext();
+ var cats = db.WikiCategories;
+ return View(cats);
+ }
}
diff --git a/Project-Unite/Models/WikiModels.cs b/Project-Unite/Models/WikiModels.cs
index ac6c6cb..dffed26 100644
--- a/Project-Unite/Models/WikiModels.cs
+++ b/Project-Unite/Models/WikiModels.cs
@@ -1,10 +1,32 @@
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 AddWikiCategoryViewModel
+ {
+ public AddWikiCategoryViewModel()
+ {
+
+ }
+
+ public List<SelectListItem> Parents { get; set; }
+
+
+ [Required(AllowEmptyStrings = false, ErrorMessage ="Please name your category.")]
+ [MinLength(5, ErrorMessage ="Your category's name must be at least 5 characters long.")]
+ [MaxLength(25, ErrorMessage ="Your category's name must be at most 25 characters long.")]
+ public string Name { get; set; }
+
+
+ [Required(AllowEmptyStrings = false, ErrorMessage = "Please select a parent category.")]
+ public string ParentId { get; set; }
+ }
+
public class WikiCategory
{
public string Id { get; set; }
diff --git a/Project-Unite/Project-Unite.csproj b/Project-Unite/Project-Unite.csproj
index d94fc9c..33cb81c 100644
--- a/Project-Unite/Project-Unite.csproj
+++ b/Project-Unite/Project-Unite.csproj
@@ -543,6 +543,7 @@
<Content Include="Views\Developer\AddRelease.cshtml" />
<Content Include="Views\Download\ViewRelease.cshtml" />
<Content Include="Views\Home\Discord.cshtml" />
+ <Content Include="Views\Developer\Wiki.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
diff --git a/Project-Unite/Views/Developer/Wiki.cshtml b/Project-Unite/Views/Developer/Wiki.cshtml
new file mode 100644
index 0000000..f83d9c5
--- /dev/null
+++ b/Project-Unite/Views/Developer/Wiki.cshtml
@@ -0,0 +1,34 @@
+@model IEnumerable<Project_Unite.Models.WikiCategory>
+@{
+ ViewBag.Title = "Wiki";
+}
+
+<h2>Wiki</h2>
+
+<p>The ShiftOS Wiki can be used to hold everything from coding guides to character details and everything in between.</p>
+
+<p>Here you can manage categories.</p>
+
+<ul class="nav nav-tabs">
+ <li><a href="@Url.Action("AddWikiCategory", "Developer")"><span class="glyphicon glyphicon-plus"></span> Add new category</a></li>
+</ul>
+
+<table class="table">
+ <tr>
+ <th style="width:45%">Category</th>
+ <th style="width:5%">Pages</th>
+ <th>Actions</th>
+ </tr>
+ @foreach(var wiki in Model)
+ {
+ <tr>
+ <th>@wiki.Name</th>
+ <th>@wiki.Pages.Count()</th>
+ <th>
+ <a href="@Url.Action("EditWikiCategory", "Developer", new { id = wiki.Id })" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span> Edit</a>
+ <a href="@Url.Action("DeleteWikiCategory", "Developer", new { id = wiki.Id })" class="btn btn-default"><span class="glyphicon glyphicon-trash"></span> Delete</a>
+
+ </th>
+ </tr>
+ }
+</table> \ No newline at end of file