Show totals in best of yellow thigny.
This commit is contained in:
parent
f1e2923a91
commit
a30c019275
|
@ -94,7 +94,8 @@ Discourse.URL = {
|
|||
var topicController = Discourse.__container__.lookup('controller:topic');
|
||||
var opts = { trackVisit: false };
|
||||
if (newMatches[3]) opts.nearPost = newMatches[3];
|
||||
topicController.get('content').loadPosts(opts);
|
||||
topicController.cancelFilter();
|
||||
topicController.loadPosts(opts);
|
||||
|
||||
// Abort routing, we have replaced our state.
|
||||
return;
|
||||
|
|
|
@ -164,7 +164,10 @@ Discourse.TopicController = Discourse.ObjectController.extend({
|
|||
var postFilters = this.get('postFilters');
|
||||
|
||||
if (postFilters.bestOf) {
|
||||
this.set('filterDesc', Em.String.i18n("topic.filters.best_of"));
|
||||
this.set('filterDesc', Em.String.i18n("topic.filters.best_of", {
|
||||
filtered_posts_count: this.get('filtered_posts_count'),
|
||||
posts_count: this.get('posts_count')
|
||||
}));
|
||||
} else if (postFilters.userFilters.length > 0) {
|
||||
this.set('filterDesc', Em.String.i18n("topic.filters.user", {count: postFilters.userFilters.length}));
|
||||
} else {
|
||||
|
@ -186,6 +189,13 @@ Discourse.TopicController = Discourse.ObjectController.extend({
|
|||
return { userFilters: this.get('userFilters') };
|
||||
}.property('userFilters.[]', 'bestOf'),
|
||||
|
||||
loadPosts: function(opts) {
|
||||
var topicController = this;
|
||||
this.get('content').loadPosts(opts).then(function () {
|
||||
Em.run.next(function () { topicController.updateBottomBar() });
|
||||
});
|
||||
},
|
||||
|
||||
reloadPosts: function() {
|
||||
var topic = this.get('content');
|
||||
if (!topic) return;
|
||||
|
@ -212,7 +222,8 @@ Discourse.TopicController = Discourse.ObjectController.extend({
|
|||
posts.pushObject(Discourse.Post.create(p, topic));
|
||||
});
|
||||
|
||||
topicController.updateBottomBar();
|
||||
Em.run.next(function () { topicController.updateBottomBar(); });
|
||||
|
||||
topicController.set('filtered_posts_count', result.filtered_posts_count);
|
||||
topicController.set('loadingBelow', false);
|
||||
topicController.set('seenBottom', false);
|
||||
|
|
|
@ -210,8 +210,11 @@ Discourse.Topic = Discourse.Model.extend({
|
|||
// Load the first post by default
|
||||
if ((!opts.bestOf) && (!opts.nearPost)) opts.nearPost = 1;
|
||||
|
||||
// If we already have that post in the DOM, jump to it
|
||||
if (Discourse.TopicView.scrollTo(this.get('id'), opts.nearPost)) return;
|
||||
// If we already have that post in the DOM, jump to it. Return a promise
|
||||
// that's already complete.
|
||||
if (Discourse.TopicView.scrollTo(this.get('id'), opts.nearPost)) {
|
||||
return Ember.Deferred.promise(function(promise) { promise.resolve(); });
|
||||
}
|
||||
|
||||
// If loading the topic succeeded...
|
||||
var afterTopicLoaded = function(result) {
|
||||
|
@ -289,7 +292,7 @@ Discourse.Topic = Discourse.Model.extend({
|
|||
}
|
||||
|
||||
// Finally, call our find method
|
||||
Discourse.Topic.find(this.get('id'), {
|
||||
return Discourse.Topic.find(this.get('id'), {
|
||||
nearPost: opts.nearPost,
|
||||
bestOf: opts.bestOf,
|
||||
trackVisit: opts.trackVisit
|
||||
|
|
|
@ -16,10 +16,7 @@ Discourse.TopicBestOfRoute = Discourse.Route.extend({
|
|||
topicController = this.controllerFor('topic');
|
||||
topicController.cancelFilter();
|
||||
topicController.set('bestOf', true);
|
||||
this.modelFor('topic').loadPosts(params);
|
||||
|
||||
// After we load, show the bottom bar
|
||||
Em.run.next(function () { topicController.updateBottomBar(); })
|
||||
topicController.loadPosts(params);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
Discourse.TopicFromParamsRoute = Discourse.Route.extend({
|
||||
|
||||
setupController: function(controller, params) {
|
||||
var topicController;
|
||||
params = params || {};
|
||||
params.trackVisit = true;
|
||||
topicController = this.controllerFor('topic');
|
||||
|
||||
var topicController = this.controllerFor('topic');
|
||||
topicController.cancelFilter();
|
||||
this.modelFor('topic').loadPosts(params);
|
||||
topicController.loadPosts(params);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -502,7 +502,7 @@ en:
|
|||
user:
|
||||
one: "You're viewing only posts by a specific user."
|
||||
other: "You're viewing only posts made by specific users."
|
||||
best_of: "You're viewing only the 'Best Of' posts."
|
||||
best_of: "You're viewing the {{filtered_posts_count}} best posts of {{posts_count}} in the topic."
|
||||
cancel: "Show all posts in this topic again."
|
||||
|
||||
move_selected:
|
||||
|
@ -731,7 +731,7 @@ en:
|
|||
flagged_by: "Flagged by"
|
||||
error: "Something went wrong"
|
||||
|
||||
api:
|
||||
api:
|
||||
title: "API"
|
||||
customize:
|
||||
title: "Customize"
|
||||
|
|
Loading…
Reference in New Issue