Flight level RSS, RSS feeds page, other tweaks.

This commit is contained in:
Thomas Hounsell 2014-10-21 13:53:27 +01:00
parent 3f92d62b8f
commit c625bc2a05
10 changed files with 90 additions and 34 deletions

View File

@ -76,10 +76,16 @@ public static void RegisterRoutes(RouteCollection routes)
defaults: new { controller = "Build", action = "Source", page = 1 } 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( routes.MapRoute(
name: "RSS", name: "RSS",
url: "rss/{action}", url: "rss/{action}",
defaults: new { controller = "rss", action = "Index" } defaults: new { controller = "rss", action = "index" }
); );
routes.MapRoute( routes.MapRoute(

View File

@ -44,8 +44,9 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath> <HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
</Reference> </Reference>
<Reference Include="Elmah"> <Reference Include="Elmah, Version=1.2.14706.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\elmah.corelibrary.1.2.1\lib\Elmah.dll</HintPath> <SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\elmah.corelibrary.1.2.2\lib\Elmah.dll</HintPath>
</Reference> </Reference>
<Reference Include="Elmah.Mvc"> <Reference Include="Elmah.Mvc">
<HintPath>..\packages\Elmah.MVC.2.1.1\lib\net40\Elmah.Mvc.dll</HintPath> <HintPath>..\packages\Elmah.MVC.2.1.1\lib\net40\Elmah.Mvc.dll</HintPath>
@ -55,11 +56,13 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.6.0.5\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.6.0.5\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="NServiceKit.Common"> <Reference Include="NServiceKit.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\NServiceKit.Common.1.0.11\lib\net35\NServiceKit.Common.dll</HintPath> <SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\NServiceKit.Common.1.0.27\lib\net35\NServiceKit.Common.dll</HintPath>
</Reference> </Reference>
<Reference Include="NServiceKit.Interfaces"> <Reference Include="NServiceKit.Interfaces, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\NServiceKit.Common.1.0.11\lib\net35\NServiceKit.Interfaces.dll</HintPath> <SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\NServiceKit.Common.1.0.27\lib\net35\NServiceKit.Interfaces.dll</HintPath>
</Reference> </Reference>
<Reference Include="NServiceKit.Redis"> <Reference Include="NServiceKit.Redis">
<HintPath>..\packages\NServiceKit.Redis.1.0.7\lib\net35\NServiceKit.Redis.dll</HintPath> <HintPath>..\packages\NServiceKit.Redis.1.0.7\lib\net35\NServiceKit.Redis.dll</HintPath>
@ -152,7 +155,6 @@
<Compile Include="Auth\RedisMembershipProvider.cs" /> <Compile Include="Auth\RedisMembershipProvider.cs" />
<Compile Include="Controllers\apiController.cs" /> <Compile Include="Controllers\apiController.cs" />
<Compile Include="Controllers\buildController.cs" /> <Compile Include="Controllers\buildController.cs" />
<Compile Include="Controllers\pageController.cs" />
<Compile Include="Controllers\rssController.cs" /> <Compile Include="Controllers\rssController.cs" />
<Compile Include="Controllers\supportController.cs" /> <Compile Include="Controllers\supportController.cs" />
<Compile Include="Global.asax.cs"> <Compile Include="Global.asax.cs">
@ -211,6 +213,7 @@
<Content Include="Views\build\info.cshtml" /> <Content Include="Views\build\info.cshtml" />
<Content Include="Views\support\password.cshtml" /> <Content Include="Views\support\password.cshtml" />
<Content Include="Views\support\thanks_register.cshtml" /> <Content Include="Views\support\thanks_register.cshtml" />
<Content Include="Views\support\rss.cshtml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="App_Data\" /> <Folder Include="App_Data\" />

View File

@ -75,6 +75,12 @@ public ActionResult Source(TypeOfSource source, int page = 1)
public ActionResult Info(int id) public ActionResult Info(int id)
{ {
Build b = Build.SelectById(id); Build b = Build.SelectById(id);
if(b == null)
{
return new HttpNotFoundResult();
}
return View(b); return View(b);
} }

View File

@ -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);
}
}
}

View File

@ -17,7 +17,7 @@ public class rssController : Controller
{ {
// //
// GET: /rss/ // GET: /rss/
public async Task<ActionResult> Index() public async Task<ActionResult> index()
{ {
var builds = Build.SelectInBuildOrder().Take(20); var builds = Build.SelectInBuildOrder().Take(20);
@ -49,7 +49,7 @@ public async Task<ActionResult> Index()
return new EmptyResult(); return new EmptyResult();
} }
public async Task<ActionResult> Added() public async Task<ActionResult> added()
{ {
var builds = Build.Select().OrderByDescending(b => b.Added).Take(20); 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() var builds = Build.Select()
.OrderByDescending(b => b.MajorVersion) .OrderByDescending(b => b.MajorVersion)
@ -121,5 +121,41 @@ public async Task<ActionResult> Version()
return new EmptyResult(); 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();
}
} }
} }

View File

@ -111,5 +111,10 @@ public ActionResult thanks_register()
{ {
return View(); return View();
} }
public ActionResult rss()
{
return View();
}
} }
} }

View File

@ -265,7 +265,7 @@ public enum LevelOfFlight
{ {
None = 0, None = 0,
Low = 1, Low = 1,
Medium = 2, //Medium = 2, - medium only ever appears to return the same as high atm, may change in future.
High = 3 High = 3
} }

View File

@ -37,9 +37,7 @@
<div class="col-sm-3 text-right"> <div class="col-sm-3 text-right">
<p class="social-links"> <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="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("rss", new { controller = "support", area = "" })" title="RSS Feeds"><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>
</p> </p>
</div> </div>
</div> </div>

18
Views/support/rss.cshtml Normal file
View 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>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Antlr" version="3.5.0.2" targetFramework="net45" /> <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="Elmah.MVC" version="2.1.1" targetFramework="net45" />
<package id="jQuery" 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" /> <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.jQuery.Unobtrusive.Validation" version="3.2.2" targetFramework="net45" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" 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="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.Redis" version="1.0.7" targetFramework="net45" />
<package id="NServiceKit.Text" version="1.0.10" targetFramework="net45" /> <package id="NServiceKit.Text" version="1.0.10" targetFramework="net45" />
<package id="routedebugger" version="2.1.4.0" targetFramework="net45" /> <package id="routedebugger" version="2.1.4.0" targetFramework="net45" />