Make components read only for anonymous users

This commit is contained in:
dpen2000 2014-04-28 01:58:26 -04:00
parent 3165a2b654
commit 0a8ec096f7

View file

@ -50,6 +50,7 @@ module.exports = class LevelComponentEditView extends View
supermodel: @supermodel
schema: schema
data: data
readonly: @me.get('anonymous')
callbacks: {change: @onComponentSettingsEdited}
@componentSettingsTreema = @$el.find('#edit-component-treema').treema treemaOptions
@componentSettingsTreema.build()
@ -67,6 +68,7 @@ module.exports = class LevelComponentEditView extends View
supermodel: @supermodel
schema: LevelComponent.schema.properties.configSchema
data: @levelComponent.get 'configSchema'
readonly: @me.get('anonymous')
callbacks: {change: @onConfigSchemaEdited}
@configSchemaTreema = @$el.find('#config-schema-treema').treema treemaOptions
@configSchemaTreema.build()
@ -83,6 +85,7 @@ module.exports = class LevelComponentEditView extends View
editorEl = $('<div></div>').text(@levelComponent.get('code')).addClass('inner-editor')
@$el.find('#component-code-editor').empty().append(editorEl)
@editor = ace.edit(editorEl[0])
@editor.setReadOnly(me.get('anonymous'))
session = @editor.getSession()
session.setMode 'ace/mode/coffee'
session.setTabSize 2