BattleSim/client/app/js/collections/chats/user_list.coffee

16 lines
465 B
CoffeeScript
Raw Normal View History

2016-02-01 22:19:30 +00:00
class @UserList extends Backbone.Collection
model: User
comparator: (a, b) =>
aAuthority = a.get('authority')
bAuthority = b.get('authority')
aName = "#{a.id}".toLowerCase()
bName = "#{b.id}".toLowerCase()
if aAuthority < bAuthority then 1
else if aAuthority > bAuthority then -1
else if aName < bName then -1
else if aName > bName then 1
else 0
initialize: =>