Admin Users page prettified. Added Flight Levels.

This commit is contained in:
Thomas Hounsell 2014-10-20 14:09:42 +01:00
parent 51b17f6b57
commit 3f92d62b8f
8 changed files with 665 additions and 4 deletions

2
.gitignore vendored
View File

@ -14,7 +14,7 @@
[Dd]ebugPublic/ [Dd]ebugPublic/
[Rr]elease/ [Rr]elease/
x64/ x64/
build/ #build/
bld/ bld/
[Bb]in/ [Bb]in/
[Oo]bj/ [Oo]bj/

View File

@ -14,7 +14,7 @@ public class usersController : Controller
// GET: admin/users // GET: admin/users
public ActionResult Index() public ActionResult Index()
{ {
return View(Membership.GetAllUsers().Cast<MembershipUser>().OrderBy(m => m.UserName)); return View(Membership.GetAllUsers().Cast<MembershipUser>().OrderBy(m => m.IsApproved).ThenBy(m => m.UserName));
} }
public ActionResult Approve(Guid id) public ActionResult Approve(Guid id)

View File

@ -14,7 +14,7 @@
<th> <th>
Email Address Email Address
</th> </th>
<th></th> <th style="width:108px;"></th>
</tr> </tr>
@foreach (MembershipUser mu in Model) @foreach (MembershipUser mu in Model)

View File

@ -77,6 +77,10 @@ public class Build : IHasId<long>
[DisplayName("WinWorldPC Library")] [DisplayName("WinWorldPC Library")]
public Uri WinWorldPCUri { get; set; } public Uri WinWorldPCUri { get; set; }
[DisplayName("Flight Level")]
[EnumDataType(typeof(LevelOfFlight))]
public LevelOfFlight FlightLevel { get; set; }
public string FullBuildString public string FullBuildString
{ {
get get
@ -257,6 +261,14 @@ public enum TypeOfSource
PrivateLeak PrivateLeak
} }
public enum LevelOfFlight
{
None = 0,
Low = 1,
Medium = 2,
High = 3
}
public struct BuildVersion public struct BuildVersion
{ {
public byte Major { get; set; } public byte Major { get; set; }

244
Views/build/create.cshtml Normal file
View File

@ -0,0 +1,244 @@
@model BuildFeed.Models.Build
@{
ViewBag.Title = "Add a Build | BuildFeed";
Html.EnableClientValidation();
Html.EnableUnobtrusiveJavaScript();
}
<h2>Add a Build</h2>
<div class="form-horizontal">
<div class="form-group">
<label for="quickpaste" class="control-label col-sm-2">Quick-paste</label>
<div class="col-sm-10">
<div class="row">
<div class="col-sm-6">
<input id="quickpaste" type="text" class="form-control" />
</div>
</div>
</div>
</div>
</div>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
@Html.ValidationSummary(true)
<div class="form-group">
@Html.LabelFor(model => model.MajorVersion, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<div class="row">
<div class="col-sm-2">
@Html.TextBoxFor(model => model.MajorVersion, new { @class = "form-control" })
</div>
</div>
@Html.ValidationMessageFor(model => model.MajorVersion)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.MinorVersion, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<div class="row">
<div class="col-sm-2">
@Html.TextBoxFor(model => model.MinorVersion, new { @class = "form-control" })
</div>
</div>
@Html.ValidationMessageFor(model => model.MinorVersion)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Number, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<div class="row">
<div class="col-sm-3">
@Html.TextBoxFor(model => model.Number, new { @class = "form-control" })
</div>
</div>
@Html.ValidationMessageFor(model => model.Number)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Revision, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<div class="row">
<div class="col-sm-3">
@Html.TextBoxFor(model => model.Revision, new { @class = "form-control" })
</div>
</div>
@Html.ValidationMessageFor(model => model.Revision)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Lab, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<div class="row">
<div class="col-sm-6">
@Html.TextBoxFor(model => model.Lab, new { @class = "form-control" })
</div>
</div>
@Html.ValidationMessageFor(model => model.Lab)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.BuildTime, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<div class="row">
<div class="col-sm-6">
@Html.TextBoxFor(model => model.BuildTime, "{0:yyMMdd-HHmm}", new { @class = "form-control" })
</div>
</div>
@Html.ValidationMessageFor(model => model.BuildTime)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.SourceType, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<div class="row">
<div class="col-sm-6">
@Html.EditorFor(model => model.SourceType, "Enumeration")
</div>
</div>
@Html.ValidationMessageFor(model => model.SourceType)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.SourceDetails, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<div class="row">
<div class="col-sm-6">
@Html.TextAreaFor(model => model.SourceDetails, new { @class = "form-control", rows = "5" })
</div>
</div>
@Html.ValidationMessageFor(model => model.SourceDetails)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.FlightLevel, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<div class="row">
<div class="col-sm-6">
@Html.EditorFor(model => model.FlightLevel, "Enumeration")
</div>
</div>
@Html.ValidationMessageFor(model => model.FlightLevel)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.BetaWikiUri, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<div class="row">
<div class="col-sm-6">
@Html.TextBoxFor(model => model.BetaWikiUri, new { @class = "form-control" })
</div>
</div>
@Html.ValidationMessageFor(model => model.BetaWikiUri)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.BetaWikiServerUri, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<div class="row">
<div class="col-sm-6">
@Html.TextBoxFor(model => model.BetaWikiServerUri, new { @class = "form-control" })
</div>
</div>
@Html.ValidationMessageFor(model => model.BetaWikiServerUri)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.WinWorldPCUri, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<div class="row">
<div class="col-sm-6">
@Html.TextBoxFor(model => model.WinWorldPCUri, new { @class = "form-control" })
</div>
</div>
@Html.ValidationMessageFor(model => model.WinWorldPCUri)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.BetaArchiveUri, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<div class="row">
<div class="col-sm-6">
@Html.TextBoxFor(model => model.BetaArchiveUri, new { @class = "form-control" })
</div>
</div>
@Html.ValidationMessageFor(model => model.BetaArchiveUri)
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.LonghornMsUri, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<div class="row">
<div class="col-sm-6">
@Html.TextBoxFor(model => model.LonghornMsUri, new { @class = "form-control" })
</div>
</div>
@Html.ValidationMessageFor(model => model.LonghornMsUri)
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="submit" value="Submit Build" class="btn btn-primary" />
<a href="/" onclick="window.history.back(); return false;" class="btn btn-default">Return to Listing</a>
</div>
</div>
</div>
}
@section Scripts
{
@Scripts.Render("~/bundles/jqueryval");
<script>
jQuery(function ($) {
$.validator.addMethod('date',
function (value, element) {
if (this.optional(element)) {
return true;
}
var ok = true;
try {
new Date(Date.parse(value, "yyMMdd-HHmm"));
}
catch (err) {
ok = false;
}
return ok;
});
});
$(function () {
$("#quickpaste").change(function () {
var regex = /(\d)\.([\d]{1,2})\.([\d]{4,5})\.([\d]{1,5})\.([a-zA-Z0-9_]+?)\.(\d\d\d\d\d\d-\d\d\d\d)/;
var result = regex.exec($("#quickpaste").val());
$("#MajorVersion").val(result[1]);
$("#MinorVersion").val(result[2]);
$("#Number").val(result[3]);
$("#Revision").val(result[4]);
$("#Lab").val(result[5]);
$("#BuildTime").val(result[6]);
});
})
</script>
}

240
Views/build/index.cshtml Normal file
View File

@ -0,0 +1,240 @@
@model IEnumerable<BuildFeed.Models.Build>
@{
ViewBag.Action = ViewContext.Controller.ValueProvider.GetValue("action").RawValue.ToString();
ViewBag.Title = "BuildFeed";
if (ViewBag.PageNumber > 1)
{
ViewBag.Title = string.Format("Page {1} | {0}", ViewBag.Title, ViewBag.PageNumber);
}
switch (ViewBag.Action as string)
{
case "Version":
ViewBag.Title = string.Format("Windows NT {1}.{2} | {0}", ViewBag.Title, ViewContext.Controller.ValueProvider.GetValue("major").RawValue, ViewContext.Controller.ValueProvider.GetValue("minor").RawValue);
break;
case "Lab":
ViewBag.Title = string.Format("Builds from {1} | {0}", ViewBag.Title, ViewContext.Controller.ValueProvider.GetValue("lab").RawValue);
break;
case "Year":
ViewBag.Title = string.Format("Builds from {1} | {0}", ViewBag.Title, ViewContext.Controller.ValueProvider.GetValue("year").RawValue);
break;
case "Source":
ViewBag.Title = string.Format("{1} | {0}", ViewBag.Title, ViewContext.Controller.ValueProvider.GetValue("source").RawValue);
break;
case "Index":
ViewBag.Title = "BuildFeed | The collaborative build list";
break;
}
}
<div class="row">
<div class="col-sm-9">
<ul class="list-unstyled">
@foreach (var item in Model)
{
<li>
<div class="build-head">
@Html.ActionLink("Info", "Info", new { id = item.Id }, new { @class = "btn btn-info btn-xs" })
@if (User.Identity.IsAuthenticated)
{
@Html.ActionLink("Edit", "Edit", new { id = item.Id }, new { @class = "btn btn-default btn-xs" })
}
@if (User.Identity.Name == "hounsell")
{
@Html.ActionLink("Delete", "Delete", new { id = item.Id }, new { @class = "btn btn-danger btn-xs" })
}
<h3>@Html.DisplayFor(modelItem => item.FullBuildString)</h3>
</div>
<div class="build-foot">
<span class="badge">@Html.DisplayFor(TypeOfSource => item.SourceType, "Enumeration")</span>
@if (item.FlightLevel != BuildFeed.Models.LevelOfFlight.None)
{
<span class="badge">Flight Level: @Html.DisplayFor(TypeOfSource => item.FlightLevel, "Enumeration")</span>
}
@if (item.BetaWikiUri != null)
{
<a href="@item.BetaWikiServerUri" target="_blank" class="badge"><i class="fa fa-sm fa-link"></i> BetaWiki (Client)</a>
}
@if (item.BetaWikiServerUri != null)
{
<a href="@item.BetaWikiServerUri" target="_blank" class="badge"><i class="fa fa-sm fa-link"></i> BetaWiki (Server)</a>
}
@if (item.WinWorldPCUri != null)
{
<a href="@item.WinWorldPCUri" target="_blank" class="badge"><i class="fa fa-sm fa-link"></i> WinWorldPC</a>
}
@if (item.BetaArchiveUri != null)
{
<a href="@item.BetaArchiveUri" target="_blank" class="badge"><i class="fa fa-sm fa-link"></i> BetaArchive Wiki</a>
}
@if (item.LonghornMsUri != null)
{
<a href="@item.LonghornMsUri" target="_blank" class="badge"><i class="fa fa-sm fa-link"></i> Longhorn.ms</a>
}
</div>
</li>
}
</ul>
</div>
<div class="col-sm-3">
<div class="panel-group" id="filter-list">
<div class="panel panel-default">
<div class="panel-heading">
<h4>
<a data-toggle="collapse" data-parent="#filter-list" href="#filter-clear">
Clear filters
</a>
</h4>
</div>
<div id="filter-clear" class="panel-collapse collapse @(ViewBag.Action == "Index" ? "in" : "")">
<div class="panel-body">
<ul class="nav nav-pills nav-stacked">
<li>@Html.ActionLink("Clear Filters", "Index", new { page = 1 })</li>
</ul>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4>
<a data-toggle="collapse" data-parent="#filter-list" href="#filter-version">
Filter by version
</a>
</h4>
</div>
<div id="filter-version" class="panel-collapse collapse @(ViewBag.Action == "Version" ? "in" : "")">
<div class="panel-body">
<ul class="nav nav-pills nav-stacked">
@foreach (BuildFeed.Models.BuildVersion ver in BuildFeed.Models.Build.SelectBuildVersions())
{
<li><a href="@Url.Action("Version", new { minor = ver.Minor, major = ver.Major, page = 1 })">@string.Format("{0}.{1}", ver.Major, ver.Minor)</a></li>
}
</ul>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4>
<a data-toggle="collapse" data-parent="#filter-list" href="#filter-lab">
Filter by lab
</a>
</h4>
</div>
<div id="filter-lab" class="panel-collapse collapse @(ViewBag.Action == "Lab" ? "in" : "")">
<div class="panel-body">
<ul class="nav nav-pills nav-stacked">
@foreach (string lab in BuildFeed.Models.Build.SelectBuildLabs())
{
<li>@Html.ActionLink(lab, "Lab", new { lab = lab, page = 1 })</li>
}
</ul>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4>
<a data-toggle="collapse" data-parent="#filter-list" href="#filter-year">
Filter by year
</a>
</h4>
</div>
<div id="filter-year" class="panel-collapse collapse @(ViewBag.Action == "Year" ? "in" : "")">
<div class="panel-body">
<ul class="nav nav-pills nav-stacked">
@foreach (int year in BuildFeed.Models.Build.SelectBuildYears())
{
<li>@Html.ActionLink(year.ToString(), "Year", new { year = year, page = 1 })</li>
}
</ul>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4>
<a data-toggle="collapse" data-parent="#filter-list" href="#filter-source">
Filter by source
</a>
</h4>
</div>
<div id="filter-source" class="panel-collapse collapse @(ViewBag.Action == "Source" ? "in" : "")">
<div class="panel-body">
<ul class="nav nav-pills nav-stacked">
@foreach (BuildFeed.Models.TypeOfSource s in Enum.GetValues(typeof(BuildFeed.Models.TypeOfSource)).Cast<BuildFeed.Models.TypeOfSource>().OrderBy(d => d.ToString()))
{
<li><a href="@Url.Action("Source", new { source = s })">@Html.DisplayFor(TypeOfSource => s, "Enumeration")</a></li>
}
</ul>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4>
<a data-toggle="collapse" data-parent="#filter-list" href="#admin-actions">
Website Administration
</a>
</h4>
</div>
<div id="admin-actions" class="panel-collapse collapse @(ViewBag.Action == "Source" ? "in" : "")">
<div class="panel-body">
<ul class="nav nav-pills nav-stacked">
@if (User.Identity.IsAuthenticated)
{
<li>@Html.ActionLink("Add a build", "Create", "build")</li>
<li>&nbsp;</li>
<li>@Html.ActionLink("Change your password", "Password", "support")</li>
<li>@Html.ActionLink("Log out", "Logout", "support")</li>
}
else
{
<li>@Html.ActionLink("Log in", "Login", "support")</li>
<li>@Html.ActionLink("Register", "Register", "support")</li>
}
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
@if (ViewBag.PageCount > 1)
{
<ul class="pagination">
@if (ViewBag.PageNumber > 1)
{
<li>@Html.ActionLink(HttpUtility.HtmlDecode("&laquo;"), ViewContext.Controller.ValueProvider.GetValue("action").RawValue.ToString(), new { page = ViewBag.PageNumber - 1 })</li>
}
else
{
<li class="disabled"><span>&laquo;</span></li>
}
@for (int i = 1; i <= ViewBag.PageCount; i++)
{
<li @((i == ViewBag.PageNumber) ? "class=active" : "")>@Html.ActionLink(i.ToString(), ViewBag.Action as string, new { page = i })</li>
}
@if (ViewBag.PageNumber < ViewBag.PageCount)
{
<li>@Html.ActionLink(HttpUtility.HtmlDecode("&raquo;"), ViewBag.Action as string, new { page = ViewBag.PageNumber + 1 })</li>
}
else
{
<li class="disabled"><span>&raquo;</span></li>
}
</ul>
}

165
Views/build/info.cshtml Normal file
View File

@ -0,0 +1,165 @@
@model BuildFeed.Models.Build
@{
ViewBag.Title = Model.FullBuildString + " | BuildFeed";
}
@section head
{
<meta name="description" content="@Model.FullBuildString. @Model.SourceDetails" />
<link href="@Url.Action()" rel="canonical" />
<meta property="og:title" content="@Model.FullBuildString" />
<meta property="og:type" content="website" />
<meta property="og:url" content="@Url.Action()" />
<meta property="og:description" content="@Model.SourceDetails, via BuildFeed." />
<!--<meta property="og:image" content="" />-->
}
<h2>@Model.FullBuildString</h2>
<div class="form-horizontal form-details">
<div class="form-group">
@Html.LabelFor(model => model.MajorVersion, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<p class="form-control-static">@Html.DisplayFor(model => model.MajorVersion)</p>
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.MinorVersion, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<p class="form-control-static">@Html.DisplayFor(model => model.MinorVersion)</p>
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Number, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<p class="form-control-static">@Html.DisplayFor(model => model.Number)</p>
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Revision, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<p class="form-control-static">@Html.DisplayFor(model => model.Revision)</p>
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Lab, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<p class="form-control-static">@Html.DisplayFor(model => model.Lab)</p>
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.BuildTime, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<p class="form-control-static">@Html.DisplayFor(model => model.BuildTime, "{0:yyMMdd-HHmm}")</p>
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.SourceType, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<p class="form-control-static">@Html.DisplayFor(model => model.SourceType, "Enumeration")</p>
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.SourceDetails, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<p class="form-control-static">@Html.DisplayFor(model => model.SourceDetails)</p>
</div>
</div>
@if (Model.MajorVersion == 6 && Model.MinorVersion == 4 && Model.FlightLevel != BuildFeed.Models.LevelOfFlight.None)
{
<div class="form-group">
@Html.LabelFor(model => model.FlightLevel, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<p class="form-control-static">@Html.DisplayFor(model => model.FlightLevel, "Enumeration")</p>
</div>
</div>
}
@if (Model.BetaWikiUri != null)
{
<div class="form-group">
@Html.LabelFor(model => model.BetaWikiUri, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<p class="form-control-static">
<a href="@Model.BetaWikiUri" target="_blank"><i class="fa fa-sm fa-link"></i> BetaWiki Article (Client)</a>
</p>
</div>
</div>
}
@if (Model.BetaWikiServerUri != null)
{
<div class="form-group">
@Html.LabelFor(model => model.BetaWikiServerUri, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<p class="form-control-static">
<a href="@Model.BetaWikiServerUri" target="_blank"><i class="fa fa-sm fa-link"></i> BetaWiki Article (Server)</a>
</p>
</div>
</div>
}
@if (Model.WinWorldPCUri != null)
{
<div class="form-group">
@Html.LabelFor(model => model.WinWorldPCUri, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<p class="form-control-static">
<a href="@Model.WinWorldPCUri" target="_blank"><i class="fa fa-sm fa-link"></i> WinWorldPC Library</a>
</p>
</div>
</div>
}
@if (Model.BetaArchiveUri != null)
{
<div class="form-group">
@Html.LabelFor(model => model.BetaArchiveUri, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<p class="form-control-static">
<a href="@Model.BetaArchiveUri" target="_blank"><i class="fa fa-sm fa-link"></i> BetaArchive Wiki</a>
</p>
</div>
</div>
}
@if (Model.MajorVersion == 6 && Model.MinorVersion == 0 && Model.LonghornMsUri != null)
{
<div class="form-group">
@Html.LabelFor(model => model.LonghornMsUri, new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
<p class="form-control-static">
<a href="@Model.LonghornMsUri" target="_blank"><i class="fa fa-sm fa-link"></i> Longhorn.ms Article</a>
</p>
</div>
</div>
}
<div class="form-group">
<label class="control-label col-sm-2">Share</label>
<div class="col-sm-10">
<div class="addthis_sharing_toolbox"></div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<a href="/" class="btn btn-default">Return to Listing</a>
</div>
</div>
</div>
@section scripts
{
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5431719a661cbfd0" async></script>
}

View File

@ -1,6 +1,6 @@
@using System.ComponentModel.DataAnnotations @using System.ComponentModel.DataAnnotations
@model BuildFeed.Models.TypeOfSource @model Enum
@{ @{