diff --git a/app/assets/javascripts/discourse/controllers/topic_controller.js b/app/assets/javascripts/discourse/controllers/topic_controller.js index bf2902c7fe0..5d5f49dc83f 100644 --- a/app/assets/javascripts/discourse/controllers/topic_controller.js +++ b/app/assets/javascripts/discourse/controllers/topic_controller.js @@ -329,6 +329,10 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected return Discourse.User.current() && !this.get('isPrivateMessage'); }.property('isPrivateMessage'), + loadingHTML: function() { + return "
" + I18n.t('loading') + "
"; + }.property(), + recoverTopic: function() { this.get('content').recover(); }, diff --git a/app/assets/javascripts/discourse/templates/topic.js.handlebars b/app/assets/javascripts/discourse/templates/topic.js.handlebars index afd10cfb7d4..077ba85598e 100644 --- a/app/assets/javascripts/discourse/templates/topic.js.handlebars +++ b/app/assets/javascripts/discourse/templates/topic.js.handlebars @@ -64,7 +64,7 @@ {{/if}} {{#unless postStream.loadingFilter}} - {{cloaked-collection cloakView="post" idProperty="post_number" defaultHeight="200" content=postStream.posts slackRatio=slackRatio}} + {{cloaked-collection cloakView="post" idProperty="post_number" defaultHeight="200" content=postStream.posts slackRatio=slackRatio loadingHTML=controller.loadingHTML}} {{/unless}} {{#if postStream.loadingBelow}} diff --git a/vendor/assets/javascripts/ember-cloaking.js b/vendor/assets/javascripts/ember-cloaking.js index 517b8d48d31..c7d3062734d 100644 --- a/vendor/assets/javascripts/ember-cloaking.js +++ b/vendor/assets/javascripts/ember-cloaking.js @@ -3,8 +3,8 @@ /** Display a list of cloaked items - @class CloakedContainerView - @extends Ember.View + @class CloakedCollectionView + @extends Ember.CollectionView @namespace Ember **/ Ember.CloakedCollectionView = Ember.CollectionView.extend({ @@ -136,9 +136,7 @@ this.setProperties({topVisible: null, bottomVisible: null}); } - var toCloak = childViews.slice(0, topView).concat(childViews.slice(bottomView+1)), - loadingView = childViews[bottomView + 1]; - + var toCloak = childViews.slice(0, topView).concat(childViews.slice(bottomView+1)); Em.run.schedule('afterRender', function() { toUncloak.forEach(function (v) { v.uncloak(); }); toCloak.forEach(function (v) { v.cloak(); }); @@ -148,7 +146,7 @@ var checkView = childViews[j]; if (!checkView.get('containedView')) { if (!checkView.get('loading')) { - checkView.$().html("
" + I18n.t('loading') + "
"); + checkView.$().html(this.get('loadingHTML') || "Loading..."); } return; } @@ -171,10 +169,9 @@ }, willDestroyElement: function() { - $(document).bind('touchmove.ember-cloak'); - $(window).bind('scroll.ember-cloak'); + $(document).unbind('touchmove.ember-cloak'); + $(window).unbind('scroll.ember-cloak'); } - });