1 class Editor.PanelEditor.Dock extends Editor.EditorModule.DockBase
\r
5 initialize: (options) ->
\r
7 @root_bay = new Editor.EditorModule.DockModule.RootBay({
\r
8 parent: this, index: 0, name: 'panel'
\r
12 new Editor.EditorModule.DockModule.TabModule.RootBayLabel({
\r
13 parent: @root_bay, caption: 'panel'
\r
15 new Editor.EditorModule.DockModule.TabModule.RootBayBody({
\r
19 @element_bay = new Editor.EditorModule.DockModule.ElementBay({
\r
20 parent: this, index: 1, name: 'elements'
\r
24 new Editor.EditorModule.DockModule.TabModule.ElementBayLabel({
\r
25 parent: @element_bay, caption: 'elements'
\r
27 new Editor.EditorModule.DockModule.TabModule.ElementBayBody({
\r
28 parent: @element_bay
\r
31 @scenario_bay = new Editor.EditorModule.DockModule.ScenarioBay({
\r
32 parent: this, index: 2, name: 'scenario'
\r
36 new Editor.EditorModule.DockModule.TabModule.ScenarioBayLabel({
\r
37 parent: @scenario_bay, caption: 'scenario'
\r
39 new Editor.EditorModule.DockModule.TabModule.ScenarioBayBody({
\r
40 parent: @scenario_bay
\r
43 @listenTo(@root_bay.body, 'http_post', @http_post)
\r
44 @listenTo(@element_bay, 'add:credit', @add_credit)
\r
45 @listenTo(@element_bay, 'pick', @pick)
\r
49 l = _.map @tabs, (tab) ->
\r
51 labels = new Tag.Ul({contents: l, class_name: @dom_labels_class()})
\r
52 this.$el.append(labels.render().el)
\r
53 _.each @tabs, (tab) =>
\r
54 this.$el.append(tab.render().el)
\r
58 @element_bay.init_tabs()
\r
59 @scenario_bay.init_tabs()
\r
61 activate: (e, ui) ->
\r
62 ui.newPanel.trigger('activate')
\r
69 @editor().dom_id() + '-dock'
\r
72 @editor().dom_class() + '-dock'
\r
74 dom_labels_class: () ->
\r
75 @dom_class() + '-labels'
\r
77 http_post: (url, root_form) ->
\r
78 @trigger('http_post', url, this) # send dock
\r
81 add_credit: (element) ->
\r
82 @trigger('add:credit', element)
\r
85 attrs = @root_bay.save_data()
\r
86 _.extend(attrs, @element_bay.save_data())
\r
90 t = @scenario_bay.length()
\r
91 z = @element_bay.new_tab.label.z() + 1
\r
92 new_item.set({z: z, t: t}, {silent: true})
\r
93 @scenario_bay.add_element(new_item)
\r
94 @trigger('add:element', new_item)
\r