codecombat/app/collections/Classrooms.coffee

23 lines
558 B
CoffeeScript
Raw Normal View History

2016-03-30 16:57:19 -04:00
Classroom = require 'models/Classroom'
CocoCollection = require 'collections/CocoCollection'
module.exports = class Classrooms extends CocoCollection
model: Classroom
url: '/db/classroom'
initialize: ->
@on 'sync', =>
for classroom in @models
classroom.capitalizeLanguageName()
super(arguments...)
fetchMine: (options={}) ->
options.data ?= {}
options.data.ownerID = me.id
@fetch(options)
fetchByOwner: (ownerID, options={}) ->
options.data ?= {}
options.data.ownerID = ownerID
@fetch(options)