Show waiting gif until mod data is loaded
This commit is contained in:
+1
-1
@@ -40,7 +40,7 @@ serveIndex = (request, response)->
|
||||
console.log ">>> #{request.path} ==> #{PRERENDER_ROOT}#{filePath}"
|
||||
response.sendFile filePath, root:PRERENDER_ROOT
|
||||
else
|
||||
console.log ">>> #{request.path} ==> #{ROOT}app.html"
|
||||
console.log ">>> #{request.path} ==> #{ROOT}/app.html"
|
||||
response.sendFile '/app.html', root:ROOT
|
||||
|
||||
serveData = (request, response)->
|
||||
|
||||
@@ -69,6 +69,11 @@ module.exports = class CraftingGuideRouter extends backbone.Router
|
||||
|
||||
@modPack.addMod mod
|
||||
|
||||
if global.env isnt 'prerender'
|
||||
@modPack.once Event.sync, ->
|
||||
$('.page').css 'max-height', ''
|
||||
$('.page-loading').remove()
|
||||
|
||||
loadCurrentUser: ->
|
||||
@client.fetchCurrentUser()
|
||||
.then (response)=>
|
||||
|
||||
@@ -26,6 +26,10 @@ if typeof(global) is 'undefined'
|
||||
global.logger = new Logger
|
||||
|
||||
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'
|
||||
global.env = 'local'
|
||||
logger.level = Logger.DEBUG
|
||||
@@ -61,4 +65,5 @@ global.router.loadDefaultModPack()
|
||||
|
||||
backbone.history.start pushState:true
|
||||
client.checkStatus()
|
||||
|
||||
logger.info -> "CraftingGuide is ready"
|
||||
|
||||
@@ -133,8 +133,13 @@ module.exports = class ModPack extends BaseModel
|
||||
|
||||
_onModVersionLoaded: (modVersion)->
|
||||
stillLoading = false
|
||||
foundLoaded = false
|
||||
@eachMod (mod)->
|
||||
mod.eachModVersion (modVersion)->
|
||||
foundLoaded = foundLoaded or modVersion.isLoaded
|
||||
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
@@ -22,7 +22,8 @@ html
|
||||
|
||||
.content
|
||||
include ./includes/_header.jade
|
||||
.page.hideable
|
||||
.page.hideable(style="max-height: 0")
|
||||
.page-loading: img(src="/images/wait.gif")
|
||||
include ./includes/_footer.jade
|
||||
|
||||
block scripts
|
||||
|
||||
@@ -64,6 +64,20 @@ All rights reserved.
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.page {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.page-loading {
|
||||
width: 100%;
|
||||
|
||||
text-align: center;
|
||||
|
||||
img {
|
||||
margin: 5em auto;
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
position: relative; width: 18.75%; height: 100%;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user