2015-11-30 19:20:24 -05:00
|
|
|
Classroom = require 'models/Classroom'
|
2015-11-17 19:09:29 -05:00
|
|
|
ModalView = require 'views/core/ModalView'
|
|
|
|
template = require 'templates/courses/classroom-settings-modal'
|
|
|
|
|
|
|
|
module.exports = class AddLevelSystemModal extends ModalView
|
|
|
|
id: 'classroom-settings-modal'
|
|
|
|
template: template
|
2015-11-30 19:20:24 -05:00
|
|
|
|
2015-11-17 19:09:29 -05:00
|
|
|
events:
|
|
|
|
'click #save-settings-btn': 'onClickSaveSettingsButton'
|
|
|
|
|
|
|
|
initialize: (options) ->
|
|
|
|
@classroom = options.classroom
|
2015-12-04 17:11:17 -05:00
|
|
|
if @classroom
|
|
|
|
application.tracker?.trackEvent 'Classroom started edit settings', category: 'Courses', classroomID: @classroom.id
|
|
|
|
else
|
|
|
|
application.tracker?.trackEvent 'Classroom started edit settings', category: 'Courses'
|
2015-11-17 19:09:29 -05:00
|
|
|
|
|
|
|
onClickSaveSettingsButton: ->
|
2015-11-30 19:20:24 -05:00
|
|
|
name = $('.settings-name-input').val()
|
|
|
|
unless @classroom
|
|
|
|
return unless name
|
|
|
|
@classroom = new Classroom({ name: name })
|
|
|
|
if name
|
2015-11-17 19:09:29 -05:00
|
|
|
@classroom.set('name', name)
|
|
|
|
description = $('.settings-description-input').val()
|
|
|
|
@classroom.set('description', description)
|
|
|
|
@classroom.set('aceConfig', {
|
|
|
|
language: @$('#programming-language-select').val()
|
|
|
|
})
|
2015-11-30 19:20:24 -05:00
|
|
|
@classroom.save()
|
2015-11-17 19:09:29 -05:00
|
|
|
@hide()
|