mirror of
https://gitlab.com/Deukhoofd/BattleSim.git
synced 2025-10-28 18:20:04 +00:00
Lots of stuff
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
class @BattleCollection extends Backbone.Collection
|
||||
model: Battle
|
||||
|
||||
isPlaying: ->
|
||||
@find((battle) -> battle.isPlaying())?
|
||||
|
||||
playingBattles: ->
|
||||
@filter((battle) -> battle.isPlaying())
|
||||
2
client/app/js/collections/chats/private_messages.coffee
Normal file
2
client/app/js/collections/chats/private_messages.coffee
Normal file
@@ -0,0 +1,2 @@
|
||||
class @PrivateMessages extends Backbone.Collection
|
||||
model: PrivateMessage
|
||||
9
client/app/js/collections/chats/rooms.coffee
Normal file
9
client/app/js/collections/chats/rooms.coffee
Normal file
@@ -0,0 +1,9 @@
|
||||
class @Rooms extends Backbone.Collection
|
||||
model: Room
|
||||
|
||||
# Delegate room events to every single room in this collection.
|
||||
for eventName in Room::EVENTS
|
||||
do (eventName) =>
|
||||
this::[eventName] = (args...) ->
|
||||
@each (room) ->
|
||||
room[eventName].apply(room, args)
|
||||
15
client/app/js/collections/chats/user_list.coffee
Normal file
15
client/app/js/collections/chats/user_list.coffee
Normal file
@@ -0,0 +1,15 @@
|
||||
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: =>
|
||||
2
client/app/js/collections/replays/replays.coffee
Normal file
2
client/app/js/collections/replays/replays.coffee
Normal file
@@ -0,0 +1,2 @@
|
||||
class @Replays extends Backbone.Collection
|
||||
model: Replay
|
||||
Reference in New Issue
Block a user