* added logo

* updated footer styles
* paged the browse data
This commit is contained in:
tmont 2011-02-27 01:14:56 +00:00
parent 35d87ca794
commit 140b1d6bcc
12 changed files with 84 additions and 52 deletions

View File

@ -6,6 +6,7 @@ using Portoa.Persistence;
using Portoa.Search;
using Portoa.Validation.DataAnnotations;
using Portoa.Web.Controllers;
using Portoa.Web.Models;
using Portoa.Web.Results;
using Portoa.Web.Security;
using VideoGameQuotes.Api;
@ -25,15 +26,27 @@ namespace VideoGameQuotes.Web.Controllers {
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) {
return View("DefaultBrowse");
}
return View("QualifiedBrowse", new QualifiedBrowseModel(model) {
Quotes = quoteService.GetBrowsableQuotes(model),
User = currentUserProvider.CurrentUser
});
model.CurrentUser = currentUserProvider.CurrentUser;
var pagingModel = new PagedModel<Quote> {
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]
@ -86,7 +99,7 @@ namespace VideoGameQuotes.Web.Controllers {
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;
return View(model);

View File

@ -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("browse", "browse/{*qualifiers}", new { controller = "Quote", action = "Browse" });
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("dismiss-flag", "dismiss-flag", new { controller = "Quote", action = "DismissFlag" });
routes.MapRoute("individual-quote", "quote/{id}/{*text}", new { controller = "Quote", action = "Quote" }, new { id = @"\d+" });

View File

@ -11,7 +11,7 @@ namespace VideoGameQuotes.Web.Models {
PublisherIds = Enumerable.Empty<int>();
}
public User User { get; set; }
public User CurrentUser { get; set; }
public IEnumerable<int> GameIds { get; set; }
public IEnumerable<int> SystemIds { get; set; }

View File

@ -1,4 +1,4 @@
using System.Collections.Generic;
using Portoa.Web.Models;
using VideoGameQuotes.Api;
namespace VideoGameQuotes.Web.Models {
@ -10,8 +10,9 @@ namespace VideoGameQuotes.Web.Models {
SortMethod = model.SortMethod;
SystemIds = model.SystemIds;
SortOrder = model.SortOrder;
CurrentUser = model.CurrentUser;
}
public IEnumerable<Quote> Quotes { get; set; }
public PagedModel<Quote> PagedModel { get; set; }
}
}

View File

@ -18,14 +18,12 @@ namespace VideoGameQuotes.Web.Services {
Publisher GetPublisher(int id);
GamingSystem GetSystem(int systemId);
Category GetCategory(int categoryId);
Category SaveCategory(Category category);
IEnumerable<Quote> GetMostRecentQuotes(int start, int end, out int totalCount);
IEnumerable<Quote> GetRecentQuotes(int start, int end, out int totalCount);
[CanBeNull]
Quote GetRandomQuote();
IEnumerable<Quote> GetBestQuotes(int start, int end, out int totalCount);
Vote SaveVote(Vote vote);
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 {
@ -104,12 +102,7 @@ namespace VideoGameQuotes.Web.Services {
}
[UnitOfWork]
public Category SaveCategory(Category category) {
return categoryRepository.Save(category);
}
[UnitOfWork]
public IEnumerable<Quote> GetMostRecentQuotes(int start, int end, out int totalCount) {
public IEnumerable<Quote> GetRecentQuotes(int start, int end, out int totalCount) {
totalCount = quoteRepository.Records.Count();
return quoteRepository
.Records
@ -143,11 +136,6 @@ namespace VideoGameQuotes.Web.Services {
.Take(end - start + 1);
}
[UnitOfWork]
public Vote SaveVote(Vote vote) {
return voteRepository.Save(vote);
}
[UnitOfWork]
public Vote GetVoteOrCreateNew(Quote quote, User voter) {
var vote = voteRepository.Records.SingleOrDefault(v => v.Quote == quote && v.Voter == voter);
@ -158,7 +146,7 @@ namespace VideoGameQuotes.Web.Services {
}
[UnitOfWork]
public IEnumerable<Quote> GetBrowsableQuotes(BrowseModel model) {
public IEnumerable<Quote> GetBrowsableQuotes(BrowseModel model, int start, int end, out int totalCount) {
var quotes = quoteRepository.Records;
if (model.GameIds.Any()) {
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)));
}
return quotes;
totalCount = quotes.Count();
return quotes.Skip(start - 1).Take(end - start + 1);
}
}
}

View File

@ -150,9 +150,12 @@
<Content Include="media\images\delete.png" />
<Content Include="media\images\error.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\pencil.png" />
<Content Include="media\images\search.png" />
<Content Include="media\images\vgquotes.png" />
<Content Include="media\js\jquery.cookie.js" />
<Content Include="media\js\quoteform.js" />
<Content Include="media\js\vgquotes.js" />

View File

@ -5,21 +5,22 @@
<h2>Welcome</h2>
<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") %>
quotes from video games. You do not need to register or login (in fact, you aren&#39;t allowed to)
to perform any of these tasks. Participation is encouraged.
quotes from video games. You do not need to register or login to perform any of these tasks.
Participation is encouraged.
</p>
<p>
If you see a quote that is inaccurate, fake, spelled wrong, spam or you&#39;re just straight up
concerned about it, please use the <em>report</em> link near the quote in question. It won&#39;t
be removed immediately, but it will be flagged for review by our crack team of administrators (i.e. me).
If you see a quote that is inaccurate, fake, spelled wrong, spam or you&rsquo;re just straight up
concerned about it, please flag (<span class="quote-flag-link" title="click on one of these things"></span>)
the quote in question. It won&rsquo;t be removed immediately, but it will be flagged for review by our
crack team of administrators (i.e. me).
</p>
<p>
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&#39;t hesitate to contact him (i.e. me) using the
for its creator (i.e. me), don&rsquo;t hesitate to contact him (i.e. me) using the
<%= Html.ActionLink("contact", "contact", "home") %> form.
</p>

View File

@ -1,6 +1,6 @@
<%@ 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">
<ul class="menu clearfix">
@ -10,6 +10,10 @@
</ul>
<p>
Showing <strong><%= Model.Start %>&mdash;<%= Model.ActualEnd %></strong> of <strong><%= Model.TotalCount %></strong>.
<% if (Model.CurrentPageIsValid) { %>
Showing <strong><%= Model.Start%>&mdash;<%= Model.ActualEnd%></strong> of <strong><%= Model.TotalCount%></strong>.
<% } else { %>
Nothing to show of <strong><%= Model.TotalCount%></strong>.
<% } %>
</p>
</div>

View File

@ -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" %>
<asp:Content runat="server" ID="Title" ContentPlaceHolderID="TitleContent">Browse</asp:Content>
<asp:Content runat="server" ID="Main" ContentPlaceHolderID="MainContent">
<p>
Here are some quotes
</p>
<% Html.RenderPartial("PagingMenu", new PagingMenuModel(Model.PagedModel)); %>
<%
foreach (var quote in Model.Quotes) {
Html.RenderPartial("SingleQuote", new QuoteModel { Quote = quote, User = Model.User });
}
if (Model.PagedModel.TotalCount > 0) {
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>

View File

@ -17,7 +17,7 @@
<div id="header">
<div class="content-container">
<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 id="main-menu">
@ -35,14 +35,14 @@
</div>
<div id="footer">
<div class="content-container">
<p>
&copy; <%= DateTime.UtcNow.Year %> <a href="http://tommymontgomery.com/" title="Who is this man?">Tommy Montgomery</a><br />
<% if (!Request.IsAuthenticated) { %>
<a href="#" id="login-link">login</a>
<% } else { %>
<%= Html.ActionLink("logout", "logout", "home", new { redirectUrl = Request.Path }, null)%>
<% } %>
</div>
</p>
</div>
</div>

View File

@ -1,8 +1,12 @@
body {
html {
height: 100%;
}
body {
background-color: #EEEEEE;
color: #000000;
font-family: Calibri, Corbel, Helvetica, Arial;
font-size: 1em;
height: 100%;
}
h1 {
font-size: 5em;
@ -210,6 +214,11 @@ ul.menu {
#logo a {
text-decoration: none;
color: inherit;
height: 125px;
display: block;
background-image: url(/media/images/vgquotes.png);
background-position: center center;
background-repeat: no-repeat;
}
#login-dialog {
@ -220,8 +229,13 @@ ul.menu {
cursor: pointer;
}
#header {
background-color: #669966;
#wrapper {
min-height: 100%;
position: relative;
}
#header, #footer {
background-color: #889988;
}
#main-menu li {
@ -242,7 +256,7 @@ ul.menu {
}
#main {
padding: 20px;
padding: 20px 20px 100px 20px;
}
#main a {
color: #669966;
@ -274,10 +288,14 @@ ul.menu {
#footer {
text-align: center;
font-size: 75%;
color: #999999;
color: #FFFFFF;
position: absolute;
bottom: 0;
height: 100px;
width: 100%;
}
#footer a {
color: #999999;
color: inherit;
text-decoration: none;
}
#footer a:hover {

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB