mirror of
https://gitlab.com/buildfeed/BuildFeed.git
synced 2024-03-22 21:10:34 +08:00
Refresh Pt 1
This commit is contained in:
parent
4988eb2d99
commit
a55b8ada0f
|
@ -16,95 +16,7 @@ public static void RegisterRoutes(RouteCollection routes)
|
|||
|
||||
routes.AppendTrailingSlash = true;
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Site Root",
|
||||
url: "",
|
||||
defaults: new { controller = "Build", action = "index", page = 1 }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Pagination",
|
||||
url: "page/{page}/",
|
||||
defaults: new { controller = "Build", action = "index", page = 1 }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Lab Root",
|
||||
url: "lab/{lab}/",
|
||||
defaults: new { controller = "Build", action = "lab", page = 1 }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Lab",
|
||||
url: "lab/{lab}/page/{page}/",
|
||||
defaults: new { controller = "Build", action = "lab", page = 1 }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Version Root",
|
||||
url: "version/{major}.{minor}/",
|
||||
defaults: new { controller = "Build", action = "version", page = 1 }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Version",
|
||||
url: "version/{major}.{minor}/page/{page}/",
|
||||
defaults: new { controller = "Build", action = "version", page = 1 }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Year Root",
|
||||
url: "year/{year}/",
|
||||
defaults: new { controller = "Build", action = "year", page = 1 }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Year",
|
||||
url: "year/{year}/page/{page}/",
|
||||
defaults: new { controller = "Build", action = "year", page = 1 }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Source Root",
|
||||
url: "source/{source}/",
|
||||
defaults: new { controller = "Build", action = "source", page = 1 }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Source",
|
||||
url: "source/{source}/page/{page}/",
|
||||
defaults: new { controller = "Build", action = "source", page = 1 }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "RSS (with ID)",
|
||||
url: "rss/{action}/{id}/",
|
||||
defaults: new { controller = "rss", action = "index" }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "RSS",
|
||||
url: "rss/{action}",
|
||||
defaults: new { controller = "rss", action = "index" }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Support",
|
||||
url: "support/{action}/",
|
||||
defaults: new { controller = "Support", action = "index" }
|
||||
);
|
||||
|
||||
routes.MapHttpRoute(
|
||||
name: "API",
|
||||
routeTemplate: "api/{action}/{id}",
|
||||
defaults: new { controller = "api", action = "GetBuilds", id = UrlParameter.Optional }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Actions",
|
||||
url: "actions/{action}/{id}",
|
||||
defaults: new { controller = "Build", action = "index", id = UrlParameter.Optional }
|
||||
);
|
||||
routes.MapMvcAttributeRoutes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,6 +193,7 @@
|
|||
<Compile Include="Auth\RedisMembershipProvider.cs" />
|
||||
<Compile Include="Controllers\apiController.cs" />
|
||||
<Compile Include="Controllers\buildController.cs" />
|
||||
<Compile Include="Controllers\frontController.cs" />
|
||||
<Compile Include="Controllers\rssController.cs" />
|
||||
<Compile Include="Controllers\supportController.cs" />
|
||||
<Compile Include="Global.asax.cs">
|
||||
|
@ -314,6 +315,7 @@
|
|||
<Content Include="smtp.config">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<Content Include="Views\front\index.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
|
|
34
Controllers/frontController.cs
Normal file
34
Controllers/frontController.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using BuildFeed.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace BuildFeed.Controllers
|
||||
{
|
||||
public class frontController : Controller
|
||||
{
|
||||
private const int _pageSize = 25;
|
||||
|
||||
[Route("")]
|
||||
[OutputCache(Duration = 600, VaryByParam = "none")]
|
||||
public ActionResult index()
|
||||
{
|
||||
var buildGroups = from b in Build.Select()
|
||||
group b by new BuildGroup()
|
||||
{
|
||||
Major = b.MajorVersion,
|
||||
Minor = b.MinorVersion,
|
||||
Build = b.Number,
|
||||
Revision = b.Revision
|
||||
} into bg
|
||||
orderby bg.Key.Major descending,
|
||||
bg.Key.Minor descending,
|
||||
bg.Key.Build descending,
|
||||
bg.Key.Revision descending
|
||||
select bg;
|
||||
return View(buildGroups);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -167,6 +167,8 @@ public ActionResult rss()
|
|||
return View();
|
||||
}
|
||||
|
||||
[Route("support/sitemap")]
|
||||
[OutputCache(Duration = 3600, VaryByParam = "none")]
|
||||
public ActionResult sitemap()
|
||||
{
|
||||
IEnumerable<Build> builds = Build.SelectInVersionOrder();
|
||||
|
@ -265,6 +267,8 @@ orderby bv.Key
|
|||
return View(model);
|
||||
}
|
||||
|
||||
[Route("support/xmlsitemap")]
|
||||
[OutputCache(Duration = 3600, VaryByParam = "none")]
|
||||
public ActionResult xmlsitemap()
|
||||
{
|
||||
XNamespace xn = XNamespace.Get("http://www.sitemaps.org/schemas/sitemap/0.9");
|
||||
|
@ -299,6 +303,8 @@ public ActionResult xmlsitemap()
|
|||
return new EmptyResult();
|
||||
}
|
||||
|
||||
[Route("support/stats")]
|
||||
[OutputCache(Duration = 3600, VaryByParam = "none")]
|
||||
public ActionResult stats()
|
||||
{
|
||||
var builds = Build.Select();
|
||||
|
@ -341,7 +347,7 @@ where b.BuildTime.HasValue
|
|||
where !string.IsNullOrEmpty(b.Lab)
|
||||
group b by b.Lab into bl
|
||||
select bl)
|
||||
where bl.Count() > 19
|
||||
where bl.Count() > 24
|
||||
orderby bl.Count() descending
|
||||
select new Tuple<string, int>(bl.Key, bl.Count());
|
||||
|
||||
|
|
|
@ -337,4 +337,19 @@ public override string ToString()
|
|||
return string.Format("{0}.{1}", Major, Minor);
|
||||
}
|
||||
}
|
||||
|
||||
public struct BuildGroup
|
||||
{
|
||||
public byte Major { get; set; }
|
||||
public byte Minor { get; set; }
|
||||
public ushort Build { get; set; }
|
||||
public ushort? Revision { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Revision.HasValue ?
|
||||
string.Format("{0}.{1}.{2}.{3}", Major, Minor, Build, Revision.Value) :
|
||||
string.Format("{0}.{1}.{2}", Major, Minor, Build);
|
||||
}
|
||||
}
|
||||
}
|
20
Views/front/index.cshtml
Normal file
20
Views/front/index.cshtml
Normal file
|
@ -0,0 +1,20 @@
|
|||
@model IEnumerable<IGrouping<BuildFeed.Models.BuildGroup, BuildFeed.Models.Build>>
|
||||
@{
|
||||
ViewBag.Title = "BuildFeed";
|
||||
}
|
||||
|
||||
<div class="row">
|
||||
@foreach (var group in Model)
|
||||
{
|
||||
<div class="col-sm-2">
|
||||
<h3>@group.Key.ToString()</h3>
|
||||
<p>
|
||||
@if(group.Any(k => k.BuildTime.HasValue))
|
||||
{
|
||||
<span><i class="fa fa-calendar fa-fw"></i> @group.Max(k => k.BuildTime).Value.ToString("dd MMMM yyyy")</span><br />
|
||||
}
|
||||
<i class="fa fa-server fa-fw"></i> @group.Count().ToString() variants
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
</div>
|
|
@ -42,20 +42,19 @@
|
|||
ga('send', 'pageview');
|
||||
</script>
|
||||
<div class="container">
|
||||
<header id="page-header">
|
||||
<div class="row">
|
||||
<div class="col-sm-9">
|
||||
<h1>@Html.ActionLink("BuildFeed", "index", new { controller = "build", area = "", page = 1 })</h1>
|
||||
</div>
|
||||
<div class="col-sm-3 text-right">
|
||||
<p class="social-links">
|
||||
<a href="https://twitter.com/buildfeed" title="Twitter" target="_blank"><i class="fa fa-2x fa-twitter"></i></a>
|
||||
<a href="@Url.Action("stats", new { controller = "support", area = "" }) " title="Statistics"><i class="fa fa-2x fa-line-chart"></i></a>
|
||||
<a href="@Url.Action("rss", new { controller = "support", area = "" })" title="RSS Feeds"><i class="fa fa-2x fa-rss"></i></a>
|
||||
</p>
|
||||
<header id="page-header"></header>
|
||||
<nav id="page-navigation" role="navigation">
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="container">
|
||||
@Html.ActionLink("BuildFeed", "index", new { controller = "front", area = "" }, new { @class = "navbar-brand" })
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li><a href="https://twitter.com/buildfeed" title="Twitter" target="_blank"><i class="fa fa-twitter"></i> Twitter</a></li>
|
||||
<li><a href="@Url.Action("stats", new { controller = "support", area = "" }) " title="Statistics"><i class="fa fa-line-chart"></i> Statistics</a></li>
|
||||
<li><a href="@Url.Action("rss", new { controller = "support", area = "" })" title="RSS Feeds"><i class="fa fa-rss"></i> RSS Feeds</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
</nav>
|
||||
<article id="page-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<canvas id="stats-compiled" width="960" height="320"></canvas>
|
||||
|
||||
<h4>Recorded builds in each lab</h4>
|
||||
<p>Only labs with more than 20 recorded builds are included.</p>
|
||||
<p>Only labs with 25 or more recorded builds are included.</p>
|
||||
<canvas id="stats-labs" width="960" height="320"></canvas>
|
||||
|
||||
@section scripts
|
||||
|
|
|
@ -15,16 +15,11 @@ h1
|
|||
color: #000;
|
||||
}
|
||||
|
||||
.social-links
|
||||
#page-content
|
||||
{
|
||||
margin: 30px 0 6px;
|
||||
padding-top: 70px;
|
||||
}
|
||||
|
||||
.social-links a
|
||||
{
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
.build-head
|
||||
{
|
||||
margin-bottom: 0.33em;
|
||||
|
|
Loading…
Reference in New Issue
Block a user