* added logo
* updated footer styles * paged the browse data
This commit is contained in:
parent
35d87ca794
commit
140b1d6bcc
@ -6,6 +6,7 @@ using Portoa.Persistence;
|
|||||||
using Portoa.Search;
|
using Portoa.Search;
|
||||||
using Portoa.Validation.DataAnnotations;
|
using Portoa.Validation.DataAnnotations;
|
||||||
using Portoa.Web.Controllers;
|
using Portoa.Web.Controllers;
|
||||||
|
using Portoa.Web.Models;
|
||||||
using Portoa.Web.Results;
|
using Portoa.Web.Results;
|
||||||
using Portoa.Web.Security;
|
using Portoa.Web.Security;
|
||||||
using VideoGameQuotes.Api;
|
using VideoGameQuotes.Api;
|
||||||
@ -25,15 +26,27 @@ namespace VideoGameQuotes.Web.Controllers {
|
|||||||
this.quoteSearcher = quoteSearcher;
|
this.quoteSearcher = quoteSearcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult Browse(BrowseModel model) {
|
public ActionResult Browse(BrowseModel model, int page = 1) {
|
||||||
|
if (page < 1) {
|
||||||
|
return new StatusOverrideResult(View("BadPaging")) { StatusCode = HttpStatusCode.BadRequest };
|
||||||
|
}
|
||||||
|
|
||||||
if (model.IsEmpty) {
|
if (model.IsEmpty) {
|
||||||
return View("DefaultBrowse");
|
return View("DefaultBrowse");
|
||||||
}
|
}
|
||||||
|
|
||||||
return View("QualifiedBrowse", new QualifiedBrowseModel(model) {
|
model.CurrentUser = currentUserProvider.CurrentUser;
|
||||||
Quotes = quoteService.GetBrowsableQuotes(model),
|
var pagingModel = new PagedModel<Quote> {
|
||||||
User = currentUserProvider.CurrentUser
|
CurrentPage = page,
|
||||||
});
|
PageSize = 10
|
||||||
|
};
|
||||||
|
|
||||||
|
int totalCount;
|
||||||
|
var quotes = quoteService.GetBrowsableQuotes(model, pagingModel.Start, pagingModel.End, out totalCount);
|
||||||
|
pagingModel.Records = quotes;
|
||||||
|
pagingModel.TotalCount = totalCount;
|
||||||
|
|
||||||
|
return View("QualifiedBrowse", new QualifiedBrowseModel(model) { PagedModel = pagingModel });
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost, VerifyUser]
|
[HttpPost, VerifyUser]
|
||||||
@ -86,7 +99,7 @@ namespace VideoGameQuotes.Web.Controllers {
|
|||||||
PageSize = pageSize
|
PageSize = pageSize
|
||||||
};
|
};
|
||||||
|
|
||||||
model.Records = quoteService.GetMostRecentQuotes(model.Start, model.End, out totalCount);
|
model.Records = quoteService.GetRecentQuotes(model.Start, model.End, out totalCount);
|
||||||
model.TotalCount = totalCount;
|
model.TotalCount = totalCount;
|
||||||
|
|
||||||
return View(model);
|
return View(model);
|
||||||
|
@ -77,7 +77,7 @@ namespace VideoGameQuotes.Web {
|
|||||||
routes.MapRoute("paged", "{action}/{page}", new { controller = "Quote", page = 1 }, new { action = "best|recent", page = @"\d+" });
|
routes.MapRoute("paged", "{action}/{page}", new { controller = "Quote", page = 1 }, new { action = "best|recent", page = @"\d+" });
|
||||||
routes.MapRoute("browse", "browse/{*qualifiers}", new { controller = "Quote", action = "Browse" });
|
routes.MapRoute("browse", "browse/{*qualifiers}", new { controller = "Quote", action = "Browse" });
|
||||||
routes.MapRoute("search", "search/{*searchQuery}", new { controller = "Quote", action = "Search" });
|
routes.MapRoute("search", "search/{*searchQuery}", new { controller = "Quote", action = "Search" });
|
||||||
routes.MapRoute("quote-task", "{action}/{id}", new { controller = "Quote" }, new { action = "edit|flags", id = @"\d+" });
|
routes.MapRoute("quote-task", "quote/{action}/{id}", new { controller = "Quote" }, new { action = "edit", id = @"\d+" });
|
||||||
routes.MapRoute("quote", "{action}", new { controller = "Quote" }, new { action = "submit|recent|random|vote|report" });
|
routes.MapRoute("quote", "{action}", new { controller = "Quote" }, new { action = "submit|recent|random|vote|report" });
|
||||||
routes.MapRoute("dismiss-flag", "dismiss-flag", new { controller = "Quote", action = "DismissFlag" });
|
routes.MapRoute("dismiss-flag", "dismiss-flag", new { controller = "Quote", action = "DismissFlag" });
|
||||||
routes.MapRoute("individual-quote", "quote/{id}/{*text}", new { controller = "Quote", action = "Quote" }, new { id = @"\d+" });
|
routes.MapRoute("individual-quote", "quote/{id}/{*text}", new { controller = "Quote", action = "Quote" }, new { id = @"\d+" });
|
||||||
|
@ -11,7 +11,7 @@ namespace VideoGameQuotes.Web.Models {
|
|||||||
PublisherIds = Enumerable.Empty<int>();
|
PublisherIds = Enumerable.Empty<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public User User { get; set; }
|
public User CurrentUser { get; set; }
|
||||||
|
|
||||||
public IEnumerable<int> GameIds { get; set; }
|
public IEnumerable<int> GameIds { get; set; }
|
||||||
public IEnumerable<int> SystemIds { get; set; }
|
public IEnumerable<int> SystemIds { get; set; }
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using Portoa.Web.Models;
|
||||||
using VideoGameQuotes.Api;
|
using VideoGameQuotes.Api;
|
||||||
|
|
||||||
namespace VideoGameQuotes.Web.Models {
|
namespace VideoGameQuotes.Web.Models {
|
||||||
@ -10,8 +10,9 @@ namespace VideoGameQuotes.Web.Models {
|
|||||||
SortMethod = model.SortMethod;
|
SortMethod = model.SortMethod;
|
||||||
SystemIds = model.SystemIds;
|
SystemIds = model.SystemIds;
|
||||||
SortOrder = model.SortOrder;
|
SortOrder = model.SortOrder;
|
||||||
|
CurrentUser = model.CurrentUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Quote> Quotes { get; set; }
|
public PagedModel<Quote> PagedModel { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -18,14 +18,12 @@ namespace VideoGameQuotes.Web.Services {
|
|||||||
Publisher GetPublisher(int id);
|
Publisher GetPublisher(int id);
|
||||||
GamingSystem GetSystem(int systemId);
|
GamingSystem GetSystem(int systemId);
|
||||||
Category GetCategory(int categoryId);
|
Category GetCategory(int categoryId);
|
||||||
Category SaveCategory(Category category);
|
IEnumerable<Quote> GetRecentQuotes(int start, int end, out int totalCount);
|
||||||
IEnumerable<Quote> GetMostRecentQuotes(int start, int end, out int totalCount);
|
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
Quote GetRandomQuote();
|
Quote GetRandomQuote();
|
||||||
IEnumerable<Quote> GetBestQuotes(int start, int end, out int totalCount);
|
IEnumerable<Quote> GetBestQuotes(int start, int end, out int totalCount);
|
||||||
Vote SaveVote(Vote vote);
|
|
||||||
Vote GetVoteOrCreateNew(Quote quote, User voter);
|
Vote GetVoteOrCreateNew(Quote quote, User voter);
|
||||||
IEnumerable<Quote> GetBrowsableQuotes(BrowseModel model);
|
IEnumerable<Quote> GetBrowsableQuotes(BrowseModel model, int start, int end, out int totalCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class QuoteService : IQuoteService {
|
public class QuoteService : IQuoteService {
|
||||||
@ -104,12 +102,7 @@ namespace VideoGameQuotes.Web.Services {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[UnitOfWork]
|
[UnitOfWork]
|
||||||
public Category SaveCategory(Category category) {
|
public IEnumerable<Quote> GetRecentQuotes(int start, int end, out int totalCount) {
|
||||||
return categoryRepository.Save(category);
|
|
||||||
}
|
|
||||||
|
|
||||||
[UnitOfWork]
|
|
||||||
public IEnumerable<Quote> GetMostRecentQuotes(int start, int end, out int totalCount) {
|
|
||||||
totalCount = quoteRepository.Records.Count();
|
totalCount = quoteRepository.Records.Count();
|
||||||
return quoteRepository
|
return quoteRepository
|
||||||
.Records
|
.Records
|
||||||
@ -143,11 +136,6 @@ namespace VideoGameQuotes.Web.Services {
|
|||||||
.Take(end - start + 1);
|
.Take(end - start + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[UnitOfWork]
|
|
||||||
public Vote SaveVote(Vote vote) {
|
|
||||||
return voteRepository.Save(vote);
|
|
||||||
}
|
|
||||||
|
|
||||||
[UnitOfWork]
|
[UnitOfWork]
|
||||||
public Vote GetVoteOrCreateNew(Quote quote, User voter) {
|
public Vote GetVoteOrCreateNew(Quote quote, User voter) {
|
||||||
var vote = voteRepository.Records.SingleOrDefault(v => v.Quote == quote && v.Voter == voter);
|
var vote = voteRepository.Records.SingleOrDefault(v => v.Quote == quote && v.Voter == voter);
|
||||||
@ -158,7 +146,7 @@ namespace VideoGameQuotes.Web.Services {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[UnitOfWork]
|
[UnitOfWork]
|
||||||
public IEnumerable<Quote> GetBrowsableQuotes(BrowseModel model) {
|
public IEnumerable<Quote> GetBrowsableQuotes(BrowseModel model, int start, int end, out int totalCount) {
|
||||||
var quotes = quoteRepository.Records;
|
var quotes = quoteRepository.Records;
|
||||||
if (model.GameIds.Any()) {
|
if (model.GameIds.Any()) {
|
||||||
quotes = quotes.Where(quote => model.GameIds.Contains(quote.Game.Id));
|
quotes = quotes.Where(quote => model.GameIds.Contains(quote.Game.Id));
|
||||||
@ -173,7 +161,8 @@ namespace VideoGameQuotes.Web.Services {
|
|||||||
quotes = quotes.Where(quote => quote.Categories.Any(category => model.CategoryIds.Contains(category.Id)));
|
quotes = quotes.Where(quote => quote.Categories.Any(category => model.CategoryIds.Contains(category.Id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return quotes;
|
totalCount = quotes.Count();
|
||||||
|
return quotes.Skip(start - 1).Take(end - start + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -150,9 +150,12 @@
|
|||||||
<Content Include="media\images\delete.png" />
|
<Content Include="media\images\delete.png" />
|
||||||
<Content Include="media\images\error.png" />
|
<Content Include="media\images\error.png" />
|
||||||
<Content Include="media\images\favicon.png" />
|
<Content Include="media\images\favicon.png" />
|
||||||
|
<Content Include="media\images\flag_red.png" />
|
||||||
|
<Content Include="media\images\link.png" />
|
||||||
<Content Include="media\images\loading.gif" />
|
<Content Include="media\images\loading.gif" />
|
||||||
<Content Include="media\images\pencil.png" />
|
<Content Include="media\images\pencil.png" />
|
||||||
<Content Include="media\images\search.png" />
|
<Content Include="media\images\search.png" />
|
||||||
|
<Content Include="media\images\vgquotes.png" />
|
||||||
<Content Include="media\js\jquery.cookie.js" />
|
<Content Include="media\js\jquery.cookie.js" />
|
||||||
<Content Include="media\js\quoteform.js" />
|
<Content Include="media\js\quoteform.js" />
|
||||||
<Content Include="media\js\vgquotes.js" />
|
<Content Include="media\js\vgquotes.js" />
|
||||||
|
@ -5,21 +5,22 @@
|
|||||||
<h2>Welcome</h2>
|
<h2>Welcome</h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Welcome to <strong>Video Game Quotes</strong>. You can <%= Html.ActionLink("browse", "index", "quote") %>,
|
Welcome to <strong>Video Game Quotes</strong>. You can <%= Html.ActionLink("browse", "browse", "quote") %>,
|
||||||
<%= Html.ActionLink("rate", "best", "quote") %> and <%= Html.ActionLink("submit", "submit", "quote") %>
|
<%= Html.ActionLink("rate", "best", "quote") %> and <%= Html.ActionLink("submit", "submit", "quote") %>
|
||||||
quotes from video games. You do not need to register or login (in fact, you aren't allowed to)
|
quotes from video games. You do not need to register or login to perform any of these tasks.
|
||||||
to perform any of these tasks. Participation is encouraged.
|
Participation is encouraged.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
If you see a quote that is inaccurate, fake, spelled wrong, spam or you're just straight up
|
If you see a quote that is inaccurate, fake, spelled wrong, spam or you’re just straight up
|
||||||
concerned about it, please use the <em>report</em> link near the quote in question. It won't
|
concerned about it, please flag (<span class="quote-flag-link" title="click on one of these things"></span>)
|
||||||
be removed immediately, but it will be flagged for review by our crack team of administrators (i.e. me).
|
the quote in question. It won’t be removed immediately, but it will be flagged for review by our
|
||||||
|
crack team of administrators (i.e. me).
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
If you have ideas to make this place suck less, or if you just want to express your admiration
|
If you have ideas to make this place suck less, or if you just want to express your admiration
|
||||||
for its creator (i.e. me), don't hesitate to contact him (i.e. me) using the
|
for its creator (i.e. me), don’t hesitate to contact him (i.e. me) using the
|
||||||
<%= Html.ActionLink("contact", "contact", "home") %> form.
|
<%= Html.ActionLink("contact", "contact", "home") %> form.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Portoa.Web.Models.PagingMenuModel>" %>
|
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Portoa.Web.Models.PagingMenuModel>" %>
|
||||||
|
|
||||||
<% if (!Model.HasNext && !Model.HasPrevious) { return; } %>
|
<% if (!Model.ShouldShowMenu) { return; } %>
|
||||||
|
|
||||||
<div class="paging-menu">
|
<div class="paging-menu">
|
||||||
<ul class="menu clearfix">
|
<ul class="menu clearfix">
|
||||||
@ -10,6 +10,10 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Showing <strong><%= Model.Start %>—<%= Model.ActualEnd %></strong> of <strong><%= Model.TotalCount %></strong>.
|
<% if (Model.CurrentPageIsValid) { %>
|
||||||
|
Showing <strong><%= Model.Start%>—<%= Model.ActualEnd%></strong> of <strong><%= Model.TotalCount%></strong>.
|
||||||
|
<% } else { %>
|
||||||
|
Nothing to show of <strong><%= Model.TotalCount%></strong>.
|
||||||
|
<% } %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
@ -1,15 +1,18 @@
|
|||||||
<%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage<VideoGameQuotes.Web.Models.QualifiedBrowseModel>" MasterPageFile="~/Views/Shared/Site.Master" %>
|
<%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage<QualifiedBrowseModel>" MasterPageFile="~/Views/Shared/Site.Master" %>
|
||||||
|
<%@ Import Namespace="Portoa.Web.Models" %>
|
||||||
<%@ Import Namespace="VideoGameQuotes.Web.Models" %>
|
<%@ Import Namespace="VideoGameQuotes.Web.Models" %>
|
||||||
<asp:Content runat="server" ID="Title" ContentPlaceHolderID="TitleContent">Browse</asp:Content>
|
<asp:Content runat="server" ID="Title" ContentPlaceHolderID="TitleContent">Browse</asp:Content>
|
||||||
|
|
||||||
<asp:Content runat="server" ID="Main" ContentPlaceHolderID="MainContent">
|
<asp:Content runat="server" ID="Main" ContentPlaceHolderID="MainContent">
|
||||||
<p>
|
<% Html.RenderPartial("PagingMenu", new PagingMenuModel(Model.PagedModel)); %>
|
||||||
Here are some quotes
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<%
|
<%
|
||||||
foreach (var quote in Model.Quotes) {
|
if (Model.PagedModel.TotalCount > 0) {
|
||||||
Html.RenderPartial("SingleQuote", new QuoteModel { Quote = quote, User = Model.User });
|
foreach (var quote in Model.PagedModel.Records) {
|
||||||
}
|
Html.RenderPartial("SingleQuote", new QuoteModel { Quote = quote, User = Model.CurrentUser });
|
||||||
|
}
|
||||||
|
} else { %>
|
||||||
|
<p>No quotes found.</p>
|
||||||
|
<% }
|
||||||
%>
|
%>
|
||||||
</asp:Content>
|
</asp:Content>
|
@ -17,7 +17,7 @@
|
|||||||
<div id="header">
|
<div id="header">
|
||||||
<div class="content-container">
|
<div class="content-container">
|
||||||
<div id="logo">
|
<div id="logo">
|
||||||
<h1><%= Html.ActionLink("Video Game Quotes", "Index", "Home") %></h1>
|
<h1 class="mir"><%= Html.ActionLink("Video Game Quotes", "Index", "Home", null, new { title = "Video Game Quotes" })%></h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="main-menu">
|
<div id="main-menu">
|
||||||
@ -35,14 +35,14 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
<div class="content-container">
|
<p>
|
||||||
© <%= DateTime.UtcNow.Year %> <a href="http://tommymontgomery.com/" title="Who is this man?">Tommy Montgomery</a><br />
|
© <%= DateTime.UtcNow.Year %> <a href="http://tommymontgomery.com/" title="Who is this man?">Tommy Montgomery</a><br />
|
||||||
<% if (!Request.IsAuthenticated) { %>
|
<% if (!Request.IsAuthenticated) { %>
|
||||||
<a href="#" id="login-link">login</a>
|
<a href="#" id="login-link">login</a>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<%= Html.ActionLink("logout", "logout", "home", new { redirectUrl = Request.Path }, null)%>
|
<%= Html.ActionLink("logout", "logout", "home", new { redirectUrl = Request.Path }, null)%>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
body {
|
html {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
body {
|
||||||
background-color: #EEEEEE;
|
background-color: #EEEEEE;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
font-family: Calibri, Corbel, Helvetica, Arial;
|
font-family: Calibri, Corbel, Helvetica, Arial;
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 5em;
|
font-size: 5em;
|
||||||
@ -210,6 +214,11 @@ ul.menu {
|
|||||||
#logo a {
|
#logo a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
|
height: 125px;
|
||||||
|
display: block;
|
||||||
|
background-image: url(/media/images/vgquotes.png);
|
||||||
|
background-position: center center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
#login-dialog {
|
#login-dialog {
|
||||||
@ -220,8 +229,13 @@ ul.menu {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
#header {
|
#wrapper {
|
||||||
background-color: #669966;
|
min-height: 100%;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header, #footer {
|
||||||
|
background-color: #889988;
|
||||||
}
|
}
|
||||||
|
|
||||||
#main-menu li {
|
#main-menu li {
|
||||||
@ -242,7 +256,7 @@ ul.menu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#main {
|
#main {
|
||||||
padding: 20px;
|
padding: 20px 20px 100px 20px;
|
||||||
}
|
}
|
||||||
#main a {
|
#main a {
|
||||||
color: #669966;
|
color: #669966;
|
||||||
@ -274,10 +288,14 @@ ul.menu {
|
|||||||
#footer {
|
#footer {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 75%;
|
font-size: 75%;
|
||||||
color: #999999;
|
color: #FFFFFF;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
height: 100px;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
#footer a {
|
#footer a {
|
||||||
color: #999999;
|
color: inherit;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
#footer a:hover {
|
#footer a:hover {
|
||||||
|
BIN
Src/VideoGameQuotes.Web/media/images/vgquotes.png
Normal file
BIN
Src/VideoGameQuotes.Web/media/images/vgquotes.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
Loading…
Reference in New Issue
Block a user