mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
ef0547f72a
In TeacherClassView, when a teacher assigns a paid course to any unenrolled student, the view automatically enrolls those students, rather than requiring the teacher to enroll those students manually first. Update copy throughout. Also add back (smaller) padding to progress dots in TeacherClassView.
38 lines
1 KiB
CoffeeScript
38 lines
1 KiB
CoffeeScript
CocoModel = require 'models/CocoModel'
|
|
|
|
module.exports = class CocoCollection extends Backbone.Collection
|
|
loaded: false
|
|
model: null
|
|
|
|
initialize: (models, options) ->
|
|
options ?= {}
|
|
@model ?= options.model
|
|
if not @model
|
|
console.error @constructor.name, 'does not have a model defined. This will not do!'
|
|
super(models, options)
|
|
@setProjection options.project
|
|
if options.url then @url = options.url
|
|
@once 'sync', =>
|
|
@loaded = true
|
|
model.loaded = true for model in @models
|
|
if window.application?.testing
|
|
@fakeRequests = []
|
|
@on 'request', -> @fakeRequests.push jasmine.Ajax.requests.mostRecent()
|
|
|
|
getURL: ->
|
|
return if _.isString @url then @url else @url()
|
|
|
|
fetch: (options) ->
|
|
options ?= {}
|
|
if @project
|
|
options.data ?= {}
|
|
options.data.project = @project.join(',')
|
|
@jqxhr = super(options)
|
|
@loading = true
|
|
@jqxhr
|
|
|
|
setProjection: (@project) ->
|
|
|
|
stringify: -> return JSON.stringify(@toJSON())
|
|
|
|
wait: (event) -> new Promise((resolve) => @once(event, resolve))
|