mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-01-23 01:32:16 +00:00
Add wiki list to dev CP
This commit is contained in:
parent
e6aa1c4fd5
commit
f7756ab7cc
4 changed files with 76 additions and 0 deletions
|
@ -15,18 +15,24 @@ public class DeveloperController : Controller
|
|||
// 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 @@ public ActionResult AddRelease()
|
|||
[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 @@ public ActionResult AddRelease(PostDownloadViewModel model)
|
|||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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\" />
|
||||
|
|
34
Project-Unite/Views/Developer/Wiki.cshtml
Normal file
34
Project-Unite/Views/Developer/Wiki.cshtml
Normal file
|
@ -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>
|
Loading…
Reference in a new issue