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