mirror of
https://gitlab.com/buildfeed/BuildFeed.git
synced 2024-03-22 21:10:34 +08:00
Flight level RSS, RSS feeds page, other tweaks.
This commit is contained in:
parent
3f92d62b8f
commit
c625bc2a05
|
@ -76,10 +76,16 @@ public static void RegisterRoutes(RouteCollection routes)
|
|||
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" }
|
||||
defaults: new { controller = "rss", action = "index" }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
|
|
|
@ -44,8 +44,9 @@
|
|||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Elmah">
|
||||
<HintPath>..\packages\elmah.corelibrary.1.2.1\lib\Elmah.dll</HintPath>
|
||||
<Reference Include="Elmah, Version=1.2.14706.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\elmah.corelibrary.1.2.2\lib\Elmah.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Elmah.Mvc">
|
||||
<HintPath>..\packages\Elmah.MVC.2.1.1\lib\net40\Elmah.Mvc.dll</HintPath>
|
||||
|
@ -55,11 +56,13 @@
|
|||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Newtonsoft.Json.6.0.5\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NServiceKit.Common">
|
||||
<HintPath>..\packages\NServiceKit.Common.1.0.11\lib\net35\NServiceKit.Common.dll</HintPath>
|
||||
<Reference Include="NServiceKit.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\NServiceKit.Common.1.0.27\lib\net35\NServiceKit.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NServiceKit.Interfaces">
|
||||
<HintPath>..\packages\NServiceKit.Common.1.0.11\lib\net35\NServiceKit.Interfaces.dll</HintPath>
|
||||
<Reference Include="NServiceKit.Interfaces, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\NServiceKit.Common.1.0.27\lib\net35\NServiceKit.Interfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NServiceKit.Redis">
|
||||
<HintPath>..\packages\NServiceKit.Redis.1.0.7\lib\net35\NServiceKit.Redis.dll</HintPath>
|
||||
|
@ -152,7 +155,6 @@
|
|||
<Compile Include="Auth\RedisMembershipProvider.cs" />
|
||||
<Compile Include="Controllers\apiController.cs" />
|
||||
<Compile Include="Controllers\buildController.cs" />
|
||||
<Compile Include="Controllers\pageController.cs" />
|
||||
<Compile Include="Controllers\rssController.cs" />
|
||||
<Compile Include="Controllers\supportController.cs" />
|
||||
<Compile Include="Global.asax.cs">
|
||||
|
@ -211,6 +213,7 @@
|
|||
<Content Include="Views\build\info.cshtml" />
|
||||
<Content Include="Views\support\password.cshtml" />
|
||||
<Content Include="Views\support\thanks_register.cshtml" />
|
||||
<Content Include="Views\support\rss.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
|
|
|
@ -75,6 +75,12 @@ public ActionResult Source(TypeOfSource source, int page = 1)
|
|||
public ActionResult Info(int id)
|
||||
{
|
||||
Build b = Build.SelectById(id);
|
||||
|
||||
if(b == null)
|
||||
{
|
||||
return new HttpNotFoundResult();
|
||||
}
|
||||
|
||||
return View(b);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace BuildFeed.Controllers
|
||||
{
|
||||
public class pageController : Controller
|
||||
{
|
||||
public ActionResult Index()
|
||||
{
|
||||
return new RedirectResult("/", true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@ public class rssController : Controller
|
|||
{
|
||||
//
|
||||
// GET: /rss/
|
||||
public async Task<ActionResult> Index()
|
||||
public async Task<ActionResult> index()
|
||||
{
|
||||
var builds = Build.SelectInBuildOrder().Take(20);
|
||||
|
||||
|
@ -49,7 +49,7 @@ public async Task<ActionResult> Index()
|
|||
return new EmptyResult();
|
||||
}
|
||||
|
||||
public async Task<ActionResult> Added()
|
||||
public async Task<ActionResult> added()
|
||||
{
|
||||
var builds = Build.Select().OrderByDescending(b => b.Added).Take(20);
|
||||
|
||||
|
@ -83,7 +83,7 @@ public async Task<ActionResult> Added()
|
|||
}
|
||||
|
||||
|
||||
public async Task<ActionResult> Version()
|
||||
public async Task<ActionResult> version()
|
||||
{
|
||||
var builds = Build.Select()
|
||||
.OrderByDescending(b => b.MajorVersion)
|
||||
|
@ -121,5 +121,41 @@ public async Task<ActionResult> Version()
|
|||
|
||||
return new EmptyResult();
|
||||
}
|
||||
|
||||
|
||||
public async Task<ActionResult> flight(LevelOfFlight id)
|
||||
{
|
||||
var builds = Build.SelectInBuildOrder()
|
||||
.Where(b => b.FlightLevel == id)
|
||||
.Take(20);
|
||||
|
||||
|
||||
RssDocument rdoc = new RssDocument()
|
||||
{
|
||||
Channel = new RssChannel()
|
||||
{
|
||||
Title = string.Format("BuildFeed RSS - {0} Flight Level", id),
|
||||
Description = "",
|
||||
Generator = "BuildFeed.net RSS Controller",
|
||||
Link = new RssUrl(string.Format("{0}://{1}", Request.Url.Scheme, Request.Url.Authority)),
|
||||
SkipHours = new List<Hour>(),
|
||||
SkipDays = new List<Day>(),
|
||||
|
||||
Items = (from build in builds
|
||||
select new RssItem()
|
||||
{
|
||||
Title = build.FullBuildString,
|
||||
Link = new RssUrl(string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Action("Info", new { controller = "Build", id = build.Id }))),
|
||||
Guid = new RssGuid() { IsPermaLink = true, Value = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Action("Info", new { controller = "Build", id = build.Id })) },
|
||||
}).ToList()
|
||||
}
|
||||
};
|
||||
|
||||
Response.ContentType = "application/rss+xml";
|
||||
|
||||
await Response.Output.WriteAsync(rdoc.ToXml());
|
||||
|
||||
return new EmptyResult();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -111,5 +111,10 @@ public ActionResult thanks_register()
|
|||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult rss()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -265,7 +265,7 @@ public enum LevelOfFlight
|
|||
{
|
||||
None = 0,
|
||||
Low = 1,
|
||||
Medium = 2,
|
||||
//Medium = 2, - medium only ever appears to return the same as high atm, may change in future.
|
||||
High = 3
|
||||
}
|
||||
|
||||
|
|
|
@ -37,9 +37,7 @@
|
|||
<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("Index", new { controller = "rss", area = "" })" title="Recently compiled"><i class="fa fa-2x fa-rss"></i></a>
|
||||
<a href="@Url.Action("Added", new { controller = "rss", area = "" })" title="Recently added to BuildFeed"><i class="fa fa-2x fa-rss"></i></a>
|
||||
<a href="@Url.Action("Version", new { controller = "rss", area = "" })" title="Highest version"><i class="fa fa-2x fa-rss"></i></a>
|
||||
<a href="@Url.Action("rss", new { controller = "support", area = "" })" title="RSS Feeds"><i class="fa fa-2x fa-rss"></i></a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
18
Views/support/rss.cshtml
Normal file
18
Views/support/rss.cshtml
Normal file
|
@ -0,0 +1,18 @@
|
|||
@{
|
||||
ViewBag.Title = "RSS Feeds";
|
||||
}
|
||||
|
||||
<h2>RSS Feeds</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="@Url.Action("index", new { controller = "rss" })" title="Recently compiled"><i class="fa fa-sm fa-rss"></i> Recently compiled</a></li>
|
||||
<li><a href="@Url.Action("added", new { controller = "rss" })" title="Recently added to BuildFeed"><i class="fa fa-sm fa-rss"></i> Recently added to BuildFeed</a></li>
|
||||
<li><a href="@Url.Action("version", new { controller = "rss" })" title="Highest version"><i class="fa fa-sm fa-rss"></i> Highest version</a></li>
|
||||
<li>
|
||||
Flight levels
|
||||
<ul>
|
||||
<li><a href="@Url.Action("flight", new { controller = "rss", id = "low" })" title="Low flight level"><i class="fa fa-sm fa-rss"></i> Low flight level</a></li>
|
||||
<li><a href="@Url.Action("flight", new { controller = "rss", id = "high" })" title="High flight level"><i class="fa fa-sm fa-rss"></i> High flight level</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Antlr" version="3.5.0.2" targetFramework="net45" />
|
||||
<package id="elmah.corelibrary" version="1.2.1" targetFramework="net45" />
|
||||
<package id="elmah.corelibrary" version="1.2.2" targetFramework="net45" />
|
||||
<package id="Elmah.MVC" version="2.1.1" targetFramework="net45" />
|
||||
<package id="jQuery" version="2.1.1" targetFramework="net45" />
|
||||
<package id="jQuery.Validation" version="1.13.0" targetFramework="net45" />
|
||||
|
@ -16,7 +16,7 @@
|
|||
<package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.2" targetFramework="net45" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="6.0.5" targetFramework="net45" />
|
||||
<package id="NServiceKit.Common" version="1.0.11" targetFramework="net45" />
|
||||
<package id="NServiceKit.Common" version="1.0.27" targetFramework="net45" />
|
||||
<package id="NServiceKit.Redis" version="1.0.7" targetFramework="net45" />
|
||||
<package id="NServiceKit.Text" version="1.0.10" targetFramework="net45" />
|
||||
<package id="routedebugger" version="2.1.4.0" targetFramework="net45" />
|
||||
|
|
Loading…
Reference in New Issue
Block a user