* styled the flag dialog a little

* added a modal dialog background
This commit is contained in:
tmont 2011-02-27 04:20:59 +00:00
parent 540f34da3e
commit cacbb799c4
10 changed files with 39 additions and 14 deletions

View File

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Web;
using Iesi.Collections.Generic; using Iesi.Collections.Generic;
using Portoa.Persistence; using Portoa.Persistence;
using Portoa.Search; using Portoa.Search;
@ -162,6 +163,10 @@ namespace VideoGameQuotes.Api {
public static class QuoteExtensions { public static class QuoteExtensions {
private static readonly Regex urlFriendlyRegex = new Regex(@"[^A-Za-z0-9_-]"); private static readonly Regex urlFriendlyRegex = new Regex(@"[^A-Za-z0-9_-]");
public static string FormatTextForHtml(this Quote quote) {
return HttpUtility.HtmlEncode(quote.Text).Replace("&#39;", "&rsquo;").Replace("\n", "<br />");
}
public static string GetUrlFriendlyText(this Quote quote) { public static string GetUrlFriendlyText(this Quote quote) {
var text = urlFriendlyRegex.Replace(quote.Text.Replace(" ", "_").Replace("\n", ""), ""); var text = urlFriendlyRegex.Replace(quote.Text.Replace(" ", "_").Replace("\n", ""), "");
return text.Substring(0, Math.Min(text.Length, 50)); return text.Substring(0, Math.Min(text.Length, 50));

View File

@ -59,6 +59,7 @@
<Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Web" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ApiException.cs" /> <Compile Include="ApiException.cs" />

View File

@ -50,7 +50,7 @@ namespace VideoGameQuotes.Web.Controllers {
} }
[HttpPost, VerifyUser] [HttpPost, VerifyUser]
public JsonResult Report(ReportModel model) { public JsonResult Flag(ReportModel model) {
if (!ModelState.IsValid) { if (!ModelState.IsValid) {
return Json(this.CreateJsonErrorResponse("Invalid request")); return Json(this.CreateJsonErrorResponse("Invalid request"));
} }

View File

@ -78,7 +78,7 @@ namespace VideoGameQuotes.Web {
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", "quote/{action}/{id}", new { controller = "Quote" }, new { action = "edit", 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|flag" });
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+" });
routes.MapRoute("default", "{controller}", new { controller = "home", action = "index" }); routes.MapRoute("default", "{controller}", new { controller = "home", action = "index" });

View File

@ -1,7 +1,7 @@
<%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage<VideoGameQuotes.Web.Models.PagedModelWithUser<VideoGameQuotes.Api.Quote>>" MasterPageFile="~/Views/Shared/Site.Master" %> <%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage<VideoGameQuotes.Web.Models.PagedModelWithUser<VideoGameQuotes.Api.Quote>>" MasterPageFile="~/Views/Shared/Site.Master" %>
<%@ Import Namespace="Portoa.Web.Models" %> <%@ Import Namespace="Portoa.Web.Models" %>
<%@ Import Namespace="VideoGameQuotes.Web.Models" %> <%@ Import Namespace="VideoGameQuotes.Web.Models" %>
<asp:Content runat="server" ID="Title" ContentPlaceHolderID="TitleContent">Best: <%= Model.Start %>&ndash;<%= Model.End %></asp:Content> <asp:Content runat="server" ID="Title" ContentPlaceHolderID="TitleContent">Best</asp:Content>
<asp:Content runat="server" ID="Main" ContentPlaceHolderID="MainContent"> <asp:Content runat="server" ID="Main" ContentPlaceHolderID="MainContent">
<% Html.RenderPartial("PagingMenu", new PagingMenuModel(Model) { Action = "best", Controller = "quote" }); %> <% Html.RenderPartial("PagingMenu", new PagingMenuModel(Model) { Action = "best", Controller = "quote" }); %>

View File

@ -6,7 +6,6 @@
<li><%= Html.ActionLink("Browse", "browse", "Quote", new { qualifiers = "" }, new { title = "Browse the quote database" })%></li> <li><%= Html.ActionLink("Browse", "browse", "Quote", new { qualifiers = "" }, new { title = "Browse the quote database" })%></li>
<li><%= Html.ActionLink("Random", "random", "Quote", null, new { title = "View a random quote" })%></li> <li><%= Html.ActionLink("Random", "random", "Quote", null, new { title = "View a random quote" })%></li>
<li><%= Html.ActionLink("Submit", "submit", "Quote", null, new { title = "Submit a new quote" }) %></li> <li><%= Html.ActionLink("Submit", "submit", "Quote", null, new { title = "Submit a new quote" }) %></li>
<li><%= Html.ActionLink("About", "about", "Home", null, new { title = "About the site" })%></li>
<% if (Model.User != null && Model.User.Group >= UserGroup.Admin) { %> <% if (Model.User != null && Model.User.Group >= UserGroup.Admin) { %>
<li><%= Html.ActionLink("Admin", "index", "admin", null, new { title = "Perform administrative tasks" }) %></li> <li><%= Html.ActionLink("Admin", "index", "admin", null, new { title = "Perform administrative tasks" }) %></li>
<% } %> <% } %>

View File

@ -15,7 +15,7 @@
</div> </div>
<div class="quote-text"> <div class="quote-text">
<%: Model.Quote.Text %> <%= Model.Quote.FormatTextForHtml() %>
</div> </div>
</div> </div>

View File

@ -37,6 +37,7 @@
<div id="footer"> <div id="footer">
<p> <p>
&copy; <%= DateTime.UtcNow.Year %> <a href="http://tommymontgomery.com/" title="Who is this man?">Tommy Montgomery</a><br /> &copy; <%= DateTime.UtcNow.Year %> <a href="http://tommymontgomery.com/" title="Who is this man?">Tommy Montgomery</a><br />
<%= Html.ActionLink("about", "about", "home") %> |
<% if (!Request.IsAuthenticated) { %> <% if (!Request.IsAuthenticated) { %>
<a href="#" id="login-link">login</a> <a href="#" id="login-link">login</a>
<% } else { %> <% } else { %>

View File

@ -115,13 +115,9 @@ ul.menu {
color: #000000; color: #000000;
font-size: 80%; font-size: 80%;
padding: 5px; padding: 5px;
position: absolute; position: fixed;
top: 0;
left: 0;
} }
.contact-form textarea { .contact-form textarea {
width: 100%; width: 100%;
} }
@ -191,10 +187,10 @@ ul.menu {
.button-link { .button-link {
background-color: #FFFFFF; background-color: #FFFFFF;
padding: 2px 2px 2px 18px; padding: 2px 2px 2px 18px;
border: 1px solid #000000 !important; border: 1px solid #999999 !important;
color: #000000 !important; color: #000000 !important;
} text-decoration: none;
.checkbox-table { font-weight: bold;
} }
#browse-default-menu li { #browse-default-menu li {
@ -285,6 +281,18 @@ ul.menu {
width: 100px !important; width: 100px !important;
} }
#modal-background {
z-index: 999;
background-color: #000000;
opacity: .5;
filter: alpha(opacity=50);
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
#footer { #footer {
text-align: center; text-align: center;
font-size: 75%; font-size: 75%;

View File

@ -85,8 +85,19 @@
width: 100px; width: 100px;
} }
.report-dialog { .flag-dialog {
width: 400px; width: 400px;
border: 2px ridge #000000;
background-color: #EEEEEE;
}
.flag-dialog textarea {
width: 394px;
height: 64px;
}
.flag-dialog .submit-container {
margin-top: 10px;
margin-bottom: 5px;
text-align: center;
} }
.quote-flag-link, .quote-permalink { .quote-flag-link, .quote-permalink {
padding-left: 16px; padding-left: 16px;