OSDN Git Service

fix editor
authoryasushiito <yas@pen-chan.jp>
Mon, 27 Jan 2014 10:10:12 +0000 (19:10 +0900)
committeryasushiito <yas@pen-chan.jp>
Mon, 27 Jan 2014 10:10:12 +0000 (19:10 +0900)
app/views/templates/r/editor/dock/_board_bodys.html.erb
app/views/templates/r/editor/dock/_element_form.html.erb [deleted file]
app/views/templates/r/editor/dock/bay/_element_form.html.erb [deleted file]
app/views/templates/r/editor/dock/bay/_simple_bay.html.erb
app/views/templates/r/editor/dock/bucket/_element_form.html.erb [new file with mode: 0644]
app/views/templates/r/editor/dock/bucket/_scenario.html.erb [new file with mode: 0644]
lib/editor/dock/bay/board/torder.rb
lib/editor/dock/bay/torder.rb
lib/editor/dock/board.rb
lib/editor/dock/bucket.rb

index b4d9481..ae47e30 100644 (file)
@@ -1,5 +1,5 @@
-  <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>
+<div class="<%= bay.dom_bodys_class -%>" <%= raw @panel.tag_attr(:scenario) -%>>
+  <% bay.tabs.each do |board| %>
+    <%= render board.body.bucket.template_name, board.body.bucket.template_options %>
+  <% end %>
+</div>
diff --git a/app/views/templates/r/editor/dock/_element_form.html.erb b/app/views/templates/r/editor/dock/_element_form.html.erb
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/app/views/templates/r/editor/dock/bay/_element_form.html.erb b/app/views/templates/r/editor/dock/bay/_element_form.html.erb
deleted file mode 100644 (file)
index e69de29..0000000
index d33c7f6..03a5563 100644 (file)
@@ -1,3 +1,3 @@
 <div id="<%= bay.body.dom_id -%>" class="<%= bay.body.dom_class -%>">
-  <%= render bay.body.bucket.template_name, :form => bay.body.bucket %>
+  <%= render bay.body.bucket.template_name, bay.body.bucket.template_options %>
 </div>
diff --git a/app/views/templates/r/editor/dock/bucket/_element_form.html.erb b/app/views/templates/r/editor/dock/bucket/_element_form.html.erb
new file mode 100644 (file)
index 0000000..ad4be56
--- /dev/null
@@ -0,0 +1 @@
+vvvvvvvvv\r
diff --git a/app/views/templates/r/editor/dock/bucket/_scenario.html.erb b/app/views/templates/r/editor/dock/bucket/_scenario.html.erb
new file mode 100644 (file)
index 0000000..3f752ca
--- /dev/null
@@ -0,0 +1,5 @@
+      <% bay.elements.each do |elm| %>\r
+        <div <%= raw elm.tag_attr() -%>>\r
+          <%= render elm.scenario_template, :elm => elm, :no_attr => 0 %>\r
+        </div>\r
+      <% end %>\r
index 04e5cba..609802f 100644 (file)
@@ -29,7 +29,7 @@ module Editor
       
       def initialize parent
         super
-        @bucket = FormBucket.new self, 'form'
+        @bucket = ScenarioBucket.new self
         
     #    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
index e74b80d..83b96b6 100644 (file)
@@ -8,13 +8,17 @@ module Editor
       def initialize parent, index, name
         super
         
-        self.root_item.panel_elements.each_with_index do |element, i| 
+        self.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 elements
+        self.root_item.panel_elements
+      end
+      
       def class_name
         "tsort-box"
       end
index 96af170..94341d2 100644 (file)
@@ -43,7 +43,11 @@ module Editor
       end
       
       def bay
-        self.board.parent
+        self.board.bay
+      end
+      
+      def dock
+        self.bay.dock
       end
       
       def element
@@ -65,6 +69,18 @@ module Editor
     end
     
     class BoardBody < Body
+      def board
+        @parent
+      end
+      
+      def bay
+        self.board.bay
+      end
+      
+      def dock
+        self.bay.dock
+      end
+      
       def dom_id
         self.board.dom_id + '-body'
       end
index 71d64a7..06f6748 100644 (file)
@@ -7,39 +7,60 @@ module Editor
         @parent = parent
       end
       
-      def root_item
-        @parent.root_item
+      def template_dir
+        raise "no template_dir"
       end
       
-      def template_dir
-        @parent.template_dir
+      def template_file_name
+        raise "no template_file_name"
       end
       
       def template_name
         self.template_dir + self.template_file_name
       end
       
-      def class_name
-        "elements-tabs"
-      end
-      
     end
     
     class FormBucket < Bucket
+      attr_accessor :form
       def initialize parent, form
-        @parent = parent
+        super parent
+        @form = form
       end
       
-      def root_item
-        @parent.root_item
+      def template_dir
+        @parent.dock.template_dir
+      end
+      
+      def template_file_name
+        'bucket/element_form'
+      end
+      
+      def template_options
+        {:form => @form}
+      end
+      
+    end
+    
+    class ScenarioBucket < Bucket
+      def board
+        @parent.board
+      end
+      
+      def bay
+        self.board.bay
+      end
+      
+      def template_dir
+        @parent.dock.template_dir
       end
       
       def template_file_name
-        'element_form'
+        'bucket/scenario'
       end
       
-      def class_name
-        "elements-tabs"
+      def template_options
+        {:bay => self.bay}
       end
       
     end