mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-14 09:41:35 -05:00
f47640e59a
Removed some unused styles, a template, a view and changed the class name of some views
38 lines
1.3 KiB
CoffeeScript
38 lines
1.3 KiB
CoffeeScript
Classroom = require 'models/Classroom'
|
|
ModalView = require 'views/core/ModalView'
|
|
template = require 'templates/courses/classroom-settings-modal'
|
|
|
|
module.exports = class ClassroomSettingsModal extends ModalView
|
|
id: 'classroom-settings-modal'
|
|
template: template
|
|
|
|
events:
|
|
'click #save-settings-btn': 'onClickSaveSettingsButton'
|
|
|
|
initialize: (options) ->
|
|
@classroom = options.classroom
|
|
if @classroom
|
|
application.tracker?.trackEvent 'Classroom started edit settings', category: 'Courses', classroomID: @classroom.id
|
|
else
|
|
application.tracker?.trackEvent 'Create new class', category: 'Courses'
|
|
|
|
afterRender: ->
|
|
super()
|
|
disableLangSelect = @classroom?.get('members')?.length > 0
|
|
@$('#programming-language-select').prop('disabled', disableLangSelect)
|
|
@$('.language-locked').toggle(disableLangSelect)
|
|
|
|
onClickSaveSettingsButton: ->
|
|
name = $('.settings-name-input').val()
|
|
unless @classroom
|
|
return unless name
|
|
@classroom = new Classroom({ name: name })
|
|
if name
|
|
@classroom.set('name', name)
|
|
description = $('.settings-description-input').val()
|
|
@classroom.set('description', description)
|
|
@classroom.set('aceConfig', {
|
|
language: @$('#programming-language-select').val()
|
|
})
|
|
@classroom.save()
|
|
@hide()
|