fixed some icon-related issues on the default browse page

This commit is contained in:
tmont 2011-03-05 23:13:55 +00:00
parent 4714cf7538
commit c7d9a3e12a
4 changed files with 15 additions and 9 deletions

View File

@ -7,16 +7,16 @@
<div id="browse-default-menu">
<ul>
<li><a href="#" id="browse-game">Games</a> <small>(<%= Model.TotalNumberOfGames %>)</small></li>
<li><a href="#" id="browse-system">Systems</a> <small>(<%= Model.TotalNumberOfSystems %>)</small></li>
<li><a href="#" id="browse-category">Categories</a> <small>(<%= Model.TotalNumberOfCategories %>)</small></li>
<li><a href="#" id="browse-publisher">Publishers</a> <small>(<%= Model.TotalNumberOfPublishers %>)</small></li>
<li><a href="#" id="browse-game"><span>Games</span></a> <small>(<%= Model.TotalNumberOfGames %>)</small></li>
<li><a href="#" id="browse-system"><span>Systems</span></a> <small>(<%= Model.TotalNumberOfSystems %>)</small></li>
<li><a href="#" id="browse-category"><span>Categories</span></a> <small>(<%= Model.TotalNumberOfCategories %>)</small></li>
<li><a href="#" id="browse-publisher"><span>Publishers</span></a> <small>(<%= Model.TotalNumberOfPublishers %>)</small></li>
</ul>
</div>
<div id="browse-default-container">
<p>
<a href="#" id="show-default-menu">Back</a>
<a href="#" id="show-default-menu" title="Browse by something else">&#x25C4; Back</a>
</p>
<div id="browse-default-content"></div>

View File

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

View File

@ -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("<ol/>"),o=c("<li/>");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("<a/>");return function(n,o){return l.clone().attr("href","/browse/"+m+"/"+n.Id).text(n.Name)}};var g=function(){var l=c("<a/>");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));
(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("<ol/>"),o=c("<li/>");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("<span/>").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("<a/>");return function(n,o){return l.clone().attr("href","/browse/"+m+"/"+n.Id).text(n.Name)}};var g=function(){var l=c("<a/>");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));

View File

@ -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 = $("<span/>").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();