This commit is contained in:
Nick Winter 2014-08-30 21:16:01 -07:00
parent aa54cc32d1
commit a284c8eb37
6 changed files with 30 additions and 12 deletions

View file

@ -26,4 +26,7 @@
left: 0
right: 0
bottom: 0
top: 0px
top: 0px
#patch-component-button
display: none

View file

@ -26,4 +26,7 @@
left: 0
right: 0
bottom: 0
top: 0px
top: 0px
#patch-system-button
display: none

View file

@ -13,6 +13,10 @@ nav.navbar.navbar-default(role='navigation')
span.navbar-brand= editTitle
ul.nav.navbar-nav.navbar-right
if !component.hasWriteAccess()
li#patch-component-button
a(data-i18n="[title]common.submit_patch")
span.glyphicon-floppy-disk.glyphicon
li.dropdown
a(data-toggle='dropdown')
span.glyphicon-chevron-down.glyphicon
@ -27,10 +31,6 @@ nav.navbar.navbar-default(role='navigation')
span.unwatch.secret
span.glyphicon.glyphicon-eye-close
span.spl Unwatch
if !component.hasWriteAccess()
li#patch-component-button
a(data-i18n="common.submit_patch") Submit Patch
if !me.get('anonymous')
li#create-new-component-button
a(data-i18n="editor.level_component_b_new") Create New Component

View file

@ -11,6 +11,10 @@ nav.navbar.navbar-default(role='navigation')
a(href="#system-patches" data-toggle="tab" data-i18n="resources.patches")#system-patches-tab Patches
ul.nav.navbar-nav.navbar-right
if !me.isAdmin()
li#patch-system-button
a(data-i18n="[title]common.submit_patch")
span.glyphicon-floppy-disk.glyphicon
li.dropdown
a(data-toggle='dropdown')
span.glyphicon-chevron-down.glyphicon
@ -24,8 +28,6 @@ nav.navbar.navbar-default(role='navigation')
span.unwatch.secret
span.glyphicon.glyphicon-eye-close
span.spl Unwatch
li#patch-system-button
a(data-i18n="common.submit_patch") Submit Patch
if me.isAdmin()
li#create-new-system
a(data-i18n="editor.level_system_btn_new") Create New System

View file

@ -42,6 +42,7 @@ module.exports = class LevelComponentEditView extends CocoView
@buildCodeEditor()
@patchesView = @insertSubView(new PatchesView(@levelComponent), @$el.find('.patches-view'))
@$el.find('#component-watch-button').find('> span').toggleClass('secret') if @levelComponent.watching()
@updatePatchButton()
buildSettingsTreema: ->
data = _.pick @levelComponent.attributes, (value, key) => key in @editableSettings
@ -65,7 +66,7 @@ module.exports = class LevelComponentEditView extends CocoView
# Make sure it validates first?
for key, value of @componentSettingsTreema.data
@levelComponent.set key, value unless key is 'js' # will compile code if needed
null
@updatePatchButton()
buildConfigSchemaTreema: ->
configSchema = @levelComponent.get 'configSchema'
@ -91,6 +92,7 @@ module.exports = class LevelComponentEditView extends CocoView
onConfigSchemaEdited: =>
@levelComponent.set 'configSchema', @configSchemaTreema.data
@updatePatchButton()
buildCodeEditor: ->
@destroyAceEditor(@editor)
@ -108,7 +110,10 @@ module.exports = class LevelComponentEditView extends CocoView
onEditorChange: =>
return if @destroyed
@levelComponent.set 'code', @editor.getValue()
null
@updatePatchButton()
updatePatchButton: ->
@$el.find('#patch-component-button').toggle Boolean @levelComponent.hasLocalChanges()
endEditing: (e) ->
Backbone.Mediator.publish 'editor:level-component-editing-ended', component: @levelComponent

View file

@ -37,6 +37,7 @@ module.exports = class LevelSystemEditView extends CocoView
@buildConfigSchemaTreema()
@buildCodeEditor()
@patchesView = @insertSubView(new PatchesView(@levelSystem), @$el.find('.patches-view'))
@updatePatchButton()
buildSettingsTreema: ->
data = _.pick @levelSystem.attributes, (value, key) => key in @editableSettings
@ -59,7 +60,7 @@ module.exports = class LevelSystemEditView extends CocoView
# Make sure it validates first?
for key, value of @systemSettingsTreema.data
@levelSystem.set key, value unless key is 'js' # will compile code if needed
null
@updatePatchButton()
buildConfigSchemaTreema: ->
treemaOptions =
@ -76,6 +77,7 @@ module.exports = class LevelSystemEditView extends CocoView
onConfigSchemaEdited: =>
@levelSystem.set 'configSchema', @configSchemaTreema.data
@updatePatchButton()
buildCodeEditor: ->
@destroyAceEditor(@editor)
@ -92,7 +94,10 @@ module.exports = class LevelSystemEditView extends CocoView
onEditorChange: =>
@levelSystem.set 'code', @editor.getValue()
null
@updatePatchButton()
updatePatchButton: ->
@$el.find('#patch-system-button').toggle Boolean @levelSystem.hasLocalChanges()
endEditing: (e) ->
Backbone.Mediator.publish 'editor:level-system-editing-ended', system: @levelSystem