FIX: sane badge ordering on user page
This commit is contained in:
parent
27d43ad6c0
commit
a75b9db4a2
|
@ -1,3 +1,18 @@
|
|||
export default Ember.ArrayController.extend({
|
||||
sortProperties: ['grouping_position', 'badge.badge_type.sort_order', 'badge.name', 'badge.id']
|
||||
sortProperties: ['badge.badge_type.sort_order', 'badge.name'],
|
||||
orderBy: function(ub1, ub2){
|
||||
var sr1 = ub1.get('badge.badge_type.sort_order');
|
||||
var sr2 = ub2.get('badge.badge_type.sort_order');
|
||||
|
||||
|
||||
if(sr1 > sr2) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(sr2 > sr1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return ub1.get('badge.name') < ub2.get('badge.name') ? -1 : 1;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<section class='user-content user-badges-list'>
|
||||
{{#each ub in model}}
|
||||
{{#each ub in controller}}
|
||||
{{user-badge badge=ub.badge count=ub.count}}
|
||||
{{/each}}
|
||||
</section>
|
||||
|
|
Loading…
Reference in New Issue