Show waiting gif until mod data is loaded

This commit is contained in:
Andrew Miner
2015-05-13 17:52:15 -07:00
parent 44c247837b
commit db31c3bd7e
6 changed files with 33 additions and 3 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ serveIndex = (request, response)->
console.log ">>> #{request.path} ==> #{PRERENDER_ROOT}#{filePath}" console.log ">>> #{request.path} ==> #{PRERENDER_ROOT}#{filePath}"
response.sendFile filePath, root:PRERENDER_ROOT response.sendFile filePath, root:PRERENDER_ROOT
else else
console.log ">>> #{request.path} ==> #{ROOT}app.html" console.log ">>> #{request.path} ==> #{ROOT}/app.html"
response.sendFile '/app.html', root:ROOT response.sendFile '/app.html', root:ROOT
serveData = (request, response)-> serveData = (request, response)->
+5
View File
@@ -69,6 +69,11 @@ module.exports = class CraftingGuideRouter extends backbone.Router
@modPack.addMod mod @modPack.addMod mod
if global.env isnt 'prerender'
@modPack.once Event.sync, ->
$('.page').css 'max-height', ''
$('.page-loading').remove()
loadCurrentUser: -> loadCurrentUser: ->
@client.fetchCurrentUser() @client.fetchCurrentUser()
.then (response)=> .then (response)=>
+5
View File
@@ -26,6 +26,10 @@ if typeof(global) is 'undefined'
global.logger = new Logger global.logger = new Logger
switch window.location.hostname switch window.location.hostname
when 'prerender.crafting-guide.com'
global.env = 'prerender'
logger.level = Logger.FATAL
apiBaseUrl = 'http://local.crafting-guide.com:8001'
when 'local.crafting-guide.com', 'localhost' when 'local.crafting-guide.com', 'localhost'
global.env = 'local' global.env = 'local'
logger.level = Logger.DEBUG logger.level = Logger.DEBUG
@@ -61,4 +65,5 @@ global.router.loadDefaultModPack()
backbone.history.start pushState:true backbone.history.start pushState:true
client.checkStatus() client.checkStatus()
logger.info -> "CraftingGuide is ready" logger.info -> "CraftingGuide is ready"
+6 -1
View File
@@ -133,8 +133,13 @@ module.exports = class ModPack extends BaseModel
_onModVersionLoaded: (modVersion)-> _onModVersionLoaded: (modVersion)->
stillLoading = false stillLoading = false
foundLoaded = false
@eachMod (mod)-> @eachMod (mod)->
mod.eachModVersion (modVersion)-> mod.eachModVersion (modVersion)->
foundLoaded = foundLoaded or modVersion.isLoaded
stillLoading = stillLoading or modVersion.isLoading stillLoading = stillLoading or modVersion.isLoading
@trigger Event.change, this if not stillLoading return if not foundLoaded or stillLoading
@trigger Event.change, this
@trigger Event.sync, this
+2 -1
View File
@@ -22,7 +22,8 @@ html
.content .content
include ./includes/_header.jade include ./includes/_header.jade
.page.hideable .page.hideable(style="max-height: 0")
.page-loading: img(src="/images/wait.gif")
include ./includes/_footer.jade include ./includes/_footer.jade
block scripts block scripts
+14
View File
@@ -64,6 +64,20 @@ All rights reserved.
vertical-align: top; vertical-align: top;
} }
.page {
overflow: hidden;
}
.page-loading {
width: 100%;
text-align: center;
img {
margin: 5em auto;
}
}
.sidebar { .sidebar {
position: relative; width: 18.75%; height: 100%; position: relative; width: 18.75%; height: 100%;