mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Added a CampaignLevelView stub that appears when you double click a level node or one of its children on the treema.
This commit is contained in:
parent
b567e737cd
commit
96c8e035cf
5 changed files with 41 additions and 1 deletions
|
@ -17,3 +17,12 @@
|
|||
bottom: 0
|
||||
right: 0
|
||||
width: 75%
|
||||
|
||||
#campaign-level-view
|
||||
position: absolute
|
||||
top: 0
|
||||
left: 0
|
||||
right: 0
|
||||
bottom: 0
|
||||
background-color: white
|
||||
z-index: 3
|
|
@ -39,6 +39,6 @@ block outer_content
|
|||
|
||||
#right-column
|
||||
#campaign-view
|
||||
#campaign-level-view
|
||||
#campaign-level-view.hidden
|
||||
|
||||
block footer
|
||||
|
|
4
app/templates/editor/campaign/campaign-level-view.jade
Normal file
4
app/templates/editor/campaign/campaign-level-view.jade
Normal file
|
@ -0,0 +1,4 @@
|
|||
.jumbotron
|
||||
.button.close(type="button", aria-hidden="true") ×
|
||||
h1= level.get('name')
|
||||
p= level.get('description')
|
|
@ -9,6 +9,7 @@ treemaExt = require 'core/treema-ext'
|
|||
utils = require 'core/utils'
|
||||
SaveCampaignModal = require './SaveCampaignModal'
|
||||
RelatedAchievementsCollection = require 'collections/RelatedAchievementsCollection'
|
||||
CampaignLevelView = require './CampaignLevelView'
|
||||
|
||||
achievementProject = ['related', 'rewards', 'name', 'slug']
|
||||
thangTypeProject = ['name', 'original', 'slug']
|
||||
|
@ -242,6 +243,13 @@ module.exports = class CampaignEditorView extends RootView
|
|||
@campaign.set key, value for key, value of @treema.data
|
||||
@campaignView.setCampaign(@campaign)
|
||||
|
||||
onTreemaDoubleClicked: (e, node) =>
|
||||
path = node.getPath()
|
||||
return unless _.string.startsWith path, '/levels/'
|
||||
original = path.split('/')[2]
|
||||
level = @supermodel.getModelByOriginal Level, original
|
||||
@insertSubView new CampaignLevelView({}, level)
|
||||
|
||||
onCampaignLevelMoved: (e) ->
|
||||
path = "levels/#{e.levelOriginal}/position"
|
||||
@treema.set path, e.position
|
||||
|
|
19
app/views/editor/campaign/CampaignLevelView.coffee
Normal file
19
app/views/editor/campaign/CampaignLevelView.coffee
Normal file
|
@ -0,0 +1,19 @@
|
|||
CocoView = require 'views/core/CocoView'
|
||||
|
||||
module.exports = class CampaignLevelView extends CocoView
|
||||
id: 'campaign-level-view'
|
||||
template: require 'templates/editor/campaign/campaign-level-view'
|
||||
|
||||
events:
|
||||
'click .close': 'onClickClose'
|
||||
|
||||
constructor: (options, @level) ->
|
||||
super(options)
|
||||
|
||||
getRenderData: ->
|
||||
c = super()
|
||||
c.level = @level
|
||||
c
|
||||
|
||||
onClickClose: ->
|
||||
@$el.addClass('hidden')
|
Loading…
Reference in a new issue