Add wiki category view

This commit is contained in:
Michael 2017-04-06 13:56:05 -04:00
parent 687d62912c
commit 34d659efbc
3 changed files with 40 additions and 1 deletions

View file

@ -146,6 +146,8 @@ public ActionResult AddWikiCategory()
if (!ACL.Granted(User.Identity.Name, "CanAccessDevCP")) if (!ACL.Granted(User.Identity.Name, "CanAccessDevCP"))
return new HttpStatusCodeResult(403); return new HttpStatusCodeResult(403);
ViewBag.Developer = true;
var mdl = new AddWikiCategoryViewModel(); var mdl = new AddWikiCategoryViewModel();
return View(mdl); return View(mdl);
@ -157,7 +159,7 @@ public ActionResult AddWikiCategory(AddWikiCategoryViewModel model)
{ {
if (!ACL.Granted(User.Identity.Name, "CanAccessDevCP")) if (!ACL.Granted(User.Identity.Name, "CanAccessDevCP"))
return new HttpStatusCodeResult(403); return new HttpStatusCodeResult(403);
ViewBag.Developer = true;
if (!ModelState.IsValid) if (!ModelState.IsValid)
return View(model); return View(model);

View file

@ -544,6 +544,7 @@
<Content Include="Views\Download\ViewRelease.cshtml" /> <Content Include="Views\Download\ViewRelease.cshtml" />
<Content Include="Views\Home\Discord.cshtml" /> <Content Include="Views\Home\Discord.cshtml" />
<Content Include="Views\Developer\Wiki.cshtml" /> <Content Include="Views\Developer\Wiki.cshtml" />
<Content Include="Views\Developer\AddWikiCategory.cshtml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="App_Data\" /> <Folder Include="App_Data\" />

View file

@ -0,0 +1,36 @@
@model Project_Unite.Models.AddWikiCategoryViewModel
@{
ViewBag.Title = "Add wiki category";
}
<h2>Add wiki category</h2>
<p>Please fill the form to add a new category.</p>
@using (Html.BeginForm())
{
<div class="panel panel-danger">
<div class="panel-body">
@Html.ValidationSummary()
</div>
</div>
<table class="table">
<tr>
<td>Category name:</td>
<td>
@Html.TextBoxFor(Model=>Model.Name, new { @class="form-control"})
</td>
</tr>
<tr>
<td>Parent category:</td>
<td>
@Html.DropDownListFor(Model => Model.ParentId, Model.Parents, new { @class = "form-control" })
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Add!" /></td>
</tr>
</table>
}