mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-29 07:24:08 -04:00
Set up the rest of the component/system buttons and nav bars.
This commit is contained in:
parent
9eff958dcb
commit
b5406b0149
4 changed files with 42 additions and 6 deletions
app
templates/editor/level/system
views/editor
|
@ -7,6 +7,8 @@ nav.navbar.navbar-default(role='navigation')
|
||||||
a(href="#system-config-schema" data-toggle="tab") Config Schema
|
a(href="#system-config-schema" data-toggle="tab") Config Schema
|
||||||
li
|
li
|
||||||
a(href="#system-settings" data-toggle="tab") Settings
|
a(href="#system-settings" data-toggle="tab") Settings
|
||||||
|
li
|
||||||
|
a(href="#system-patches" data-toggle="tab" data-i18n="resources.patches")#system-patches-tab Patches
|
||||||
|
|
||||||
ul.nav.navbar-nav.navbar-right
|
ul.nav.navbar-nav.navbar-right
|
||||||
li.dropdown
|
li.dropdown
|
||||||
|
@ -14,15 +16,15 @@ nav.navbar.navbar-default(role='navigation')
|
||||||
span.glyphicon-chevron-down.glyphicon
|
span.glyphicon-chevron-down.glyphicon
|
||||||
ul.dropdown-menu
|
ul.dropdown-menu
|
||||||
li.dropdown-header Actions
|
li.dropdown-header Actions
|
||||||
li#component-watch-button
|
li
|
||||||
a
|
a#system-watch-button
|
||||||
span.watch
|
span.watch
|
||||||
span.glyphicon.glyphicon-eye-open
|
span.glyphicon.glyphicon-eye-open
|
||||||
span.spl Watch
|
span.spl Watch
|
||||||
span.unwatch.secret
|
span.unwatch.secret
|
||||||
span.glyphicon.glyphicon-eye-close
|
span.glyphicon.glyphicon-eye-close
|
||||||
span.spl Unwatch
|
span.spl Unwatch
|
||||||
li#patch-component-button
|
li#patch-system-button
|
||||||
a(data-i18n="common.submit_patch") Submit Patch
|
a(data-i18n="common.submit_patch") Submit Patch
|
||||||
li#create-new-system
|
li#create-new-system
|
||||||
a(data-i18n="editor.level_system_btn_new") Create New System
|
a(data-i18n="editor.level_system_btn_new") Create New System
|
||||||
|
@ -41,3 +43,5 @@ nav.navbar.navbar-default(role='navigation')
|
||||||
#config-schema-treema
|
#config-schema-treema
|
||||||
.tab-pane#system-settings
|
.tab-pane#system-settings
|
||||||
#edit-system-treema
|
#edit-system-treema
|
||||||
|
.tab-pane#system-patches
|
||||||
|
.patches-view
|
|
@ -1,7 +1,7 @@
|
||||||
View = require 'views/kinds/CocoView'
|
View = require 'views/kinds/CocoView'
|
||||||
VersionHistoryView = require 'views/editor/component/versions_view'
|
|
||||||
template = require 'templates/editor/level/component/edit'
|
template = require 'templates/editor/level/component/edit'
|
||||||
LevelComponent = require 'models/LevelComponent'
|
LevelComponent = require 'models/LevelComponent'
|
||||||
|
VersionHistoryView = require 'views/editor/component/versions_view'
|
||||||
PatchesView = require 'views/editor/patches_view'
|
PatchesView = require 'views/editor/patches_view'
|
||||||
SaveVersionModal = require 'views/modal/save_version_modal'
|
SaveVersionModal = require 'views/modal/save_version_modal'
|
||||||
|
|
||||||
|
@ -12,9 +12,9 @@ module.exports = class LevelComponentEditView extends View
|
||||||
|
|
||||||
events:
|
events:
|
||||||
'click #done-editing-component-button': 'endEditing'
|
'click #done-editing-component-button': 'endEditing'
|
||||||
'click #component-history-button': 'showVersionHistory'
|
|
||||||
'click .nav a': (e) -> $(e.target).tab('show')
|
'click .nav a': (e) -> $(e.target).tab('show')
|
||||||
'click #component-patches-tab': -> @patchesView.load()
|
'click #component-patches-tab': -> @patchesView.load()
|
||||||
|
'click #component-history-button': 'showVersionHistory'
|
||||||
'click #patch-component-button': 'startPatchingComponent'
|
'click #patch-component-button': 'startPatchingComponent'
|
||||||
'click #component-watch-button': 'toggleWatchComponent'
|
'click #component-watch-button': 'toggleWatchComponent'
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ module.exports = class LevelComponentEditView extends View
|
||||||
null
|
null
|
||||||
|
|
||||||
showVersionHistory: (e) ->
|
showVersionHistory: (e) ->
|
||||||
versionHistoryView = new VersionHistoryView component:@levelComponent, @levelComponent.id
|
versionHistoryView = new VersionHistoryView {}, @levelComponent.id
|
||||||
@openModalView versionHistoryView
|
@openModalView versionHistoryView
|
||||||
Backbone.Mediator.publish 'level:view-switched', e
|
Backbone.Mediator.publish 'level:view-switched', e
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
View = require 'views/kinds/CocoView'
|
View = require 'views/kinds/CocoView'
|
||||||
template = require 'templates/editor/level/system/edit'
|
template = require 'templates/editor/level/system/edit'
|
||||||
LevelSystem = require 'models/LevelSystem'
|
LevelSystem = require 'models/LevelSystem'
|
||||||
|
VersionHistoryView = require 'views/editor/system/versions_view'
|
||||||
|
PatchesView = require 'views/editor/patches_view'
|
||||||
|
SaveVersionModal = require 'views/modal/save_version_modal'
|
||||||
|
|
||||||
module.exports = class LevelSystemEditView extends View
|
module.exports = class LevelSystemEditView extends View
|
||||||
id: "editor-level-system-edit-view"
|
id: "editor-level-system-edit-view"
|
||||||
|
@ -10,6 +13,10 @@ module.exports = class LevelSystemEditView extends View
|
||||||
events:
|
events:
|
||||||
'click #done-editing-system-button': 'endEditing'
|
'click #done-editing-system-button': 'endEditing'
|
||||||
'click .nav a': (e) -> $(e.target).tab('show')
|
'click .nav a': (e) -> $(e.target).tab('show')
|
||||||
|
'click #system-patches-tab': -> @patchesView.load()
|
||||||
|
'click #system-history-button': 'showVersionHistory'
|
||||||
|
'click #patch-system-button': 'startPatchingSystem'
|
||||||
|
'click #system-watch-button': 'toggleWatchSystem'
|
||||||
|
|
||||||
constructor: (options) ->
|
constructor: (options) ->
|
||||||
super options
|
super options
|
||||||
|
@ -26,6 +33,7 @@ module.exports = class LevelSystemEditView extends View
|
||||||
@buildSettingsTreema()
|
@buildSettingsTreema()
|
||||||
@buildConfigSchemaTreema()
|
@buildConfigSchemaTreema()
|
||||||
@buildCodeEditor()
|
@buildCodeEditor()
|
||||||
|
@patchesView = @insertSubView(new PatchesView(@levelSystem), @$el.find('.patches-view'))
|
||||||
|
|
||||||
buildSettingsTreema: ->
|
buildSettingsTreema: ->
|
||||||
data = _.pick @levelSystem.attributes, (value, key) => key in @editableSettings
|
data = _.pick @levelSystem.attributes, (value, key) => key in @editableSettings
|
||||||
|
@ -88,6 +96,21 @@ module.exports = class LevelSystemEditView extends View
|
||||||
Backbone.Mediator.publish 'level-system-editing-ended', levelSystem: @levelSystem
|
Backbone.Mediator.publish 'level-system-editing-ended', levelSystem: @levelSystem
|
||||||
null
|
null
|
||||||
|
|
||||||
|
showVersionHistory: (e) ->
|
||||||
|
versionHistoryView = new VersionHistoryView {}, @levelSystem.id
|
||||||
|
@openModalView versionHistoryView
|
||||||
|
Backbone.Mediator.publish 'level:view-switched', e
|
||||||
|
|
||||||
|
startPatchingSystem: (e) ->
|
||||||
|
@openModalView new SaveVersionModal({model:@levelSystem})
|
||||||
|
Backbone.Mediator.publish 'level:view-switched', e
|
||||||
|
|
||||||
|
toggleWatchSystem: ->
|
||||||
|
console.log 'toggle watch system?'
|
||||||
|
button = @$el.find('#system-watch-button')
|
||||||
|
@levelSystem.watch(button.find('.watch').is(':visible'))
|
||||||
|
button.find('> span').toggleClass('secret')
|
||||||
|
|
||||||
destroy: ->
|
destroy: ->
|
||||||
@editor?.destroy()
|
@editor?.destroy()
|
||||||
super()
|
super()
|
||||||
|
|
9
app/views/editor/system/versions_view.coffee
Executable file
9
app/views/editor/system/versions_view.coffee
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
VersionsModalView = require 'views/modal/versions_modal'
|
||||||
|
|
||||||
|
module.exports = class SystemVersionsView extends VersionsModalView
|
||||||
|
id: "editor-system-versions-view"
|
||||||
|
url: "/db/level.system/"
|
||||||
|
page: "system"
|
||||||
|
|
||||||
|
constructor: (options, @ID) ->
|
||||||
|
super options, ID, require 'models/LevelSystem'
|
Loading…
Add table
Add a link
Reference in a new issue