diff --git a/app/models/SuperModel.coffee b/app/models/SuperModel.coffee index cbe894cb8..3b065635c 100644 --- a/app/models/SuperModel.coffee +++ b/app/models/SuperModel.coffee @@ -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: -> diff --git a/app/views/kinds/CocoView.coffee b/app/views/kinds/CocoView.coffee index 68235249f..7e9a18604 100644 --- a/app/views/kinds/CocoView.coffee +++ b/app/views/kinds/CocoView.coffee @@ -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 diff --git a/server/commons/Handler.coffee b/server/commons/Handler.coffee index 945086014..55cc08938 100644 --- a/server/commons/Handler.coffee +++ b/server/commons/Handler.coffee @@ -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) =>