mirror of
https://gitlab.com/buildfeed/BuildFeed.git
synced 2024-03-22 21:10:34 +08:00
Minor display changes, more meta groundwork
Also page size increased from 15 to 20.
This commit is contained in:
parent
bb5808a76b
commit
6b71adab4d
|
@ -196,7 +196,7 @@
|
|||
</Compile>
|
||||
<Compile Include="Models\ApiModel\SearchResult.cs" />
|
||||
<Compile Include="Models\Build.cs" />
|
||||
<Compile Include="Models\LabMeta.cs" />
|
||||
<Compile Include="Models\MetaItem.cs" />
|
||||
<Compile Include="Models\ViewModel\LoginUser.cs" />
|
||||
<Compile Include="Models\ViewModel\ChangePassword.cs" />
|
||||
<Compile Include="Models\ViewModel\RegistrationUser.cs" />
|
||||
|
@ -293,7 +293,6 @@
|
|||
<Content Include="Views\support\rss.cshtml" />
|
||||
<Content Include="Views\support\sitemap.cshtml" />
|
||||
<Content Include="Scripts\jsrender.min.js.map" />
|
||||
<Content Include="Views\build\lab.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace BuildFeed.Controllers
|
|||
{
|
||||
public class buildController : Controller
|
||||
{
|
||||
public static int pageSize { get { return 15; } }
|
||||
public static int pageSize { get { return 20; } }
|
||||
//
|
||||
// GET: /build/
|
||||
|
||||
|
|
|
@ -1,25 +1,22 @@
|
|||
using BuildFeed;
|
||||
using NServiceKit.DataAnnotations;
|
||||
using NServiceKit.DataAnnotations;
|
||||
using NServiceKit.DesignPatterns.Model;
|
||||
using NServiceKit.Redis;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Required = System.ComponentModel.DataAnnotations.RequiredAttribute;
|
||||
|
||||
namespace BuildFeed.Models
|
||||
{
|
||||
[DataObject]
|
||||
public class LabMeta : IHasId<string>
|
||||
public class MetaItem : IHasId<MetaItemKey>
|
||||
{
|
||||
[Key]
|
||||
[Index]
|
||||
[@Required]
|
||||
public string Id { get; set; }
|
||||
public MetaItemKey Id { get; set; }
|
||||
|
||||
[DisplayName("Page Content")]
|
||||
[AllowHtml]
|
||||
|
@ -31,21 +28,21 @@ public class LabMeta : IHasId<string>
|
|||
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, true)]
|
||||
public static IEnumerable<LabMeta> Select()
|
||||
public static IEnumerable<MetaItem> Select()
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<LabMeta>();
|
||||
var client = rClient.As<MetaItem>();
|
||||
return client.GetAll();
|
||||
}
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select, false)]
|
||||
public static LabMeta SelectById(string id)
|
||||
public static MetaItem SelectById(MetaItemKey id)
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<LabMeta>();
|
||||
var client = rClient.As<MetaItem>();
|
||||
return client.GetById(id);
|
||||
}
|
||||
}
|
||||
|
@ -56,43 +53,45 @@ public static IEnumerable<string> SelectUnusedLabs()
|
|||
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<LabMeta>();
|
||||
var client = rClient.As<MetaItem>();
|
||||
var labs = Build.SelectBuildLabs();
|
||||
|
||||
var usedLabs = client.GetAll();
|
||||
var usedLabs = from u in client.GetAll()
|
||||
where u.Id.Type == MetaType.Lab
|
||||
select u;
|
||||
|
||||
return from l in labs
|
||||
where !usedLabs.Any(ul => ul.Id == l)
|
||||
where !usedLabs.Any(ul => ul.Id.Value as string == l)
|
||||
select l;
|
||||
}
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Insert, true)]
|
||||
public static void Insert(LabMeta item)
|
||||
public static void Insert(MetaItem item)
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<LabMeta>();
|
||||
var client = rClient.As<MetaItem>();
|
||||
client.Store(item);
|
||||
}
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Update, true)]
|
||||
public static void Update(LabMeta item)
|
||||
public static void Update(MetaItem item)
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<LabMeta>();
|
||||
var client = rClient.As<MetaItem>();
|
||||
client.Store(item);
|
||||
}
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Insert, false)]
|
||||
public static void InsertAll(IEnumerable<LabMeta> items)
|
||||
public static void InsertAll(IEnumerable<MetaItem> items)
|
||||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<LabMeta>();
|
||||
var client = rClient.As<MetaItem>();
|
||||
client.StoreAll(items);
|
||||
}
|
||||
}
|
||||
|
@ -102,9 +101,22 @@ public static void DeleteById(long id)
|
|||
{
|
||||
using (RedisClient rClient = new RedisClient(DatabaseConfig.Host, DatabaseConfig.Port, db: DatabaseConfig.Database))
|
||||
{
|
||||
var client = rClient.As<LabMeta>();
|
||||
var client = rClient.As<MetaItem>();
|
||||
client.DeleteById(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public struct MetaItemKey
|
||||
{
|
||||
public object Value { get; set; }
|
||||
public MetaType Type { get; set; }
|
||||
}
|
||||
|
||||
public enum MetaType
|
||||
{
|
||||
Lab,
|
||||
Version,
|
||||
Source
|
||||
}
|
||||
}
|
|
@ -6,12 +6,12 @@
|
|||
|
||||
@section head
|
||||
{
|
||||
<meta name="description" content="@Model.FullBuildString. @Model.SourceDetails" />
|
||||
<meta name="description" content="@Model.FullBuildString" />
|
||||
<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:description" content="@Model.FullBuildString, via BuildFeed." />
|
||||
<!--<meta property="og:image" content="" />-->
|
||||
}
|
||||
|
||||
|
@ -65,21 +65,34 @@
|
|||
<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.ActionLink(Model.Lab, "lab", new { lab = Model.Lab })</p>
|
||||
<p class="form-control-static">
|
||||
@Model.Lab<br />
|
||||
<a href="@Url.Action("lab", new { lab = Model.Lab })" class="more-link"><i class="fa fa-plus-square-o fa-sm"></i> Find more builds from @Model.Lab</a>
|
||||
</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>
|
||||
<p class="form-control-static">
|
||||
@Html.DisplayFor(model => model.BuildTime, "{0:yyMMdd-HHmm}")
|
||||
@if (Model.BuildTime.HasValue)
|
||||
{
|
||||
<br />
|
||||
<a href="@Url.Action("year", new { year = Model.BuildTime.Value.Year })" class="more-link"><i class="fa fa-plus-square-o fa-sm"></i> Find more builds compiled in @Model.BuildTime.Value.Year</a>
|
||||
}
|
||||
</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>
|
||||
<p class="form-control-static">
|
||||
@Html.DisplayFor(model => model.SourceType, "Enumeration")<br />
|
||||
<a href="@Url.Action("source", new { source = Model.SourceType })" class="more-link"><i class="fa fa-plus-square-o fa-sm"></i> Find more builds sourced from @Html.DisplayFor(model => model.SourceType, "Enumeration")</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -90,7 +103,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
@if ( (Model.MajorVersion == 6 && Model.MinorVersion == 4) || (Model.MajorVersion == 10 && Model.MinorVersion == 0) && Model.FlightLevel != BuildFeed.Models.LevelOfFlight.None)
|
||||
@if ((Model.MajorVersion == 6 && Model.MinorVersion == 4) || (Model.MajorVersion == 10 && Model.MinorVersion == 0) && Model.FlightLevel != BuildFeed.Models.LevelOfFlight.None)
|
||||
{
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.FlightLevel, new { @class = "control-label col-sm-2" })
|
||||
|
|
|
@ -1,140 +0,0 @@
|
|||
@model IEnumerable<BuildFeed.Models.Build>
|
||||
|
||||
@{
|
||||
ViewBag.Title = "BuildFeed";
|
||||
|
||||
|
||||
if (ViewBag.PageNumber > 1)
|
||||
{
|
||||
ViewBag.Title = string.Format("Page {1} | {0}", ViewBag.Title, ViewBag.PageNumber);
|
||||
}
|
||||
|
||||
ViewBag.ItemId = ViewContext.Controller.ValueProvider.GetValue("lab").RawValue;
|
||||
ViewBag.Title = string.Format("Builds from {1} | {0}", ViewBag.Title, ViewBag.ItemId);
|
||||
}
|
||||
|
||||
@section head
|
||||
{
|
||||
<meta name="description" content="Check out all the known builds to come out of the Windows development lab @ViewBag.ItemId through BuildFeed, a collaborative Windows build list" />
|
||||
<meta property="og:description" content="Check out all the known builds to come out of the Windows development lab @ViewBag.ItemId through BuildFeed, a collaborative Windows build list" />
|
||||
}
|
||||
|
||||
<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 (Roles.IsUserInRole("Administrators"))
|
||||
{
|
||||
@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 panel-default panel-search">
|
||||
<div class="panel-body">
|
||||
@Html.TextBox("search-input", "", new { @class = "form-control" })
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-group">
|
||||
@Html.ActionLink("Return to full listing", "index", new { controller = "build", area = "", page = 1 }, new { @class = "list-group-item" })
|
||||
</div>
|
||||
<div class="list-group">
|
||||
@if (User.Identity.IsAuthenticated)
|
||||
{
|
||||
if (Roles.IsUserInRole("Administrators"))
|
||||
{
|
||||
@Html.ActionLink("Administration", "index", new { controller = "base", area = "admin" }, new { @class = "list-group-item" })
|
||||
}
|
||||
@Html.ActionLink("Add a build", "create", new { controller = "build" }, new { @class = "list-group-item" })
|
||||
@Html.ActionLink("Change your password", "password", new { controller = "support" }, new { @class = "list-group-item" })
|
||||
@Html.ActionLink("Log out", "logout", new { controller = "support" }, new { @class = "list-group-item" })
|
||||
}
|
||||
else
|
||||
{
|
||||
@Html.ActionLink("Log in", "login", new { controller = "support" }, new { @class = "list-group-item" })
|
||||
@Html.ActionLink("Register", "register", new { controller = "support" }, new { @class = "list-group-item" })
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (ViewBag.PageCount > 1)
|
||||
{
|
||||
<ul class="pagination">
|
||||
@if (ViewBag.PageNumber > 1)
|
||||
{
|
||||
<li>@Html.ActionLink(HttpUtility.HtmlDecode("«"), ViewContext.Controller.ValueProvider.GetValue("action").RawValue.ToString(), new { page = ViewBag.PageNumber - 1 })</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li class="disabled"><span>«</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("»"), ViewBag.Action as string, new { page = ViewBag.PageNumber + 1 })</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li class="disabled"><span>»</span></li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
|
||||
@section scripts
|
||||
{
|
||||
@Scripts.Render("~/bundles/jsrender")
|
||||
<script type="text/javascript" src="~/Scripts/bfs.js"></script>
|
||||
<script id="result-template" type="text/x-jsrender">
|
||||
<a href="{{:Url}}" class="list-group-item" title="{{:Title}}">
|
||||
<h4 class="list-group-item-heading">{{:Label}}</h4>
|
||||
<p class="list-group-item-text">{{:Group}}</p>
|
||||
</a>
|
||||
</script>
|
||||
}
|
|
@ -73,6 +73,28 @@ li:last-child .build-foot
|
|||
margin-right: 0.12em;
|
||||
}
|
||||
|
||||
.more-link
|
||||
{
|
||||
display: inline-block;
|
||||
font-size: 13px;
|
||||
vertical-align: 1px;
|
||||
border-bottom: 1px dashed #41c0e5;
|
||||
color: #31b0d5;
|
||||
}
|
||||
|
||||
.more-link .fa-sm
|
||||
{
|
||||
font-size: 11px;
|
||||
vertical-align: 0px;
|
||||
}
|
||||
|
||||
.more-link:hover
|
||||
{
|
||||
color: #30829e;
|
||||
border-bottom-color: #50a2be;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.field-validation-error
|
||||
{
|
||||
color: #ff4136;
|
||||
|
@ -151,4 +173,4 @@ label, .control-label, .help-block, .checkbox, .radio
|
|||
{
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user