@panel = Panel.edit(params[:id], @operators)
respond_to do |format|
format.html {
+ @editor = Editor::Editor.new @panel, @operators
+ render :template => 'templates/r/editor/editor', :locals => {
+ :editor => @editor
+ }
}
format.js
end
]
end
- def field_tag_attributes column, opt = {}
+ def field_tag_attributes column, no_attr, opt = {}
self.tag_attributes(column).merge(
{:column => column}
).merge(opt)
<div class="field">
<%= f.label :caption %>
- <%= f.text_field :caption, @panel.field_tag_attributes(:caption, 'data-model' => 'panel') -%>
+ <%= f.text_field :caption, @panel.field_tag_attributes(:caption, 0, 'data-model' => 'panel') -%>
</div>
<div class="row_break">
</div>
<div class="field">
<%= f.label :width %>
- <%= f.number_field :width, @panel.field_tag_attributes(:width, :size => 5, 'data-model' => 'panel') %>
+ <%= f.number_field :width, @panel.field_tag_attributes(:width, 0, :size => 5, 'data-model' => 'panel') %>
</div>
<div class="field">
<%= f.label :height %>
- <%= f.number_field :height, @panel.field_tag_attributes(:height, :size => 5, 'data-model' => 'panel') %>
+ <%= f.number_field :height, @panel.field_tag_attributes(:height, 0, :size => 5, 'data-model' => 'panel') %>
</div>
<div class="row_break">
</div>
<div class="field">
<%= f.label :border %>
- <%= f.number_field :border, @panel.field_tag_attributes(:border, :size => 5, 'data-model' => 'panel') %>
+ <%= f.number_field :border, @panel.field_tag_attributes(:border, 0, :size => 5, 'data-model' => 'panel') %>
</div>
<div class="field">
<%= f.label :publish %>
<div class="row_break">
</div>
<% unless @panel.new_record? %>
- <%= f.hidden_field :id, @panel.field_tag_attributes(:id, 'data-model' => 'panel') %>
+ <%= f.hidden_field :id, @panel.field_tag_attributes(:id, 0, 'data-model' => 'panel') %>
<% end %>
<div class="actions">
<%= f.submit 'panels.submit', :class => "submit" %>
+++ /dev/null
-<div id="tabs-3">
- <div class="tsort-box">
- <ul class="board-labels tsort tsort-tabs-nav" <%= raw @panel.tag_attr(:tsort) -%>>
- <% bay.boards.each do |board| %>
- <%= board.label render elm.path_name + '/element_face', :elm => elm %>
- <li <%= raw elm.tag_attr(:tsort) -%>>
- <div class="elements-tab">
- </div>
- </li>
- <% end %>
- </ul>
- </div>
- <div class="scenario" <%= raw @panel.tag_attr(:scenario) -%>>
- <% @panel.panel_elements.each do |elm| %>
- <div <%= raw elm.tag_attr() -%>>
- <%= render elm.scenario_template, :elm => elm, :no_attr => 0 %>
- </div>
- <% end %>
- </div>
- <div class="tsort-row-break">
- </div>
-</div>
-<div id="tabs" class="panel-editor" panel_id="<%= @panel.tag_panel_id -%>" current="1">
+<div id="<%= dock.dom_id -%>" class="<%= dock.dom_class -%>" panel_id="<%= dock.root_item.tag_panel_id -%>" current="1">
- <% dock.bodies.each do |body| %>
- <%= render 'templates/r/editor/dock_label', :label => body.label %>
- <% end %>
- <% dock.bodies.each do |body| %>
- <%= render body.bay.template_name, :bay => body.bay %>
- <% end %>
+ <%= render dock.labels_template_name, :dock => dock %>
+ <%= render dock.bodys_template_name, :dock => dock %>
</div>
+++ /dev/null
-<li id="<%= label.label_id %>">
- <a href="#<%= label.bay_id %>">
- <%= label.caption %>
- </a>
-</li>
+++ /dev/null
-<div id="<%= bay.bay_id %>">
- <%# render bucket_template_name, :bucket => bay.bucket %>
-</div>
--- /dev/null
+ <div class="<%= bay.dom_bodys_class -%>" <%= raw @panel.tag_attr(:scenario) -%>>
+ <% bay.tabs.each do |board| %>
+ <%= render board.body.bucket.template_name, :form => board.body.bucket %>
+ <% end %>
+ </div>
--- /dev/null
+<li <%= raw label.element.tag_attr(:tsort) -%>>
+ <div class="elements-tab">
+ <%= render label.face_template_name, :elm => label.element %>
+ </div>
+</li>
--- /dev/null
+<div class="<%= bay.dom_labels_class %>">
+ <ul class="board-labels tsort tsort-tabs-nav" <%= raw @panel.tag_attr(:tsort) -%>>
+ <% bay.tabs.each do |board| %>
+ <%= render board.label.template_name, :label => board.label %>
+ <% end %>
+ </ul>
+</div>
--- /dev/null
+<% dock.tabs.each do |tab| %>
+ <%= render tab.body.template_name, :bay => tab %>
+<% end %>
--- /dev/null
+<li id="<%= label.dom_id %>" class="<%= label.dom_class %>">
+ <a href="#<%= label.body.dom_id %>">
+ <%= label.caption %>
+ </a>
+</li>
--- /dev/null
+<ul class="<%= dock.dom_labels_class -%>">
+ <% dock.tabs.each do |tab| %>
+ <%= render tab.label.template_name, :label => tab.label %>
+ <% end %>
+</ul>
--- /dev/null
+<div id="<%= bay.body.dom_id -%>" class="<%= bay.body.dom_class -%>">
+ <%= render bay.labels_template_name, :bay => bay %>
+ <%= render bay.bodys_template_name, :bay => bay %>
+ <div class="tsort-row-break">
+ </div>
+</div>
--- /dev/null
+<div id="<%= bay.body.dom_id -%>" class="<%= bay.body.dom_class -%>">
+ <%= render bay.body.bucket.template_name, :form => bay.body.bucket %>
+</div>
require 'content'
require 'element'
require 'element_part'
-require 'editor/editor'
+require_dependency 'editor/editor'
# Initialize the rails application
Pettanr::Application.initialize!
Pettanr::Application.manifest.init
module Editor
- require "editor/editor"
- require "editor/elements"
- require "editor/tsort"
- require "editor/zsort"
+ require_dependency "editor/editor"
end
--- /dev/null
+require_dependency "editor/dock/base"
+require_dependency "editor/dock/bay"
+require_dependency "editor/dock/board"
+require_dependency "editor/dock/bucket"
+require_dependency "editor/dock/bay/root"
+require_dependency "editor/dock/bay/element"
+require_dependency "editor/dock/bay/torder"
+require_dependency "editor/dock/bay/zorder"
+require_dependency "editor/dock/bay/new"
+module Editor
+
+ module DockModule
+ include TabModule
+ class Dock < Base
+ include BayModule
+ include BoardModule
+ include RootBayModule
+ include ElementBayModule
+ include TorderBayModule
+ include ZorderBayModule
+ include NewBayModule
+ attr_accessor :tabs
+ def initialize parent
+ super
+ tab = RootBay.new(self, 0, 'panel')
+ add_tab tab, RootBayLabel.new(tab, 'panel'),
+ RootBayBody.new(tab)
+
+ tab = ElementBay.new(self, 1, 'elements')
+ add_tab tab, ElementBayLabel.new(tab, 'elements'),
+ ElementBayBody.new(tab)
+
+ tab = TorderBay.new(self, 2, 'tsort')
+ add_tab tab, TorderBayLabel.new(tab, 'torder'),
+ TorderBayBody.new(tab)
+
+ tab = ZorderBay.new(self, 3, 'zsort')
+ add_tab tab, ZorderBayLabel.new(tab, 'zorder'),
+ ZorderBayBody.new(tab)
+
+ tab = NewBay.new(self, 4, 'new')
+ add_tab tab, NewBayLabel.new(tab, 'new'),
+ NewBayBody.new(tab)
+
+ end
+
+ def editor
+ @parent
+ end
+
+ def root_item
+ @parent.root_item
+ end
+
+ def template_dir
+ @parent.template_dir + 'dock/'
+ end
+
+ def labels_template_name
+ self.template_dir + 'dock_labels'
+ end
+
+ def bodys_template_name
+ self.template_dir + 'dock_bodys'
+ end
+
+ def dom_id
+ self.editor.dom_id + '-dock'
+ end
+
+ def dom_class
+ self.editor.dom_class + '-dock'
+ end
+
+ def dom_labels_class
+ self.dom_class + '-labels'
+ end
+
+ end
+
+
+ end
+end
--- /dev/null
+module Editor
+
+ module TabModule
+ class Base
+ attr_accessor :parent, :tabs
+ def initialize parent
+ @parent = parent
+ @tabs = []
+ end
+
+ def root_item
+ @parent.root_item
+ end
+
+ def add_tab tab, label, body
+ @tabs << tab
+ tab.label = label
+ tab.body = body
+ tab
+ end
+
+ def root_item
+ @parent.root_item
+ end
+
+ def template_dir
+ @parent.template_dir
+ end
+
+ def template_file_name
+ raise "no template_file_name"
+ end
+
+ def template_name
+ self.template_dir + self.template_file_name
+ end
+
+ end
+
+ class Tab < Base
+ attr_accessor :index, :name, :label, :body
+ def initialize parent, index, name
+ super parent
+ @index = index
+ @name = name
+ end
+
+ def dom_id
+ raise "no dom_id"
+ end
+
+ def dom_class
+ raise "no dom_class"
+ end
+
+ end
+
+ class Label
+ attr_accessor :parent, :caption
+ def initialize parent, caption
+ @parent = parent
+ @caption = caption
+ end
+
+ def root_item
+ @parent.root_item
+ end
+
+ def template_dir
+ @parent.template_dir
+ end
+
+ def template_name
+ self.template_dir + self.template_file_name
+ end
+
+ def index
+ @parent.index
+ end
+
+ def name
+ @parent.name
+ end
+
+ def dom_id
+ raise "no dom_id"
+ end
+
+ def dom_class
+ raise "no dom_class"
+ end
+
+ def body
+ @parent.body
+ end
+
+ end
+
+ class Body
+ attr_accessor :parent
+ def initialize parent
+ @parent = parent
+ end
+
+ def root_item
+ @parent.root_item
+ end
+
+ def template_dir
+ @parent.template_dir
+ end
+
+ def template_name
+ self.template_dir + self.template_file_name
+ end
+
+ def index
+ @parent.index
+ end
+
+ def name
+ @parent.name
+ end
+
+ def label
+ @parent.label
+ end
+
+ def dom_id
+ raise "no dom_id"
+ end
+
+ def dom_class
+ raise "no dom_class"
+ end
+
+ end
+
+ end
+end
--- /dev/null
+module Editor
+
+ module BayModule
+ include Editor::TabModule
+ class Bay < Tab
+ attr_accessor :template_name
+ def initialize parent, index, name
+ super
+ @template_name = self.template_dir
+ end
+
+ def dock
+ @parent
+ end
+
+ def root_item
+ @parent.root_item
+ end
+
+ def labels_template_name
+ self.template_dir + 'bay_labels'
+ end
+
+ def bodys_template_name
+ self.template_dir + 'bay_bodys'
+ end
+
+ def dom_id
+ @parent.dom_id + '-bay-' + self.name
+ end
+
+ def dom_class
+ @parent.dom_class + '-bay'
+ end
+
+ def dom_labels_class
+ self.dom_class + '-labels'
+ end
+
+ end
+
+ class SimpleBay < Bay
+ attr_accessor :bucket, :bucket_template_name
+ def initialize dock_body, index, name
+ super
+ @bucket = nil
+ @bucket_template_name = self.template_dir + ''
+ end
+
+ def template_file_name
+ 'bay/simple_bay'
+ end
+
+ end
+
+ class BoardBay < Bay
+ attr_accessor :boards
+ def initialize dock_body, index, name
+ super
+ end
+
+ def template_file_name
+ 'bay/board_bay'
+ end
+
+ def dom_labels_class
+ self.dom_class + "-labels"
+ end
+
+ def dom_bodys_class
+ self.dom_class + "-bodys"
+ end
+
+ end
+
+ class BayLabel < Label
+ def template_file_name
+ 'dock_label'
+ end
+
+ def bay
+ @parent
+ end
+
+ def dock
+ self.bay.dock
+ end
+
+ def dom_id
+ self.bay.dom_id + '-label'
+ end
+
+ def dom_class
+ self.bay.dom_class + '-label'
+ end
+
+ end
+
+ class BayBody < Body
+ def bay
+ @parent
+ end
+
+ def dock
+ self.bay.dock
+ end
+
+ def dom_id
+ self.bay.dom_id + '-body'
+ end
+
+ def dom_class
+ self.bay.dom_class + '-body'
+ end
+
+ end
+
+ end
+end
--- /dev/null
+module Editor
+
+ module ElementBoardModule
+ include Editor::BoardModule
+ class ElementBoard < Board
+ attr_accessor :element
+
+ def initialize parent, index, name, element
+ super parent, index, name
+ @element = element
+ end
+
+ end
+
+ class ElementBoardLabel < BoardLabel
+ def template_file_name
+ 'bay_label'
+ end
+
+ def face_template_name
+ self.element.path_name + '/element_face'
+ end
+
+ end
+
+ class ElementBoardBody < BoardBody
+ include Editor::BucketModule
+ attr_accessor :bucket
+
+ def initialize parent
+ super
+ @bucket = FormBucket.new self, 'form'
+
+ # form_manager = Pettanr::Application::manifest.form_managers[self.root_item.form_name]
+ # form = form_manager.open self.root_item, @dock_body.dock.editor.operators, mounted
+ # bucket = Bucket.new self,form
+ end
+
+ def template_file_name
+ @parent.template_file_name
+ end
+
+ end
+
+ end
+end
--- /dev/null
+module Editor
+
+ module NewBoardModule
+ include Editor::BoardModule
+ class NewBoard < Board
+ def initialize parent, index, name
+ super
+ end
+
+ end
+
+ class NewBoardLabel < BoardLabel
+ end
+
+ class NewBoardBody < BoardBody
+ include Editor::BucketModule
+
+ def initialize parent
+ super
+ # form_manager = Pettanr::Application::manifest.form_managers[self.root_item.form_name]
+ # form = form_manager.open self.root_item, @dock_body.dock.editor.operators, mounted
+ # bucket = Bucket.new self,form
+ end
+
+ def template_file_name
+ @parent.template_file_name
+ end
+
+ end
+
+ end
+end
--- /dev/null
+module Editor
+
+ module TorderBoardModule
+ include Editor::BoardModule
+ class TorderBoard < Board
+ attr_accessor :element
+
+ def initialize parent, index, name, element
+ super parent, index, name
+ @element = element
+ end
+
+ end
+
+ class TorderBoardLabel < BoardLabel
+ def template_file_name
+ 'bay_label'
+ end
+
+ def face_template_name
+ self.element.path_name + '/element_face'
+ end
+
+ end
+
+ class TorderBoardBody < BoardBody
+ include Editor::BucketModule
+ attr_accessor :bucket
+
+ def initialize parent
+ super
+ @bucket = FormBucket.new self, 'form'
+
+ # form_manager = Pettanr::Application::manifest.form_managers[self.root_item.form_name]
+ # form = form_manager.open self.root_item, @dock_body.dock.editor.operators, mounted
+ # bucket = Bucket.new self,form
+ end
+
+ def template_file_name
+ @parent.template_file_name
+ end
+
+ end
+
+ end
+end
--- /dev/null
+module Editor
+
+ module ZorderBoardModule
+ include Editor::BoardModule
+ class ZorderBoard < Board
+ attr_accessor :element
+
+ def initialize parent, index, name, element
+ super parent, index, name
+ @element = element
+ end
+
+ def mounted
+ false
+ end
+
+ end
+
+ class ZorderBoardLabel < BoardLabel
+ def template_file_name
+ 'bay_label'
+ end
+
+ def face_template_name
+ self.element.path_name + '/element_face'
+ end
+
+ end
+
+ class ZorderBoardBody < BoardBody
+ include Editor::BucketModule
+ attr_accessor :bucket
+
+ def initialize parent
+ super
+ @bucket = FormBucket.new self, 'form'
+
+ # form_manager = Pettanr::Application::manifest.form_managers[self.root_item.form_name]
+ # form = form_manager.open self.root_item, @dock_body.dock.editor.operators, mounted
+ # bucket = Bucket.new self,form
+ end
+
+ def template_file_name
+ @parent.template_file_name
+ end
+
+ end
+
+ end
+end
--- /dev/null
+require_dependency "editor/dock/bay/board/element"
+module Editor
+
+ module ElementBayModule
+ include Editor::BayModule
+ class ElementBay < BoardBay
+ include Editor::ElementBoardModule
+ def initialize parent, index, name
+ super
+
+ self.root_item.panel_elements.each_with_index do |element, i|
+ tab = ElementBoard.new(self, i, element.item_name, element)
+ add_tab tab, ElementBoardLabel.new(tab, element.item_name),
+ ElementBoardBody.new(tab)
+ end
+ end
+
+ end
+
+ class ElementBayLabel < BayLabel
+ end
+
+ class ElementBayBody < BayBody
+ def template_file_name
+ @parent.template_file_name
+ end
+
+ end
+
+ end
+end
--- /dev/null
+require_dependency "editor/dock/bay/board/new"
+module Editor
+
+ module NewBayModule
+ include Editor::BayModule
+ class NewBay < BoardBay
+ include Editor::NewBoardModule
+ def initialize parent, index, name
+ super
+
+ end
+
+ end
+
+ class NewBayLabel < BayLabel
+ end
+
+ class NewBayBody < BayBody
+ def template_file_name
+ @parent.template_file_name
+ end
+
+ end
+
+ end
+end
--- /dev/null
+module Editor
+
+ module RootBayModule
+ include Editor::BayModule
+ class RootBay < SimpleBay
+ end
+
+ class RootBayLabel < BayLabel
+ end
+
+ class RootBayBody < BayBody
+ include Editor::BucketModule
+ attr_accessor :bucket
+
+ def initialize parent
+ super
+ @bucket = FormBucket.new self, 'form'
+ # form_manager = Pettanr::Application::manifest.form_managers[self.root_item.form_name]
+ # form = form_manager.open self.root_item, @dock_body.dock.editor.operators, mounted
+ # @bucket = Bucket.new self,form
+ end
+
+ def template_file_name
+ @parent.template_file_name
+ end
+
+ def mounted
+ true
+ end
+
+ end
+
+ end
+end
--- /dev/null
+require_dependency "editor/dock/bay/board/torder"
+module Editor
+
+ module TorderBayModule
+ include Editor::BayModule
+ class TorderBay < BoardBay
+ include Editor::TorderBoardModule
+ def initialize parent, index, name
+ super
+
+ self.root_item.panel_elements.each_with_index do |element, i|
+ tab = TorderBoard.new(self, i, element.item_name, element)
+ add_tab tab, TorderBoardLabel.new(tab, element.item_name),
+ TorderBoardBody.new(tab)
+ end
+ end
+
+ def class_name
+ "tsort-box"
+ end
+
+ end
+
+ class TorderBayLabel < BayLabel
+ end
+
+ class TorderBayBody < BayBody
+ def template_file_name
+ @parent.template_file_name
+ end
+
+ end
+
+ end
+end
--- /dev/null
+require_dependency "editor/dock/bay/board/zorder"
+module Editor
+
+ module ZorderBayModule
+ include Editor::BayModule
+ class ZorderBay < BoardBay
+ include Editor::ZorderBoardModule
+ def initialize parent, index, name
+ super
+
+ self.root_item.panel_elements.each_with_index do |element, i|
+ tab = ZorderBoard.new(self, i, element.item_name, element)
+ add_tab tab, ZorderBoardLabel.new(tab, element.item_name),
+ ZorderBoardBody.new(tab)
+ end
+ end
+
+ def class_name
+ "zsort-box"
+ end
+
+ end
+
+ class ZorderBayLabel < BayLabel
+ end
+
+ class ZorderBayBody < BayBody
+ def template_file_name
+ @parent.template_file_name
+ end
+
+ end
+
+ end
+end
--- /dev/null
+module Editor
+
+ module BoardModule
+ include Editor::TabModule
+ class Board < Tab
+ def initialize parent, index, name
+ super
+ end
+
+ def root_item
+ @parent.root_item
+ end
+
+ def bay
+ @parent
+ end
+
+ def bay_index
+ self.bay.index
+ end
+
+ def dom_id
+ self.bay.dom_id + '-board-' + self.name
+ end
+
+ def dom_class
+ self.bay.dom_class + '-board'
+ end
+
+ def header_class
+ ""
+ end
+
+ end
+
+ class BoardLabel < Label
+ def initialize parent, caption
+ super
+ end
+
+ def board
+ @parent
+ end
+
+ def bay
+ self.board.parent
+ end
+
+ def element
+ @parent.element
+ end
+
+ def bay_name
+ bay.name
+ end
+
+ def dom_id
+ self.board.dom_id + '-label'
+ end
+
+ def dom_class
+ self.board.dom_class + '-label'
+ end
+
+ end
+
+ class BoardBody < Body
+ def dom_id
+ self.board.dom_id + '-body'
+ end
+
+ def dom_class
+ self.board.dom_class + '-body'
+ end
+
+ end
+
+ end
+end
--- /dev/null
+module Editor
+
+ module BucketModule
+ class Bucket
+ attr_accessor :parent
+ def initialize parent
+ @parent = parent
+ end
+
+ def root_item
+ @parent.root_item
+ end
+
+ def template_dir
+ @parent.template_dir
+ end
+
+ def template_name
+ self.template_dir + self.template_file_name
+ end
+
+ def class_name
+ "elements-tabs"
+ end
+
+ end
+
+ class FormBucket < Bucket
+ def initialize parent, form
+ @parent = parent
+ end
+
+ def root_item
+ @parent.root_item
+ end
+
+ def template_file_name
+ 'element_form'
+ end
+
+ def class_name
+ "elements-tabs"
+ end
+
+ end
+
+ end
+end
+require_dependency "editor/dock"
module Editor
class Editor
- class Dock
- attr_accessor :editor, :bodies
- def initialize editor
- @editor = editor
- @root_dock_body = DockBody.new(self, 0, )
- @root_dock_body.label = DockLabel.new(@root_dock_body, 'panel')
- @root_dock_body.bay = RootBay.new(@root_dock_body)
-
- @element_dock_body = DockBody.new(self, 0, )
- @element_dock_body.label = DockLabel.new(@element_dock_body, 'elements')
- @element_dock_body.bay = ElementBay.new(@element_dock_body)
-
- @torder_dock_body = DockBody.new(self, 0, )
- @torder_dock_body.label = DockLabel.new(@torder_dock_body, 'torder')
- @torder_dock_body.bay = TorderBay.new(@torder_dock_body)
-
- @zorder_dock_body = DockBody.new(self, 0, )
- @zorder_dock_body.label = DockLabel.new(@zorder_dock_body, 'zorder')
- @zorder_dock_body.bay = ZorderBay.new(@zorder_dock_body)
-
- @new_dock_body = DockBody.new(self, 0, )
- @new_dock_body.label = DockLabel.new(@new_dock_body, 'new')
- @new_dock_body.bay = NewBay.new(@new_dock_body)
-
- @bodies = [
- @root_dock_body, @element_dock_body, @torder_dock_body, @zorder_dock_body, @new_dock_body
- ]
- end
-
- def root_item
- @editor.root_item
- end
-
- end
-
- class DockBody
- attr_accessor :dock, :index, :label, :bay
- def initialize dock, index
- @dock = dock
- @index = index
- @label = label
- @bay = bay
- end
-
- def root_item
- @dock.root_item
- end
-
- end
-
- class DockLabel
- attr_accessor :dock_body, :caption
- def initialize dock_body, caption
- @dock_body = dock_body
- @caption = caption
- end
-
- def root_item
- @dock_body.root_item
- end
-
- def index
- @dock_body.index
- end
-
- def label_id
- "tabs-1-tab"
- end
-
- def bay_id
- @dock_body.bay.bay_id
- end
- end
-
- class Bay
- attr_accessor :dock_body, :template_name
- def initialize dock_body
- @dock_body = dock_body
- @template_dir = 'templates/r/editor/'
- @template_name = @template_dir
- end
-
- def root_item
- @dock_body.root_item
- end
-
- def index
- @dock_body.index
- end
-
- def label
- @dock_body.label
- end
-
- def label_id
- self.label.label_id
- end
-
- def bay_id
- "tabs-2"
- end
-
- end
-
- class Board
- attr_accessor :bay, :board_index, :label, :bucket
- def initialize bay, board_index, element
- @bay = bay
- @board_index = board_index
- @element = element
- end
-
- def root_item
- @bay.root_item
- end
-
- def bay_index
- @bay.index
- end
-
- def header_class
- ""
- end
-
- end
-
- class BoardLabel
- def initialize board, caption
- end
-
- def class_name
- "elements-tabs"
- end
-
- end
-
- class SimpleBay < Bay
- attr_accessor :bucket, :bucket_template_name
- def initialize dock_body
- super
- @template_name = @template_dir + 'simple_bay'
- @bucket = nil
- @bucket_template_name = @template_dir + ''
- end
-
- end
-
- class BoardBay < Bay
- attr_accessor :boards
- def initialize dock_body
- super
- @template_name = @template_dir + 'board_bay'
- end
-
- end
-
- class Bucket
- def class_name
- "elements-tabs"
- end
-
- end
-
- class RootBay < SimpleBay
- def initialize dock_body
- super
- form_manager = Pettanr::Application::manifest.form_managers[self.root_item.form_name]
- mounted = true
- @bucket = form_manager.open self.root_item, @dock_body.dock.editor.operators, mounted
- @bucket_template_name = @template_dir + 'element_form'
- end
- end
-
- class ElementBay < BoardBay
- def initialize dock_body
- super
- @boards = self.root_item.panel_elements.map {|element|
- board = ElementBoard.new self, index, element
- board_label = BoardLabel.new board
- bucket = form_manager.open self.root_item, @dock_body.dock.editor.operators, mounted
- bucket_template_name = @template_dir + 'element_form'
- board_bucket = bucket
- board.label = board_label
- board.bucket = board_bucket
- board
- }
- end
-
- end
-
- class TorderBay < BoardBay
- def initialize dock_body
- super
- @boards = self.root_item.panel_elements.map {|element|
- board = TorderBoard.new self, index, element
- board_label = BoardLabel.new board
- bucket = form_manager.open self.root_item, @dock_body.dock.editor.operators, mounted
- bucket_template_name = @template_dir + 'element_form'
- board_bucket = bucket
- board.label = board_label
- board.bucket = board_bucket
- board
- }
- end
-
- end
-
- class ZorderBay < BoardBay
- def initialize dock_body
- super
- @boards = self.root_item.panel_elements.map {|element|
- board = ZorderBoard.new self, index, element
- board_label = BoardLabel.new board
- bucket = form_manager.open self.root_item, @dock_body.dock.editor.operators, mounted
- bucket_template_name = @template_dir + 'element_form'
- board_bucket = bucket
- board.label = board_label
- board.bucket = board_bucket
- board
- }
- end
-
- end
-
- class NewBay < BoardBay
- def initialize dock_body
- super
- @boards = self.root_item.panel_elements.map {|element|
- board = NewBoard.new self, index, element
- board_label = BoardLabel.new board
- bucket = form_manager.open self.root_item, @dock_body.dock.editor.operators, mounted
- bucket_template_name = @template_dir + 'element_form'
- board_bucket = bucket
- board.label = board_label
- board.bucket = board_bucket
- board
- }
- end
-
- end
-
- class ElementBoard < Board
- def class_name
- "elements-tabs"
- end
-
- end
-
- class TorderBoard < Board
- def class_name
- "tsort-box"
- end
-
- end
-
- class ZorderBoard < Board
- def class_name
- "zsort-box"
- end
-
- end
-
- class NewBoard < Board
- end
+ include DockModule
class Generator
def initialize editor
end
- attr_accessor :root_item, :dock, :generator, :operators
+ attr_accessor :root_item, :dock, :template_dir, :generator, :operators
def initialize root_item, operators
@root_item = root_item
@operators = operators
+ @template_dir = 'templates/r/editor/'
@dock = Dock.new self
@generator = Generator.new self
end
#InstanceMethods
+ def dom_id
+ 'editor-' + @root_item.id.to_s
+ end
+
+ def dom_class
+ 'editor'
+ end
+
def render view
@docks.map {|element|
ElementTab.new self, element
+++ /dev/null
-module Editor
- class ElementTab
- attr :element
- # table_name
- def initialize editor, element
- @editor = editor
- @element = element
- end
-
- #InstanceMethods
- def element_tab
- end
-
- def form mounted
- form_manager = Pettanr::Application::manifest.form_managers[@element.form_name]
- form = form_manager.open element, @editor.operators, mounted
- end
-
- end
-end
+++ /dev/null
-module Editor
- class Tsort
- # table_name
- def initialize item, operators
- end
-
- def self.singular
- self.to_s
- end
-
- #InstanceMethods
-
- def item_name
- self.class.item_name
- end
-
- end
-end
+++ /dev/null
-module Editor
- class Zsort
- # table_name
- def initialize item, operators
- end
-
- def self.singular
- self.to_s
- end
-
- #InstanceMethods
-
- def item_name
- self.class.item_name
- end
-
- end
-end