mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-25 00:28:31 -05:00
171e4f888e
Adding edit class settings modal Adding create new class modal Repurposing ClassroomSettingsModal for create new class too.
28 lines
851 B
CoffeeScript
28 lines
851 B
CoffeeScript
Classroom = require 'models/Classroom'
|
|
ModalView = require 'views/core/ModalView'
|
|
template = require 'templates/courses/classroom-settings-modal'
|
|
|
|
module.exports = class AddLevelSystemModal extends ModalView
|
|
id: 'classroom-settings-modal'
|
|
template: template
|
|
|
|
events:
|
|
'click #save-settings-btn': 'onClickSaveSettingsButton'
|
|
|
|
initialize: (options) ->
|
|
@classroom = options.classroom
|
|
|
|
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()
|