mirror of
https://gitlab.com/buildfeed/BuildFeed.git
synced 2024-03-22 21:10:34 +08:00
Cleanup; Change badge text for #14
Unleaked / Leaked => Private / Public It'll probably still confuse people, but to hell with it.
This commit is contained in:
parent
e34a41351c
commit
ce74b15e02
|
@ -14,12 +14,14 @@
|
|||
{
|
||||
RouteValueDictionary rvd = new RouteValueDictionary(rd);
|
||||
rvd.Remove("page");
|
||||
|
||||
<li>@MvcIntrinsics.Html.ActionLink(HttpUtility.HtmlDecode("«"), view, rvd)</li>
|
||||
}
|
||||
else if (currentPage > 2)
|
||||
{
|
||||
RouteValueDictionary rvd = new RouteValueDictionary(rd);
|
||||
rvd["page"] = currentPage - 1;
|
||||
|
||||
<li>@MvcIntrinsics.Html.ActionLink(HttpUtility.HtmlDecode("«"), multiView, rvd)</li>
|
||||
}
|
||||
else
|
||||
|
@ -37,6 +39,7 @@
|
|||
{
|
||||
RouteValueDictionary rvd = new RouteValueDictionary(rd);
|
||||
rvd["page"] = i;
|
||||
|
||||
<li @((i == currentPage) ? "class=active" : "")>@MvcIntrinsics.Html.ActionLink(i.ToString(), multiView, rvd)</li>
|
||||
}
|
||||
|
||||
|
@ -45,6 +48,7 @@
|
|||
{
|
||||
RouteValueDictionary rvd = new RouteValueDictionary(rd);
|
||||
rvd["page"] = currentPage + 1;
|
||||
|
||||
<li>@MvcIntrinsics.Html.ActionLink(HttpUtility.HtmlDecode("»"), multiView, rvd)</li>
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System.Web;
|
||||
using System.Web.Optimization;
|
||||
using System.Web.Optimization;
|
||||
|
||||
namespace BuildFeed
|
||||
{
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Configuration;
|
||||
|
||||
namespace BuildFeed
|
||||
{
|
||||
|
@ -16,21 +12,21 @@ static DatabaseConfig()
|
|||
{
|
||||
Host = ConfigurationManager.AppSettings["data:ServerHost"];
|
||||
|
||||
int _port;
|
||||
bool success = int.TryParse(ConfigurationManager.AppSettings["data:ServerPort"], out _port);
|
||||
int port;
|
||||
bool success = int.TryParse(ConfigurationManager.AppSettings["data:ServerPort"], out port);
|
||||
if (!success)
|
||||
{
|
||||
_port = 6379; // redis default port
|
||||
port = 6379; // redis default port
|
||||
}
|
||||
Port = _port;
|
||||
Port = port;
|
||||
|
||||
long _db;
|
||||
success = long.TryParse(ConfigurationManager.AppSettings["data:ServerDB"], out _db);
|
||||
long db;
|
||||
success = long.TryParse(ConfigurationManager.AppSettings["data:ServerDB"], out db);
|
||||
if (!success)
|
||||
{
|
||||
_db = 0; // redis default db
|
||||
db = 0; // redis default db
|
||||
}
|
||||
Database = _db;
|
||||
Database = db;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +1,9 @@
|
|||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace BuildFeed
|
||||
{
|
||||
public class FilterConfig
|
||||
{
|
||||
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
|
||||
{
|
||||
filters.Add(new HandleErrorAttribute());
|
||||
}
|
||||
public static void RegisterGlobalFilters(GlobalFilterCollection filters) { filters.Add(new HandleErrorAttribute()); }
|
||||
}
|
||||
}
|
|
@ -1,10 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace BuildFeed
|
||||
{
|
||||
|
@ -13,15 +9,14 @@ public class RouteConfig
|
|||
public static void RegisterRoutes(RouteCollection routes)
|
||||
{
|
||||
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
|
||||
|
||||
routes.MapHttpRoute(
|
||||
name: "API",
|
||||
routeTemplate: "api/{action}/{id}",
|
||||
defaults: new { controller = "api", action = "GetBuilds", id = UrlParameter.Optional }
|
||||
);
|
||||
|
||||
routes.MapHttpRoute("API", "api/{action}/{id}",
|
||||
new
|
||||
{
|
||||
controller = "api",
|
||||
action = "GetBuilds",
|
||||
id = UrlParameter.Optional
|
||||
});
|
||||
routes.AppendTrailingSlash = true;
|
||||
|
||||
routes.MapMvcAttributeRoutes();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Security;
|
||||
|
||||
namespace BuildFeed.Areas.admin.Controllers
|
||||
|
@ -11,10 +7,7 @@ public class baseController : Controller
|
|||
{
|
||||
[Authorize(Roles = "Administrators")]
|
||||
// GET: admin/base
|
||||
public ActionResult index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
public ActionResult index() { return View(); }
|
||||
|
||||
[Authorize(Users = "hounsell")]
|
||||
public ActionResult setup()
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
using BuildFeed.Areas.admin.Models.ViewModel;
|
||||
using BuildFeed.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using BuildFeed.Areas.admin.Models.ViewModel;
|
||||
using BuildFeed.Models;
|
||||
|
||||
namespace BuildFeed.Areas.admin.Controllers
|
||||
{
|
||||
|
@ -15,46 +12,48 @@ public class metaController : Controller
|
|||
public ActionResult index()
|
||||
{
|
||||
var currentItems = from i in MetaItem.Select()
|
||||
group i by i.Id.Type into b
|
||||
group i by i.Id.Type
|
||||
into b
|
||||
select b;
|
||||
|
||||
var pendingLabs = MetaItem.SelectUnusedLabs();
|
||||
|
||||
return View(new MetaListing()
|
||||
return View(new MetaListing
|
||||
{
|
||||
CurrentItems = from i in MetaItem.Select()
|
||||
group i by i.Id.Type into b
|
||||
group i by i.Id.Type
|
||||
into b
|
||||
orderby b.Key.ToString()
|
||||
select b,
|
||||
|
||||
NewItems = from i in (from l in MetaItem.SelectUnusedLabs()
|
||||
select new MetaItem()
|
||||
select new MetaItem
|
||||
{
|
||||
Id = new MetaItemKey()
|
||||
Id = new MetaItemKey
|
||||
{
|
||||
Type = MetaType.Lab,
|
||||
Value = l
|
||||
}
|
||||
}).Concat(
|
||||
from v in MetaItem.SelectUnusedVersions()
|
||||
select new MetaItem()
|
||||
})
|
||||
.Concat(from v in MetaItem.SelectUnusedVersions()
|
||||
select new MetaItem
|
||||
{
|
||||
Id = new MetaItemKey()
|
||||
Id = new MetaItemKey
|
||||
{
|
||||
Type = MetaType.Version,
|
||||
Value = v
|
||||
}
|
||||
}).Concat(
|
||||
from y in MetaItem.SelectUnusedYears()
|
||||
select new MetaItem()
|
||||
})
|
||||
.Concat(from y in MetaItem.SelectUnusedYears()
|
||||
select new MetaItem
|
||||
{
|
||||
Id = new MetaItemKey()
|
||||
Id = new MetaItemKey
|
||||
{
|
||||
Type = MetaType.Year,
|
||||
Value = y
|
||||
}
|
||||
})
|
||||
group i by i.Id.Type into b
|
||||
group i by i.Id.Type
|
||||
into b
|
||||
orderby b.Key.ToString()
|
||||
select b
|
||||
});
|
||||
|
@ -62,7 +61,14 @@ select b
|
|||
|
||||
public ActionResult create(MetaType type, string value)
|
||||
{
|
||||
return View(new MetaItem() { Id = new MetaItemKey() { Type = type, Value = value } });
|
||||
return View(new MetaItem
|
||||
{
|
||||
Id = new MetaItemKey
|
||||
{
|
||||
Type = type,
|
||||
Value = value
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
@ -79,7 +85,11 @@ public ActionResult create(MetaItem meta)
|
|||
|
||||
public ActionResult edit(MetaType type, string value)
|
||||
{
|
||||
return View("create", MetaItem.SelectById(new MetaItemKey() { Type = type, Value = value }));
|
||||
return View("create", MetaItem.SelectById(new MetaItemKey
|
||||
{
|
||||
Type = type,
|
||||
Value = value
|
||||
}));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
using RedisAuth;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Security;
|
||||
using RedisAuth;
|
||||
|
||||
namespace BuildFeed.Areas.admin.Controllers
|
||||
{
|
||||
|
@ -14,16 +12,17 @@ public class usersController : Controller
|
|||
// GET: admin/users
|
||||
public ActionResult index()
|
||||
{
|
||||
return View(Membership.GetAllUsers().Cast<MembershipUser>().OrderByDescending(m => m.IsApproved).ThenBy(m => m.UserName));
|
||||
return View(Membership.GetAllUsers()
|
||||
.Cast<MembershipUser>()
|
||||
.OrderByDescending(m => m.IsApproved)
|
||||
.ThenBy(m => m.UserName));
|
||||
}
|
||||
|
||||
public ActionResult admins()
|
||||
{
|
||||
List<MembershipUser> admins = new List<MembershipUser>();
|
||||
foreach (var m in Roles.GetUsersInRole("Administrators"))
|
||||
{
|
||||
admins.Add(Membership.GetUser(m));
|
||||
}
|
||||
var admins = Roles.GetUsersInRole("Administrators")
|
||||
.Select(Membership.GetUser)
|
||||
.ToList();
|
||||
|
||||
return View(admins.OrderByDescending(m => m.UserName));
|
||||
}
|
||||
|
@ -42,35 +41,35 @@ public ActionResult demote(string id)
|
|||
|
||||
public ActionResult approve(Guid id)
|
||||
{
|
||||
var provider = (Membership.Provider as RedisMembershipProvider);
|
||||
provider.ChangeApproval(id, true);
|
||||
RedisMembershipProvider provider = (Membership.Provider as RedisMembershipProvider);
|
||||
provider?.ChangeApproval(id, true);
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
public ActionResult unapprove(Guid id)
|
||||
{
|
||||
var provider = (Membership.Provider as RedisMembershipProvider);
|
||||
provider.ChangeApproval(id, false);
|
||||
RedisMembershipProvider provider = (Membership.Provider as RedisMembershipProvider);
|
||||
provider?.ChangeApproval(id, false);
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
public ActionResult @lock(Guid id)
|
||||
{
|
||||
var provider = (Membership.Provider as RedisMembershipProvider);
|
||||
provider.ChangeLockStatus(id, true);
|
||||
RedisMembershipProvider provider = (Membership.Provider as RedisMembershipProvider);
|
||||
provider?.ChangeLockStatus(id, true);
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
public ActionResult unlock(Guid id)
|
||||
{
|
||||
var provider = (Membership.Provider as RedisMembershipProvider);
|
||||
provider.ChangeLockStatus(id, false);
|
||||
RedisMembershipProvider provider = (Membership.Provider as RedisMembershipProvider);
|
||||
provider?.ChangeLockStatus(id, false);
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
public ActionResult cleanup()
|
||||
{
|
||||
var users = Membership.GetAllUsers();
|
||||
MembershipUserCollection users = Membership.GetAllUsers();
|
||||
|
||||
foreach (MembershipUser user in users)
|
||||
{
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
@model BuildFeed.Models.MetaItem
|
||||
|
||||
@{
|
||||
ViewBag.Title = string.Format("Add metadata for {0} | BuildFeed", Model.Id.Value);
|
||||
ViewBag.Title = $"Add metadata for {Model.Id.Value} | BuildFeed";
|
||||
}
|
||||
|
||||
<h2>@string.Format("Add metadata for {0}", Model.Id.Value)</h2>
|
||||
<h2>@($"Add metadata for {Model.Id.Value}")</h2>
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
@Html.HiddenFor(model => model.Id.Type);
|
||||
@Html.HiddenFor(model => model.Id.Value);
|
||||
@Html.HiddenFor(model => model.Id.Type)
|
||||
@Html.HiddenFor(model => model.Id.Value)
|
||||
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@model IEnumerable<System.Web.Security.MembershipUser>
|
||||
@model IEnumerable<MembershipUser>
|
||||
|
||||
@{
|
||||
ViewBag.Title = "View administrators | BuildFeed";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@model IEnumerable<System.Web.Security.MembershipUser>
|
||||
@model IEnumerable<MembershipUser>
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Manage users | BuildFeed";
|
||||
|
@ -54,24 +54,18 @@
|
|||
@Html.DisplayFor(modelItem => mu.LastLockoutDate)
|
||||
</td>
|
||||
<td class="text-right">
|
||||
@if (mu.IsApproved)
|
||||
{
|
||||
@Html.ActionLink("Unapprove", "unapprove", new { id = mu.ProviderUserKey }, new { @class = "btn btn-danger", style = "width:90px;" })
|
||||
}
|
||||
else
|
||||
{
|
||||
@Html.ActionLink("Approve", "approve", new { id = mu.ProviderUserKey }, new { @class = "btn btn-success", style = "width:90px;" })
|
||||
}
|
||||
@(
|
||||
mu.IsApproved ?
|
||||
Html.ActionLink("Unapprove", "unapprove", new { id = mu.ProviderUserKey }, new { @class = "btn btn-danger", style = "width:90px;" }) :
|
||||
Html.ActionLink("Approve", "approve", new { id = mu.ProviderUserKey }, new { @class = "btn btn-success", style = "width:90px;" })
|
||||
)
|
||||
</td>
|
||||
<td class="text-right">
|
||||
@if (!mu.IsLockedOut)
|
||||
{
|
||||
@Html.ActionLink("Lock", "lock", new { id = mu.ProviderUserKey }, new { @class = "btn btn-danger", style = "width:90px;" })
|
||||
}
|
||||
else
|
||||
{
|
||||
@Html.ActionLink("Unlock", "unlock", new { id = mu.ProviderUserKey }, new { @class = "btn btn-success", style = "width:90px;" })
|
||||
}
|
||||
@(
|
||||
!mu.IsLockedOut ?
|
||||
Html.ActionLink("Lock", "lock", new { id = mu.ProviderUserKey }, new { @class = "btn btn-danger", style = "width:90px;" }) :
|
||||
Html.ActionLink("Unlock", "unlock", new { id = mu.ProviderUserKey }, new { @class = "btn btn-success", style = "width:90px;" })
|
||||
)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
<add namespace="System.Web.Routing" />
|
||||
<add namespace="System.Web.Optimization" />
|
||||
<add namespace="BuildFeed" />
|
||||
|
||||
</namespaces>
|
||||
</pages>
|
||||
</system.web.webPages.razor>
|
||||
|
|
|
@ -4,13 +4,7 @@ namespace BuildFeed.Areas.admin
|
|||
{
|
||||
public class adminAreaRegistration : AreaRegistration
|
||||
{
|
||||
public override string AreaName
|
||||
{
|
||||
get
|
||||
{
|
||||
return "admin";
|
||||
}
|
||||
}
|
||||
public override string AreaName => "admin";
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<ApplicationInsightsResourceId>/subscriptions/4af45631-0e5c-4253-9e38-d0c47f9c5b32/resourcegroups/Default-ApplicationInsights-CentralUS/providers/microsoft.insights/components/BuildFeed</ApplicationInsightsResourceId>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<TypeScriptToolsVersion>1.4</TypeScriptToolsVersion>
|
||||
<TypeScriptToolsVersion>1.5</TypeScriptToolsVersion>
|
||||
<UseGlobalApplicationHostFile />
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -16,7 +16,7 @@ public override object BindModel(ControllerContext controllerContext, ModelBindi
|
|||
success = DateTime.TryParseExact(value.AttemptedValue, "yyMMdd-HHmm", CultureInfo.InvariantCulture, DateTimeStyles.AllowWhiteSpaces, out retValue);
|
||||
}
|
||||
|
||||
return success ? retValue as DateTime? : null as DateTime?;
|
||||
return success ? retValue as DateTime? : null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
|
||||
namespace BuildFeed
|
||||
|
@ -8,8 +7,8 @@ public static class DisplayHelpers
|
|||
{
|
||||
public static string GetDisplayTextForEnum(object o)
|
||||
{
|
||||
var result = null as string;
|
||||
var display = o.GetType()
|
||||
string result = null as string;
|
||||
DisplayAttribute display = o.GetType()
|
||||
.GetMember(o.ToString()).First()
|
||||
.GetCustomAttributes(false)
|
||||
.OfType<DisplayAttribute>()
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.WebPages;
|
||||
|
||||
namespace BuildFeed.Code
|
||||
{
|
||||
public static class MvcIntrinsics
|
||||
{
|
||||
public static System.Web.Mvc.HtmlHelper Html => ((System.Web.Mvc.WebViewPage) WebPageContext.Current.Page).Html;
|
||||
public static HtmlHelper Html => ((WebViewPage) WebPageContext.Current.Page).Html;
|
||||
|
||||
public static System.Web.Mvc.AjaxHelper Ajax => ((System.Web.Mvc.WebViewPage) WebPageContext.Current.Page).Ajax;
|
||||
public static AjaxHelper Ajax => ((WebViewPage) WebPageContext.Current.Page).Ajax;
|
||||
|
||||
public static System.Web.Mvc.UrlHelper Url => ((System.Web.Mvc.WebViewPage) WebPageContext.Current.Page).Url;
|
||||
public static UrlHelper Url => ((WebViewPage) WebPageContext.Current.Page).Url;
|
||||
}
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
using BuildFeed.Code;
|
||||
using BuildFeed.Models;
|
||||
using BuildFeed.Models.ViewModel.Front;
|
||||
using System;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing.Text;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using BuildFeed.Code;
|
||||
using BuildFeed.Models;
|
||||
using BuildFeed.Models.ViewModel.Front;
|
||||
|
||||
namespace BuildFeed.Controllers
|
||||
{
|
||||
|
@ -19,10 +19,7 @@ public class frontController : Controller
|
|||
#if !DEBUG
|
||||
[OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||
#endif
|
||||
public ActionResult index()
|
||||
{
|
||||
return indexPage(1);
|
||||
}
|
||||
public ActionResult index() { return indexPage(1); }
|
||||
|
||||
[Route("page-{page:int:min(2)}/", Order = 0)]
|
||||
#if !DEBUG
|
||||
|
@ -31,18 +28,19 @@ public ActionResult index()
|
|||
public ActionResult indexPage(int page)
|
||||
{
|
||||
var buildGroups = (from b in Build.Select()
|
||||
group b by new BuildGroup()
|
||||
group b by new BuildGroup
|
||||
{
|
||||
Major = b.MajorVersion,
|
||||
Minor = b.MinorVersion,
|
||||
Build = b.Number,
|
||||
Revision = b.Revision
|
||||
} into bg
|
||||
}
|
||||
into bg
|
||||
orderby bg.Key.Major descending,
|
||||
bg.Key.Minor descending,
|
||||
bg.Key.Build descending,
|
||||
bg.Key.Revision descending
|
||||
select new FrontBuildGroup()
|
||||
select new FrontBuildGroup
|
||||
{
|
||||
Key = bg.Key,
|
||||
LastBuild = bg.Max(m => m.BuildTime),
|
||||
|
@ -67,13 +65,14 @@ bg.Key.Revision descending
|
|||
public ActionResult viewGroup(byte major, byte minor, ushort number, ushort? revision = null)
|
||||
{
|
||||
var builds = (from b in Build.Select()
|
||||
group b by new BuildGroup()
|
||||
group b by new BuildGroup
|
||||
{
|
||||
Major = b.MajorVersion,
|
||||
Minor = b.MinorVersion,
|
||||
Build = b.Number,
|
||||
Revision = b.Revision
|
||||
} into bg
|
||||
}
|
||||
into bg
|
||||
where bg.Key.Major == major
|
||||
where bg.Key.Minor == minor
|
||||
where bg.Key.Build == number
|
||||
|
@ -105,6 +104,7 @@ public ActionResult twitterCard(long id)
|
|||
Build b = Build.SelectById(id);
|
||||
|
||||
using (Bitmap bm = new Bitmap(560, 300))
|
||||
{
|
||||
using (Graphics gr = Graphics.FromImage(bm))
|
||||
{
|
||||
GraphicsPath gp = new GraphicsPath();
|
||||
|
@ -125,6 +125,7 @@ public ActionResult twitterCard(long id)
|
|||
Response.ContentType = "image/png";
|
||||
bm.Save(Response.OutputStream, ImageFormat.Png);
|
||||
}
|
||||
}
|
||||
|
||||
return new EmptyResult();
|
||||
}
|
||||
|
@ -133,10 +134,7 @@ public ActionResult twitterCard(long id)
|
|||
#if !DEBUG
|
||||
[OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||
#endif
|
||||
public ActionResult viewLab(string lab)
|
||||
{
|
||||
return viewLabPage(lab, 1);
|
||||
}
|
||||
public ActionResult viewLab(string lab) { return viewLabPage(lab, 1); }
|
||||
|
||||
[Route("lab/{lab}/page-{page:int:min(2)}/", Order = 0)]
|
||||
#if !DEBUG
|
||||
|
@ -144,7 +142,11 @@ public ActionResult viewLab(string lab)
|
|||
#endif
|
||||
public ActionResult viewLabPage(string lab, int page)
|
||||
{
|
||||
ViewBag.MetaItem = MetaItem.SelectById(new MetaItemKey() { Type = MetaType.Lab, Value = lab });
|
||||
ViewBag.MetaItem = MetaItem.SelectById(new MetaItemKey
|
||||
{
|
||||
Type = MetaType.Lab,
|
||||
Value = lab
|
||||
});
|
||||
ViewBag.ItemId = lab;
|
||||
|
||||
var builds = Build.SelectInBuildOrder().Where(b => b.Lab != null && (b.Lab.ToLower() == lab.ToLower())).ToArray();
|
||||
|
@ -164,10 +166,7 @@ public ActionResult viewLabPage(string lab, int page)
|
|||
#if !DEBUG
|
||||
[OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||
#endif
|
||||
public ActionResult viewSource(TypeOfSource source)
|
||||
{
|
||||
return viewSourcePage(source, 1);
|
||||
}
|
||||
public ActionResult viewSource(TypeOfSource source) { return viewSourcePage(source, 1); }
|
||||
|
||||
[Route("source/{source}/page-{page:int:min(2)}/", Order = 0)]
|
||||
#if !DEBUG
|
||||
|
@ -175,7 +174,11 @@ public ActionResult viewSource(TypeOfSource source)
|
|||
#endif
|
||||
public ActionResult viewSourcePage(TypeOfSource source, int page)
|
||||
{
|
||||
ViewBag.MetaItem = MetaItem.SelectById(new MetaItemKey() { Type = MetaType.Source, Value = source.ToString() });
|
||||
ViewBag.MetaItem = MetaItem.SelectById(new MetaItemKey
|
||||
{
|
||||
Type = MetaType.Source,
|
||||
Value = source.ToString()
|
||||
});
|
||||
ViewBag.ItemId = DisplayHelpers.GetDisplayTextForEnum(source);
|
||||
|
||||
var builds = Build.SelectInBuildOrder().Where(b => b.SourceType == source).ToArray();
|
||||
|
@ -195,10 +198,7 @@ public ActionResult viewSourcePage(TypeOfSource source, int page)
|
|||
#if !DEBUG
|
||||
[OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||
#endif
|
||||
public ActionResult viewYear(int year)
|
||||
{
|
||||
return viewYearPage(year, 1);
|
||||
}
|
||||
public ActionResult viewYear(int year) { return viewYearPage(year, 1); }
|
||||
|
||||
[Route("year/{year}/page-{page:int:min(2)}/", Order = 0)]
|
||||
#if !DEBUG
|
||||
|
@ -206,7 +206,11 @@ public ActionResult viewYear(int year)
|
|||
#endif
|
||||
public ActionResult viewYearPage(int year, int page)
|
||||
{
|
||||
ViewBag.MetaItem = MetaItem.SelectById(new MetaItemKey() { Type = MetaType.Year, Value = year.ToString() });
|
||||
ViewBag.MetaItem = MetaItem.SelectById(new MetaItemKey
|
||||
{
|
||||
Type = MetaType.Year,
|
||||
Value = year.ToString()
|
||||
});
|
||||
ViewBag.ItemId = year.ToString();
|
||||
|
||||
var builds = Build.SelectInBuildOrder().Where(b => b.BuildTime.HasValue && b.BuildTime.Value.Year == year).ToArray();
|
||||
|
@ -226,10 +230,7 @@ public ActionResult viewYearPage(int year, int page)
|
|||
#if !DEBUG
|
||||
[OutputCache(Duration = 600, VaryByParam = "none", VaryByCustom = "userName")]
|
||||
#endif
|
||||
public ActionResult viewVersion(int major, int minor)
|
||||
{
|
||||
return viewVersionPage(major, minor, 1);
|
||||
}
|
||||
public ActionResult viewVersion(int major, int minor) { return viewVersionPage(major, minor, 1); }
|
||||
|
||||
[Route("version/{major}.{minor}/page-{page:int:min(2)}/", Order = 0)]
|
||||
#if !DEBUG
|
||||
|
@ -238,7 +239,11 @@ public ActionResult viewVersion(int major, int minor)
|
|||
public ActionResult viewVersionPage(int major, int minor, int page)
|
||||
{
|
||||
string valueString = $"{major}.{minor}";
|
||||
ViewBag.MetaItem = MetaItem.SelectById(new MetaItemKey() { Type = MetaType.Version, Value = valueString });
|
||||
ViewBag.MetaItem = MetaItem.SelectById(new MetaItemKey
|
||||
{
|
||||
Type = MetaType.Version,
|
||||
Value = valueString
|
||||
});
|
||||
ViewBag.ItemId = valueString;
|
||||
|
||||
var builds = Build.SelectInBuildOrder().Where(b => b.MajorVersion == major && b.MinorVersion == minor).ToArray();
|
||||
|
@ -255,10 +260,7 @@ public ActionResult viewVersionPage(int major, int minor, int page)
|
|||
}
|
||||
|
||||
[Route("add/"), Authorize]
|
||||
public ActionResult addBuild()
|
||||
{
|
||||
return View("editBuild");
|
||||
}
|
||||
public ActionResult addBuild() { return View("editBuild"); }
|
||||
|
||||
[Route("add/"), Authorize, HttpPost]
|
||||
public ActionResult addBuild(Build build)
|
||||
|
@ -275,12 +277,12 @@ public ActionResult addBuild(Build build)
|
|||
{
|
||||
return View("editBuild", build);
|
||||
}
|
||||
return RedirectToAction("viewBuild", new { id = build.Id });
|
||||
}
|
||||
else
|
||||
return RedirectToAction("viewBuild", new
|
||||
{
|
||||
return View("editBuild", build);
|
||||
id = build.Id
|
||||
});
|
||||
}
|
||||
return View("editBuild", build);
|
||||
}
|
||||
|
||||
[Route("edit/{id}/"), Authorize]
|
||||
|
@ -306,11 +308,8 @@ public ActionResult editBuild(long id, Build build)
|
|||
|
||||
return RedirectToAction("viewBuild", new { id = build.Id });
|
||||
}
|
||||
else
|
||||
{
|
||||
return View(build);
|
||||
}
|
||||
}
|
||||
|
||||
[Route("delete/{id}/"), Authorize(Roles = "Administrators")]
|
||||
public ActionResult deleteBuild(long id)
|
||||
|
|
|
@ -142,7 +142,7 @@ public ActionResult sitemap()
|
|||
Dictionary<string, SitemapPagedAction[]> actions = new Dictionary<string, SitemapPagedAction[]>
|
||||
{
|
||||
{
|
||||
"Pages", new SitemapPagedAction[]
|
||||
"Pages", new[]
|
||||
{
|
||||
new SitemapPagedAction()
|
||||
{
|
||||
|
@ -326,7 +326,11 @@ public ActionResult stats()
|
|||
List<MonthCount> additions = new List<MonthCount>();
|
||||
var rawAdditions = (from b in builds
|
||||
where b.Added > DateTime.Now.AddYears(-1)
|
||||
group b by new { Year = b.Added.Year, Week = Convert.ToInt32(Math.Floor(b.Added.DayOfYear / 7m)) } into bm
|
||||
group b by new
|
||||
{
|
||||
Year = b.Added.Year,
|
||||
Week = Convert.ToInt32(Math.Floor(b.Added.DayOfYear / 7m))
|
||||
} into bm
|
||||
select new MonthCount()
|
||||
{
|
||||
Month = bm.Key.Week,
|
||||
|
@ -348,7 +352,11 @@ public ActionResult stats()
|
|||
List<MonthCount> compiles = new List<MonthCount>();
|
||||
var rawCompiles = from b in builds
|
||||
where b.BuildTime.HasValue
|
||||
group b by new { Year = b.BuildTime.Value.Year, Month = Convert.ToInt32(Math.Floor((b.BuildTime.Value.Month - 0.1m) / 3m) * 3) + 1 } into bm
|
||||
group b by new
|
||||
{
|
||||
Year = b.BuildTime.Value.Year,
|
||||
Month = Convert.ToInt32(Math.Floor((b.BuildTime.Value.Month - 0.1m) / 3m) * 3) + 1
|
||||
} into bm
|
||||
select new MonthCount()
|
||||
{
|
||||
Month = bm.Key.Month,
|
||||
|
|
|
@ -32,11 +32,11 @@
|
|||
<p>
|
||||
@if (build.IsLeaked)
|
||||
{
|
||||
<span class="label label-success label-build-status">Leaked</span>
|
||||
<span class="label label-success label-build-status">Public</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="label label-danger label-build-status">Unleaked</span>
|
||||
<span class="label label-danger label-build-status">Private</span>
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
@ -58,11 +58,11 @@
|
|||
<p>
|
||||
@if (build.IsLeaked)
|
||||
{
|
||||
<span class="label label-success label-build-status">Leaked</span>
|
||||
<span class="label label-success label-build-status">Public</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="label label-danger label-build-status">Unleaked</span>
|
||||
<span class="label label-danger label-build-status">Private</span>
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
@ -57,11 +57,11 @@
|
|||
<p>
|
||||
@if (build.IsLeaked)
|
||||
{
|
||||
<span class="label label-success label-build-status">Leaked</span>
|
||||
<span class="label label-success label-build-status">Public</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="label label-danger label-build-status">Unleaked</span>
|
||||
<span class="label label-danger label-build-status">Private</span>
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
@ -57,11 +57,11 @@
|
|||
<p>
|
||||
@if (build.IsLeaked)
|
||||
{
|
||||
<span class="label label-success label-build-status">Leaked</span>
|
||||
<span class="label label-success label-build-status">Public</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="label label-danger label-build-status">Unleaked</span>
|
||||
<span class="label label-danger label-build-status">Private</span>
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
@ -62,11 +62,11 @@
|
|||
<p>
|
||||
@if (build.IsLeaked)
|
||||
{
|
||||
<span class="label label-success label-build-status">Leaked</span>
|
||||
<span class="label label-success label-build-status">Public</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="label label-danger label-build-status">Unleaked</span>
|
||||
<span class="label label-danger label-build-status">Private</span>
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user