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:
Scott Erickson 2014-12-23 09:42:24 -05:00
parent b567e737cd
commit 96c8e035cf
5 changed files with 41 additions and 1 deletions

View file

@ -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

View file

@ -39,6 +39,6 @@ block outer_content
#right-column
#campaign-view
#campaign-level-view
#campaign-level-view.hidden
block footer

View file

@ -0,0 +1,4 @@
.jumbotron
.button.close(type="button", aria-hidden="true") ×
h1= level.get('name')
p= level.get('description')

View file

@ -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

View 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')