mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-25 00:28:31 -05:00
27 lines
806 B
CoffeeScript
27 lines
806 B
CoffeeScript
|
ModalView = require 'views/core/ModalView'
|
||
|
template = require 'templates/courses/change-course-language-modal'
|
||
|
|
||
|
module.exports = class ChangeCourseLanguageModal extends ModalView
|
||
|
id: 'change-course-language-modal'
|
||
|
template: template
|
||
|
|
||
|
events:
|
||
|
'click .lang-choice-btn': 'onClickLanguageChoiceButton'
|
||
|
|
||
|
onClickLanguageChoiceButton: (e) ->
|
||
|
@chosenLanguage = $(e.target).data('language')
|
||
|
aceConfig = _.clone(me.get('aceConfig') or {})
|
||
|
aceConfig.language = @chosenLanguage
|
||
|
me.set('aceConfig', aceConfig)
|
||
|
res = me.patch()
|
||
|
if res
|
||
|
@$('#choice-area').hide()
|
||
|
@$('#saving-progress').removeClass('hide')
|
||
|
@listenToOnce me, 'sync', @onLanguageSettingSaved
|
||
|
else
|
||
|
@onLanguageSettingSaved()
|
||
|
|
||
|
onLanguageSettingSaved: ->
|
||
|
@trigger('set-language')
|
||
|
@hide()
|