Merge branch 'SetReadOnlyChanges' of https://github.com/dpen2000/codecombat into dpen2000-SetReadOnlyChanges

This commit is contained in:
Scott Erickson 2014-05-06 11:19:11 -07:00
commit ffdf11133e
6 changed files with 10 additions and 7 deletions

View file

@ -49,7 +49,7 @@ module.exports = class ArticleEditView extends View
data: data
filePath: "db/thang.type/#{@article.get('original')}"
schema: Article.schema
readOnly: true unless me.isAdmin() or @article.hasWriteAccess(me)
readOnly: me.get('anonymous')
callbacks:
change: @pushChangesToPreview
@treema = @$el.find('#article-treema').treema(options)

View file

@ -51,6 +51,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()
@ -68,6 +69,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()
@ -84,6 +86,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

View file

@ -58,7 +58,7 @@ module.exports = class ScriptsTabView extends View
thangIDs: thangIDs
dimensions: @dimensions
supermodel: @supermodel
readOnly: true unless me.isAdmin() or @level.hasWriteAccess(me)
readOnly: me.get('anonymous')
callbacks:
change: @onScriptChanged
nodeClasses:

View file

@ -34,7 +34,7 @@ module.exports = class SettingsTabView extends View
supermodel: @supermodel
schema: schema
data: data
readOnly: true unless me.isAdmin() or @level.hasWriteAccess(me)
readOnly: me.get('anonymous')
callbacks: {change: @onSettingsChanged}
thangIDs: thangIDs
nodeClasses:

View file

@ -49,7 +49,7 @@ module.exports = class LevelSystemEditView extends View
schema: schema
data: data
callbacks: {change: @onSystemSettingsEdited}
treemaOptions.readOnly = true unless me.isAdmin()
treemaOptions.readOnly = me.get('anonymous')
@systemSettingsTreema = @$el.find('#edit-system-treema').treema treemaOptions
@systemSettingsTreema.build()
@systemSettingsTreema.open()
@ -67,7 +67,7 @@ module.exports = class LevelSystemEditView extends View
schema: LevelSystem.schema.properties.configSchema
data: @levelSystem.get 'configSchema'
callbacks: {change: @onConfigSchemaEdited}
treemaOptions.readOnly = true unless me.isAdmin()
treemaOptions.readOnly = me.get('anonymous')
@configSchemaTreema = @$el.find('#config-schema-treema').treema treemaOptions
@configSchemaTreema.build()
@configSchemaTreema.open()
@ -83,7 +83,7 @@ module.exports = class LevelSystemEditView extends View
editorEl = $('<div></div>').text(@levelSystem.get('code')).addClass('inner-editor')
@$el.find('#system-code-editor').empty().append(editorEl)
@editor = ace.edit(editorEl[0])
@editor.setReadOnly(not me.isAdmin())
@editor.setReadOnly(me.get('anonymous'))
session = @editor.getSession()
session.setMode 'ace/mode/coffee'
session.setTabSize 2

View file

@ -53,7 +53,7 @@ module.exports = class SystemsTabView extends View
supermodel: @supermodel
schema: Level.schema.properties.systems
data: systems
readOnly: true unless me.isAdmin() or @level.hasWriteAccess(me)
readOnly: me.get('anonymous')
callbacks:
change: @onSystemsChanged
select: @onSystemSelected