index.js 893 B

12345678910111213141516171819202122232425262728293031323334353637
  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': 'rank',
  9. 'rank': this.modelFor('users.rank').get('slug')
  10. });
  11. },
  12. templateName: 'users/rank/index',
  13. setupController: function(controller, model) {
  14. var routeName = this.get('templateName').replace(/\//g, '.');
  15. if (this.get('page') > 1) {
  16. routeName = routeName.replace('.index', '.page');
  17. }
  18. this.controllerFor(routeName).setProperties({
  19. 'rank': this.modelFor('users.rank'),
  20. 'model': model,
  21. 'meta': model.get('meta')
  22. });
  23. },
  24. actions: {
  25. didTransition: function() {
  26. this.set('title', {
  27. title: this.modelFor('users.rank').get('name'),
  28. parent: gettext('Users')
  29. });
  30. }
  31. }
  32. });