mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-24 08:09:13 -05:00
FIX: Include status=xyz
in queryParams
This commit is contained in:
parent
5bedc56387
commit
9453089b11
3 changed files with 15 additions and 4 deletions
|
@ -13,6 +13,7 @@ export default Discourse.DiscoveryController.extend({
|
||||||
|
|
||||||
order: 'default',
|
order: 'default',
|
||||||
ascending: false,
|
ascending: false,
|
||||||
|
status: null,
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
Discourse.DiscoverySortableController = Discourse.Controller.extend({
|
Discourse.DiscoverySortableController = Discourse.Controller.extend({
|
||||||
needs: ['discovery/topics'],
|
needs: ['discovery/topics'],
|
||||||
queryParams: ['order', 'ascending'],
|
queryParams: ['order', 'ascending', 'status'],
|
||||||
order: Em.computed.alias('controllers.discovery/topics.order'),
|
order: Em.computed.alias('controllers.discovery/topics.order'),
|
||||||
ascending: Em.computed.alias('controllers.discovery/topics.ascending')
|
ascending: Em.computed.alias('controllers.discovery/topics.ascending'),
|
||||||
|
status: Em.computed.alias('controllers.discovery/topics.status')
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,7 +8,8 @@ function buildTopicRoute(filter) {
|
||||||
return Discourse.Route.extend({
|
return Discourse.Route.extend({
|
||||||
queryParams: {
|
queryParams: {
|
||||||
sort: { replace: true },
|
sort: { replace: true },
|
||||||
ascending: { replace: true }
|
ascending: { replace: true },
|
||||||
|
status: { replace: true }
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeModel: function() {
|
beforeModel: function() {
|
||||||
|
@ -25,6 +26,7 @@ function buildTopicRoute(filter) {
|
||||||
var findOpts = {};
|
var findOpts = {};
|
||||||
if (params && params.order) { findOpts.order = params.order; }
|
if (params && params.order) { findOpts.order = params.order; }
|
||||||
if (params && params.ascending) { findOpts.ascending = params.ascending; }
|
if (params && params.ascending) { findOpts.ascending = params.ascending; }
|
||||||
|
if (params && params.status) { findOpts.status = params.status; }
|
||||||
|
|
||||||
|
|
||||||
return Discourse.TopicList.list(filter, findOpts).then(function(list) {
|
return Discourse.TopicList.list(filter, findOpts).then(function(list) {
|
||||||
|
@ -96,7 +98,7 @@ function buildCategoryRoute(filter, params) {
|
||||||
return Discourse.Category.findBySlug(params.slug, params.parentSlug);
|
return Discourse.Category.findBySlug(params.slug, params.parentSlug);
|
||||||
},
|
},
|
||||||
|
|
||||||
afterModel: function(model) {
|
afterModel: function(model, transaction) {
|
||||||
var self = this,
|
var self = this,
|
||||||
noSubcategories = params && !!params.no_subcategories,
|
noSubcategories = params && !!params.no_subcategories,
|
||||||
filterMode = "category/" + Discourse.Category.slugFor(model) + (noSubcategories ? "/none" : "") + "/l/" + filter,
|
filterMode = "category/" + Discourse.Category.slugFor(model) + (noSubcategories ? "/none" : "") + "/l/" + filter,
|
||||||
|
@ -111,6 +113,13 @@ function buildCategoryRoute(filter, params) {
|
||||||
opts.canChangeCategoryNotificationLevel = Discourse.User.current();
|
opts.canChangeCategoryNotificationLevel = Discourse.User.current();
|
||||||
this.controllerFor('navigation/category').setProperties(opts);
|
this.controllerFor('navigation/category').setProperties(opts);
|
||||||
|
|
||||||
|
var queryParams = transaction.queryParams;
|
||||||
|
params = params || {};
|
||||||
|
|
||||||
|
if (queryParams && queryParams.order) { params.order = queryParams.order; }
|
||||||
|
if (queryParams && queryParams.ascending) { params.ascending = queryParams.ascending; }
|
||||||
|
if (queryParams && queryParams.status) { params.status = queryParams.status; }
|
||||||
|
|
||||||
return Discourse.TopicList.list(listFilter, params).then(function(list) {
|
return Discourse.TopicList.list(listFilter, params).then(function(list) {
|
||||||
var tracking = Discourse.TopicTrackingState.current();
|
var tracking = Discourse.TopicTrackingState.current();
|
||||||
if (tracking) {
|
if (tracking) {
|
||||||
|
|
Loading…
Reference in a new issue