From cacbb799c461aaa6e9593fdf998fa67e228a56e7 Mon Sep 17 00:00:00 2001 From: tmont Date: Sun, 27 Feb 2011 04:20:59 +0000 Subject: [PATCH] * styled the flag dialog a little * added a modal dialog background --- Src/VideoGameQuotes.Api/Quote.cs | 5 ++++ .../VideoGameQuotes.Api.csproj | 1 + .../Controllers/QuoteController.cs | 2 +- Src/VideoGameQuotes.Web/Global.asax.cs | 2 +- Src/VideoGameQuotes.Web/Views/Quote/Best.aspx | 2 +- .../Views/Shared/MainMenu.ascx | 1 - .../Views/Shared/SingleQuote.ascx | 2 +- .../Views/Shared/Site.Master | 1 + Src/VideoGameQuotes.Web/media/css/global.css | 24 ++++++++++++------- Src/VideoGameQuotes.Web/media/css/quote.css | 13 +++++++++- 10 files changed, 39 insertions(+), 14 deletions(-) diff --git a/Src/VideoGameQuotes.Api/Quote.cs b/Src/VideoGameQuotes.Api/Quote.cs index 81584cf..0793e68 100644 --- a/Src/VideoGameQuotes.Api/Quote.cs +++ b/Src/VideoGameQuotes.Api/Quote.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; +using System.Web; using Iesi.Collections.Generic; using Portoa.Persistence; using Portoa.Search; @@ -162,6 +163,10 @@ namespace VideoGameQuotes.Api { public static class QuoteExtensions { private static readonly Regex urlFriendlyRegex = new Regex(@"[^A-Za-z0-9_-]"); + public static string FormatTextForHtml(this Quote quote) { + return HttpUtility.HtmlEncode(quote.Text).Replace("'", "’").Replace("\n", "
"); + } + public static string GetUrlFriendlyText(this Quote quote) { var text = urlFriendlyRegex.Replace(quote.Text.Replace(" ", "_").Replace("\n", ""), ""); return text.Substring(0, Math.Min(text.Length, 50)); diff --git a/Src/VideoGameQuotes.Api/VideoGameQuotes.Api.csproj b/Src/VideoGameQuotes.Api/VideoGameQuotes.Api.csproj index 2d55f47..7f7d76d 100644 --- a/Src/VideoGameQuotes.Api/VideoGameQuotes.Api.csproj +++ b/Src/VideoGameQuotes.Api/VideoGameQuotes.Api.csproj @@ -59,6 +59,7 @@ + diff --git a/Src/VideoGameQuotes.Web/Controllers/QuoteController.cs b/Src/VideoGameQuotes.Web/Controllers/QuoteController.cs index 315699d..48e1153 100644 --- a/Src/VideoGameQuotes.Web/Controllers/QuoteController.cs +++ b/Src/VideoGameQuotes.Web/Controllers/QuoteController.cs @@ -50,7 +50,7 @@ namespace VideoGameQuotes.Web.Controllers { } [HttpPost, VerifyUser] - public JsonResult Report(ReportModel model) { + public JsonResult Flag(ReportModel model) { if (!ModelState.IsValid) { return Json(this.CreateJsonErrorResponse("Invalid request")); } diff --git a/Src/VideoGameQuotes.Web/Global.asax.cs b/Src/VideoGameQuotes.Web/Global.asax.cs index 47ca6a0..c12095e 100644 --- a/Src/VideoGameQuotes.Web/Global.asax.cs +++ b/Src/VideoGameQuotes.Web/Global.asax.cs @@ -78,7 +78,7 @@ namespace VideoGameQuotes.Web { routes.MapRoute("browse", "browse/{*qualifiers}", new { controller = "Quote", action = "Browse" }); routes.MapRoute("search", "search/{*searchQuery}", new { controller = "Quote", action = "Search" }); 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|flag" }); 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("default", "{controller}", new { controller = "home", action = "index" }); diff --git a/Src/VideoGameQuotes.Web/Views/Quote/Best.aspx b/Src/VideoGameQuotes.Web/Views/Quote/Best.aspx index f454b9c..4ced243 100644 --- a/Src/VideoGameQuotes.Web/Views/Quote/Best.aspx +++ b/Src/VideoGameQuotes.Web/Views/Quote/Best.aspx @@ -1,7 +1,7 @@ <%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage>" MasterPageFile="~/Views/Shared/Site.Master" %> <%@ Import Namespace="Portoa.Web.Models" %> <%@ Import Namespace="VideoGameQuotes.Web.Models" %> -Best: <%= Model.Start %>–<%= Model.End %> +Best <% Html.RenderPartial("PagingMenu", new PagingMenuModel(Model) { Action = "best", Controller = "quote" }); %> diff --git a/Src/VideoGameQuotes.Web/Views/Shared/MainMenu.ascx b/Src/VideoGameQuotes.Web/Views/Shared/MainMenu.ascx index 647578e..9d99362 100644 --- a/Src/VideoGameQuotes.Web/Views/Shared/MainMenu.ascx +++ b/Src/VideoGameQuotes.Web/Views/Shared/MainMenu.ascx @@ -6,7 +6,6 @@
  • <%= Html.ActionLink("Browse", "browse", "Quote", new { qualifiers = "" }, new { title = "Browse the quote database" })%>
  • <%= Html.ActionLink("Random", "random", "Quote", null, new { title = "View a random quote" })%>
  • <%= Html.ActionLink("Submit", "submit", "Quote", null, new { title = "Submit a new quote" }) %>
  • -
  • <%= Html.ActionLink("About", "about", "Home", null, new { title = "About the site" })%>
  • <% if (Model.User != null && Model.User.Group >= UserGroup.Admin) { %>
  • <%= Html.ActionLink("Admin", "index", "admin", null, new { title = "Perform administrative tasks" }) %>
  • <% } %> diff --git a/Src/VideoGameQuotes.Web/Views/Shared/SingleQuote.ascx b/Src/VideoGameQuotes.Web/Views/Shared/SingleQuote.ascx index efe432e..932a97d 100644 --- a/Src/VideoGameQuotes.Web/Views/Shared/SingleQuote.ascx +++ b/Src/VideoGameQuotes.Web/Views/Shared/SingleQuote.ascx @@ -15,7 +15,7 @@
    - <%: Model.Quote.Text %> + <%= Model.Quote.FormatTextForHtml() %>
    diff --git a/Src/VideoGameQuotes.Web/Views/Shared/Site.Master b/Src/VideoGameQuotes.Web/Views/Shared/Site.Master index e34c515..ba10e94 100644 --- a/Src/VideoGameQuotes.Web/Views/Shared/Site.Master +++ b/Src/VideoGameQuotes.Web/Views/Shared/Site.Master @@ -37,6 +37,7 @@