Update ember-cloaking to remove dependency on I18n

This commit is contained in:
Robin Ward 2014-01-17 16:40:43 -05:00
parent 3bbe595d10
commit 55397361be
3 changed files with 11 additions and 10 deletions

View File

@ -329,6 +329,10 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
return Discourse.User.current() && !this.get('isPrivateMessage'); return Discourse.User.current() && !this.get('isPrivateMessage');
}.property('isPrivateMessage'), }.property('isPrivateMessage'),
loadingHTML: function() {
return "<div class='spinner'>" + I18n.t('loading') + "</div>";
}.property(),
recoverTopic: function() { recoverTopic: function() {
this.get('content').recover(); this.get('content').recover();
}, },

View File

@ -64,7 +64,7 @@
{{/if}} {{/if}}
{{#unless postStream.loadingFilter}} {{#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}} {{/unless}}
{{#if postStream.loadingBelow}} {{#if postStream.loadingBelow}}

View File

@ -3,8 +3,8 @@
/** /**
Display a list of cloaked items Display a list of cloaked items
@class CloakedContainerView @class CloakedCollectionView
@extends Ember.View @extends Ember.CollectionView
@namespace Ember @namespace Ember
**/ **/
Ember.CloakedCollectionView = Ember.CollectionView.extend({ Ember.CloakedCollectionView = Ember.CollectionView.extend({
@ -136,9 +136,7 @@
this.setProperties({topVisible: null, bottomVisible: null}); this.setProperties({topVisible: null, bottomVisible: null});
} }
var toCloak = childViews.slice(0, topView).concat(childViews.slice(bottomView+1)), var toCloak = childViews.slice(0, topView).concat(childViews.slice(bottomView+1));
loadingView = childViews[bottomView + 1];
Em.run.schedule('afterRender', function() { Em.run.schedule('afterRender', function() {
toUncloak.forEach(function (v) { v.uncloak(); }); toUncloak.forEach(function (v) { v.uncloak(); });
toCloak.forEach(function (v) { v.cloak(); }); toCloak.forEach(function (v) { v.cloak(); });
@ -148,7 +146,7 @@
var checkView = childViews[j]; var checkView = childViews[j];
if (!checkView.get('containedView')) { if (!checkView.get('containedView')) {
if (!checkView.get('loading')) { if (!checkView.get('loading')) {
checkView.$().html("<div class='spinner'>" + I18n.t('loading') + "</div>"); checkView.$().html(this.get('loadingHTML') || "Loading...");
} }
return; return;
} }
@ -171,10 +169,9 @@
}, },
willDestroyElement: function() { willDestroyElement: function() {
$(document).bind('touchmove.ember-cloak'); $(document).unbind('touchmove.ember-cloak');
$(window).bind('scroll.ember-cloak'); $(window).unbind('scroll.ember-cloak');
} }
}); });