From c7d9a3e12a659ed68fb7c8b55300ebff7b72ed71 Mon Sep 17 00:00:00 2001 From: tmont Date: Sat, 5 Mar 2011 23:13:55 +0000 Subject: [PATCH] fixed some icon-related issues on the default browse page --- Src/VideoGameQuotes.Web/Views/Quote/DefaultBrowse.aspx | 10 +++++----- Src/VideoGameQuotes.Web/Views/Quote/Recent.aspx | 2 +- Src/VideoGameQuotes.Web/media/js/browse.compressed.js | 2 +- Src/VideoGameQuotes.Web/media/js/browse.js | 10 ++++++++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Src/VideoGameQuotes.Web/Views/Quote/DefaultBrowse.aspx b/Src/VideoGameQuotes.Web/Views/Quote/DefaultBrowse.aspx index ed2d2db..5d1eb31 100644 --- a/Src/VideoGameQuotes.Web/Views/Quote/DefaultBrowse.aspx +++ b/Src/VideoGameQuotes.Web/Views/Quote/DefaultBrowse.aspx @@ -7,16 +7,16 @@

- Back + ◄ Back

diff --git a/Src/VideoGameQuotes.Web/Views/Quote/Recent.aspx b/Src/VideoGameQuotes.Web/Views/Quote/Recent.aspx index 7f3214d..e955c06 100644 --- a/Src/VideoGameQuotes.Web/Views/Quote/Recent.aspx +++ b/Src/VideoGameQuotes.Web/Views/Quote/Recent.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" %> -Recent: <%= Model.Start %>–<%= Model.End %> +Recently Submitted Quotes <% Html.RenderPartial("PagingMenu", new PagingMenuModel(Model) { Action = "Recent", Controller = "Quote" }); %> diff --git a/Src/VideoGameQuotes.Web/media/js/browse.compressed.js b/Src/VideoGameQuotes.Web/media/js/browse.compressed.js index 664263b..ed25190 100644 --- a/Src/VideoGameQuotes.Web/media/js/browse.compressed.js +++ b/Src/VideoGameQuotes.Web/media/js/browse.compressed.js @@ -1 +1 @@ -(function(c,a,b){c(document).ready(function(){var i=c("#browse-default-menu");var k=c("#browse-default-container");var f=c("#browse-default-content");var d={game:[],system:[],publisher:[],category:[]};var e=function(l,n){var m=c("
    "),o=c("
  1. ");c.each(l,function(){m.append(o.clone().append(n(this)))});f.append(m)};var j=function(m,l){return function(){var o=function(){i.hide();k.show();e(d[m],l)};if(d[m].length===0){var n=c(this);c.ajax("/api/"+m+"/all",{data:{sort:"alphabetical"},success:function(r,p,q){if(r.Error!==null){alert(r.Error);return}d[m]=r.Data.records;o()},beforeSend:function(){n.toggleClass("loading-icon")},complete:function(){n.toggleClass("loading-icon")}})}else{o()}return false}};var h=function(m){var l=c("");return function(n,o){return l.clone().attr("href","/browse/"+m+"/"+n.Id).text(n.Name)}};var g=function(){var l=c("");return function(m,n){return l.clone().attr({href:"/browse/system/"+m.Id,title:m.Name}).text(m.Abbreviation)}}();c("#show-default-menu").click(function(){f.empty();k.hide();i.show();return false});c("#browse-game").click(j("game",h("game")));c("#browse-system").click(j("system",g));c("#browse-category").click(j("category",h("category")));c("#browse-publisher").click(j("publisher",h("publisher")))})}(jQuery,window)); \ No newline at end of file +(function(c,a,b){c(document).ready(function(){var i=c("#browse-default-menu");var k=c("#browse-default-container");var f=c("#browse-default-content");var d={game:[],system:[],publisher:[],category:[]};var e=function(l,n){var m=c("
      "),o=c("
    1. ");c.each(l,function(){m.append(o.clone().append(n(this)))});f.append(m)};var j=function(m,l){var n=false;return function(){if(n){return false}var q=function(){i.hide();k.show();e(d[m],l)};if(d[m].length===0){var p=c(this);var o=c("").addClass("loading-icon");c.ajax("/api/"+m+"/all",{data:{sort:"alphabetical"},success:function(t,r,s){if(t.Error!==null){alert(t.Error);return}d[m]=t.Data.records;q()},beforeSend:function(){p.append(o);n=true},complete:function(){o.remove();n=false}})}else{q()}return false}};var h=function(m){var l=c("");return function(n,o){return l.clone().attr("href","/browse/"+m+"/"+n.Id).text(n.Name)}};var g=function(){var l=c("");return function(m,n){return l.clone().attr({href:"/browse/system/"+m.Id,title:m.Name}).text(m.Abbreviation)}}();c("#show-default-menu").click(function(){f.empty();k.hide();i.show();return false});c("#browse-game").click(j("game",h("game")));c("#browse-system").click(j("system",g));c("#browse-category").click(j("category",h("category")));c("#browse-publisher").click(j("publisher",h("publisher")))})}(jQuery,window)); \ No newline at end of file diff --git a/Src/VideoGameQuotes.Web/media/js/browse.js b/Src/VideoGameQuotes.Web/media/js/browse.js index bda2938..9869f6a 100644 --- a/Src/VideoGameQuotes.Web/media/js/browse.js +++ b/Src/VideoGameQuotes.Web/media/js/browse.js @@ -21,7 +21,12 @@ }; var getDataAndRender = function(type, itemRenderer) { + var executing = false; return function() { + if (executing) { + return false; + } + var render = function() { $browseMenu.hide(); $container.show(); @@ -30,6 +35,7 @@ if (data[type].length === 0) { var $link = $(this); + var $icon = $("").addClass("loading-icon"); $.ajax("/api/" + type + "/all", { data: { sort: "alphabetical" }, success: function(response, status, $xhr) { @@ -41,8 +47,8 @@ data[type] = response.Data.records; render(); }, - beforeSend: function() { $link.toggleClass("loading-icon"); }, - complete: function() { $link.toggleClass("loading-icon"); } + beforeSend: function() { $link.append($icon); executing = true; }, + complete: function() { $icon.remove(); executing = false; } }); } else { render();