active.js 721 B

1234567891011121314151617181920212223242526272829303132333435
  1. import MisagoRoute from 'misago/routes/misago';
  2. export default MisagoRoute.extend({
  3. beforeModel: function() {
  4. this.store.unloadAll('user');
  5. },
  6. model: function() {
  7. return this.store.find('user', {
  8. 'list': 'active'
  9. });
  10. },
  11. afterModel: function(users) {
  12. users.forEach(function(model, index) {
  13. model.set('meta.ranking', index + 1);
  14. });
  15. },
  16. setupController: function(controller, model) {
  17. this.controllerFor('users.active').setProperties({
  18. 'model': model,
  19. 'meta': model.get('meta')
  20. });
  21. },
  22. actions: {
  23. didTransition: function() {
  24. this.set('title', {
  25. title: gettext('Most Active'),
  26. parent: gettext('Users')
  27. });
  28. }
  29. }
  30. });