added select statement for programming language

This commit is contained in:
Dominik Kundel 2014-03-15 22:00:29 +01:00
parent be8b61fda4
commit 46133ab85d
5 changed files with 26 additions and 8 deletions
app
locale
templates/play/level/modal
views/play/level/modal
server/users

View file

@ -209,6 +209,8 @@ module.exports = nativeDescription: "Deutsch", englishDescription: "German", tra
skip_tutorial: "Überspringen (Esc)"
editor_config: "Editor Einstellungen"
editor_config_title: "Editor Einstellungen"
editor_config_language_label: "Programmiersprache"
editor_config_language_description: "Bestimme die Programmiersprache in der du arbeiten möchtest."
editor_config_keybindings_label: "Tastenbelegung"
editor_config_keybindings_default: "Standard (Ace)"
editor_config_keybindings_description: "Fügt zusätzliche Tastenkombinationen, bekannt aus anderen Editoren, hinzu"
@ -216,8 +218,8 @@ module.exports = nativeDescription: "Deutsch", englishDescription: "German", tra
editor_config_invisibles_description: "Zeigt unsichtbare Zeichen wie Leertasten an."
editor_config_indentguides_label: "Zeige Einrückungshilfe"
editor_config_indentguides_description: "Zeigt vertikale Linien an um Einrückungen besser zu sehen."
# editor_config_behaviors_label: "Smart Behaviors"
# editor_config_behaviors_description: "Autocompletes brackets, braces, and quotes."
editor_config_behaviors_label: "Intelligentes Verhalten"
editor_config_behaviors_description: "Vervollständigt automatisch Klammern und Anführungszeichen."
admin:
av_title: "Administrator Übersicht"

View file

@ -209,6 +209,8 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr
skip_tutorial: "Skip (esc)"
editor_config: "Editor Config"
editor_config_title: "Editor Configuration"
editor_config_language_label: "Programming Language"
editor_config_language_description: "Define the programming language you want to code in."
editor_config_keybindings_label: "Key Bindings"
editor_config_keybindings_default: "Default (Ace)"
editor_config_keybindings_description: "Adds additional shortcuts known from the common editors."

View file

@ -5,14 +5,20 @@
.modal-body
.form
.form-group.select-group
label.control-label(for="tome-language" data-i18n="play_level.editor_config_language_label") Programming Language
select#tome-language(name="language")
option(value="javascript" selected=(language === "javascript")) JavaScript
option(value="coffeescript" selected=(language === "coffeescript")) CoffeeScript
span.help-block(data-i18n="play_level.editor_config_language_description") Define the programming language you want to code in.
.form-group.select-group
label.control-label(for="tome-key-bindings" data-i18n="play_level.editor_config_keybindings_label") Key Bindings
select#tome-key-bindings(name="keyBindings", type="checkbox", checked=multiplayer)
select#tome-key-bindings(name="keyBindings")
option(value="default" selected=(keyBindings === "default") data-i18n="play_level.editor_config_keybindings_default") Default (Ace)
option(value="vim" selected=(keyBindings === "vim")) Vim
option(value="emacs" selected=(keyBindings === "emacs")) Emacs
span.help-block(data-i18n="play_level.editor_config_keybindings_description") Adds additional shortcuts known from the common editors.
.form-group.checkbox
.form-group.checkboxd
label(for="tome-invisibles")
input#tome-invisibles(name="invisibles", type="checkbox", checked=invisibles)
span(data-i18n="play_level.editor_config_invisibles_label") Show Invisibles

View file

@ -8,14 +8,16 @@ module.exports = class EditorConfigModal extends View
aceConfig: {}
defaultConfig:
language: 'javascript'
keyBindings: 'default'
invisibles: false
indentGuides: false
behaviors: false
events:
'change #tome-invisibles': 'updateInvisiblesSelection'
'change #tome-key-bindings': 'updateKeyBindingsSelection'
'change #tome-invisibles': 'updateInvisibles'
'change #tome-language': 'updateLanguage'
'change #tome-key-bindings': 'updateKeyBindings'
'change #tome-indent-guides': 'updateIndentGuides'
'change #tome-behaviors': 'updateBehaviors'
@ -26,16 +28,20 @@ module.exports = class EditorConfigModal extends View
@aceConfig = _.cloneDeep me.get('aceConfig') ? {}
@aceConfig = _.defaults @aceConfig, @defaultConfig
c = super()
c.language = @aceConfig.language
c.keyBindings = @aceConfig.keyBindings
c.invisibles = @aceConfig.invisibles
c.indentGuides = @aceConfig.indentGuides
c.behaviors = @aceConfig.behaviors
c
updateInvisiblesSelection: ->
updateLanguage: ->
@aceConfig.language = @$el.find('#tome-language').val()
updateInvisibles: ->
@aceConfig.invisibles = @$el.find('#tome-invisibles').prop('checked')
updateKeyBindingsSelection: ->
updateKeyBindings: ->
@aceConfig.keyBindings = @$el.find('#tome-key-bindings').val()
updateIndentGuides: ->
@ -48,6 +54,7 @@ module.exports = class EditorConfigModal extends View
super()
onHidden: ->
@aceConfig.language = @$el.find('#tome-language').val()
@aceConfig.invisibles = @$el.find('#tome-invisibles').prop('checked')
@aceConfig.keyBindings = @$el.find('#tome-key-bindings').val()
@aceConfig.indentGuides = @$el.find('#tome-indent-guides').prop('checked')

View file

@ -46,6 +46,7 @@ UserSchema = c.object {},
colorConfig: c.object {additionalProperties: c.colorConfig()}
aceConfig: c.object {},
language: {type: 'string', 'default': 'javascript', 'enum': ['javascript', 'coffeescript']}
keyBindings: {type: 'string', 'default': 'default', 'enum': ['default', 'vim', 'emacs']}
invisibles: {type: 'boolean', 'default': false}
indentGuides: {type: 'boolean', 'default': false}