This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/controllers/discovery-sortable.js.es6
Régis Hanol 1a3e9cf571 FIX: sorting was not working in /top
PERF: remove double request when sorting topics lists
2015-10-12 21:58:40 +02:00

22 lines
784 B
JavaScript

// Just add query params here to have them automatically passed to topic list filters.
export var queryParams = {
order: { replace: true, refreshModel: true },
ascending: { replace: true, refreshModel: true },
status: { replace: true, refreshModel: true },
state: { replace: true, refreshModel: true },
search: { replace: true, refreshModel: true },
max_posts: { replace: true, refreshModel: true },
q: { replace: true, refreshModel: true }
};
// Basic controller options
var controllerOpts = {
needs: ['discovery/topics'],
queryParams: Ember.keys(queryParams)
};
// Aliases for the values
controllerOpts.queryParams.forEach(p => controllerOpts[p] = Em.computed.alias(`controllers.discovery/topics.${p}`));
export default Ember.Controller.extend(controllerOpts);