mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Fix loading bar and retry block in ladder_view, #857.
This commit is contained in:
parent
fe96289bf6
commit
b7439ed1ca
3 changed files with 7 additions and 7 deletions
|
@ -122,7 +122,7 @@ module.exports = class SuperModel extends Backbone.Model
|
|||
resource.rid = @rid
|
||||
@resources[@rid] = resource
|
||||
@listenToOnce(resource, 'resource:loaded', @onResourceLoaded)
|
||||
@listenToOnce(resource, 'resource:failed', @onResourceFailed)
|
||||
@listenTo(resource, 'resource:failed', @onResourceFailed)
|
||||
@denom += value
|
||||
|
||||
loadResources: ->
|
||||
|
|
|
@ -44,8 +44,8 @@ module.exports = class CocoView extends Backbone.View
|
|||
# Backbone.Mediator handles subscription setup/teardown automatically
|
||||
|
||||
@listenToOnce(@supermodel, 'loaded-all', @onLoaded)
|
||||
@listenToOnce(@supermodel, 'superModel:updateProgress', @updateProgress)
|
||||
@listenToOnce(@supermodel, 'resource:failed', @onResourceLoadFailed)
|
||||
@listenTo(@supermodel, 'superModel:updateProgress', @updateProgress)
|
||||
@listenTo(@supermodel, 'resource:failed', @onResourceLoadFailed)
|
||||
|
||||
super options
|
||||
|
||||
|
@ -82,16 +82,15 @@ module.exports = class CocoView extends Backbone.View
|
|||
# View Rendering
|
||||
|
||||
render: ->
|
||||
@showLoading()
|
||||
return @ unless me
|
||||
super()
|
||||
return @template if _.isString(@template)
|
||||
@$el.html @template(@getRenderData())
|
||||
|
||||
if not @supermodel.finished()
|
||||
console.debug 'gintau', 'cocoview-showLoading', @
|
||||
@showLoading()
|
||||
else
|
||||
console.debug 'gintau', 'cocoview-hideLoading', @
|
||||
@hideLoading()
|
||||
|
||||
@afterRender()
|
||||
|
@ -110,7 +109,6 @@ module.exports = class CocoView extends Backbone.View
|
|||
context
|
||||
|
||||
afterRender: ->
|
||||
@hideLoading()
|
||||
|
||||
updateProgress: (progress)=>
|
||||
@loadProgress.progress = progress if progress > @loadProgress.progress
|
||||
|
@ -125,6 +123,7 @@ module.exports = class CocoView extends Backbone.View
|
|||
|
||||
# Error handling for loading
|
||||
onResourceLoadFailed: (source) ->
|
||||
console.debug 'gintau', 'onResourceLoadFailed', source
|
||||
@$el.find('.loading-screen .errors').append(loadingErrorTemplate({
|
||||
status: 'error',
|
||||
name: source.resource.name
|
||||
|
@ -189,6 +188,7 @@ module.exports = class CocoView extends Backbone.View
|
|||
|
||||
hideLoading: ->
|
||||
return unless @_lastLoading?
|
||||
console.debug 'gintau', 'hideLoading', @$el
|
||||
@_lastLoading.find('.loading-screen').remove()
|
||||
@_lastLoading.find('>').removeClass('hidden')
|
||||
@_lastLoading = null
|
||||
|
|
|
@ -83,7 +83,7 @@ module.exports = class Handler
|
|||
@sendSuccess(res, documents)
|
||||
|
||||
getById: (req, res, id) ->
|
||||
return @sendNotFoundError(res) # for testing
|
||||
# return @sendNotFoundError(res) # for testing
|
||||
return @sendUnauthorizedError(res) unless @hasAccess(req)
|
||||
|
||||
@getDocumentForIdOrSlug id, (err, document) =>
|
||||
|
|
Loading…
Reference in a new issue