BuildFeed/Views/build/index.cshtml
Thomas Hounsell 9adeff488b Typo fix
2015-02-23 19:53:46 +00:00

210 lines
9.9 KiB
Plaintext

@model IEnumerable<BuildFeed.Models.Build>
@{
ViewBag.Action = ViewContext.Controller.ValueProvider.GetValue("action").RawValue.ToString().ToLower();
ViewBag.Title = "BuildFeed";
if (ViewBag.PageNumber > 1)
{
ViewBag.Title = string.Format("Page {1} | {0}", ViewBag.Title, ViewBag.PageNumber);
}
switch (ViewBag.Action as string)
{
case "index":
ViewBag.Title = "BuildFeed | The collaborative build list";
break;
case "lab":
ViewBag.ItemId = ViewContext.Controller.ValueProvider.GetValue("lab").RawValue;
ViewBag.Title = string.Format("Builds from {1} | {0}", ViewBag.Title, ViewBag.ItemId);
break;
case "year":
ViewBag.ItemId = ViewContext.Controller.ValueProvider.GetValue("year").RawValue;
ViewBag.Title = string.Format("Builds from {1} | {0}", ViewBag.Title, ViewBag.ItemId);
break;
case "version":
ViewBag.ItemId = string.Format("{0}.{1}", ViewContext.Controller.ValueProvider.GetValue("major").RawValue, ViewContext.Controller.ValueProvider.GetValue("minor").RawValue);
ViewBag.Title = string.Format("Windows NT {1} | {0}", ViewBag.Title, ViewBag.ItemId);
break;
case "source":
ViewBag.ItemId = DisplayHelpers.GetDisplayTextForEnum(Enum.Parse(typeof(BuildFeed.Models.TypeOfSource), ViewContext.Controller.ValueProvider.GetValue("source").RawValue.ToString()));
ViewBag.Title = string.Format("{1} | {0}", ViewBag.Title, ViewBag.ItemId);
break;
}
}
@section head
{
@switch (ViewBag.Action as string)
{
case "index":
<meta name="description" content="BuildFeed is a collaborative build list for Microsoft Windows. Keep up to date with the latest Windows 10 builds or take a peek at the list back to 2000" />
<meta property="og:description" content="BuildFeed is a collaborative build list for Microsoft Windows. Keep up to date with the latest Windows 10 builds or take a peek at the list back to 2000" />
break;
case "lab":
if (ViewBag.MetaItem != null)
{
<meta name="description" content="@ViewBag.MetaItem.MetaDescription" />
<meta property="og:description" content="@ViewBag.MetaItem.MetaDescription" />
}
else
{
<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" />
}
break;
case "year":
<meta name="description" content="View a list of all Windows builds compiled in @ViewBag.ViewId, and watch how Windows developed steadily over time, through the collaborative build list, BuildFeed" />
<meta property="og:description" content="View a list of all Windows builds compiled in @ViewBag.ViewId, and watch how Windows developed steadily over time, through the collaborative build list, BuildFeed" />
break;
}
}
<div class="row">
<div class="col-sm-9">
@switch (ViewBag.Action as string)
{
case "lab":
<h2>@string.Format("Builds from {0}", ViewBag.ItemId)</h2>
break;
case "year":
<h2>@string.Format("Builds from {0}", ViewBag.ItemId)</h2>
break;
case "version":
<h2>@string.Format("Windows NT {0}", ViewBag.ItemId)</h2>
break;
case "source":
<h2>@ViewBag.ItemId</h2>
break;
}
@if (ViewBag.PageNumber == 1 && ViewBag.MetaItem != null && !string.IsNullOrWhiteSpace(ViewBag.MetaItem.PageContent))
{
<h3>About</h3>
@Html.Raw(ViewBag.MetaItem.PageContent)
<h3>Share</h3>
<div class="addthis_sharing_toolbox"></div>
<h3>Listing</h3>
}
<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.MajorVersion == 6 && item.MinorVersion == 4) || (item.MajorVersion == 10 && item.MinorVersion == 0) && 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>
@if (ViewBag.Action != "index")
{
<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" })
}
@Html.ActionLink("Ask a question", "question", 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("&laquo;"), ViewContext.Controller.ValueProvider.GetValue("action").RawValue.ToString(), new { page = ViewBag.PageNumber - 1 })</li>
}
else
{
<li class="disabled"><span>&laquo;</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("&raquo;"), ViewBag.Action as string, new { page = ViewBag.PageNumber + 1 })</li>
}
else
{
<li class="disabled"><span>&raquo;</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>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5431719a661cbfd0" async="async"></script>
}