OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
authoryasushiito <yas@pen-chan.jp>
Tue, 28 Jan 2014 08:14:00 +0000 (17:14 +0900)
committeryasushiito <yas@pen-chan.jp>
Tue, 28 Jan 2014 08:14:00 +0000 (17:14 +0900)
25 files changed:
app/assets/javascripts/manifest/work/system_resources.js.coffee.erb
app/models/panel.rb
app/views/templates/r/editor/dock/_bay_bodys.html.erb
app/views/templates/r/editor/dock/_bay_label.html.erb
app/views/templates/r/editor/dock/_bay_labels.html.erb
app/views/templates/r/editor/dock/_board_bodys.html.erb [new file with mode: 0644]
app/views/templates/r/editor/dock/_board_label.html.erb [new file with mode: 0644]
app/views/templates/r/editor/dock/_board_labels.html.erb [new file with mode: 0644]
app/views/templates/r/editor/dock/_dock_bodys.html.erb [deleted file]
app/views/templates/r/editor/dock/_dock_label.html.erb [deleted file]
app/views/templates/r/editor/dock/_dock_labels.html.erb [deleted file]
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.rb
lib/editor/dock/bay.rb
lib/editor/dock/bay/board/element.rb
lib/editor/dock/bay/board/torder.rb
lib/editor/dock/bay/board/zorder.rb
lib/editor/dock/bay/torder.rb
lib/editor/dock/board.rb
lib/editor/dock/bucket.rb
lib/manifest/manifest.rb

index 1fe57fb..43664a8 100644 (file)
 @select_items = {\r
   model_loader: {\r
     writing_format_items: {\r
-      model: 'writing_format',\r
+      model_name: 'writing_format',\r
       list_name: 'select_items',\r
       caption: 'caption'\r
     },\r
     license_group_items: {\r
-      model: 'license_group',\r
+      model_name: 'license_group',\r
       list_name: 'select_items',\r
       caption: 'caption'\r
     },\r
     speech_balloon_template_items: {\r
-      model: 'speech_balloon_template',\r
+      model_name: 'speech_balloon_template',\r
       list_name: 'select_items',\r
       caption: 'caption'\r
     },\r
index 723bdb2..137b2c0 100644 (file)
@@ -23,7 +23,7 @@ class Panel < Pettanr::Content
   end
   
   def self.each_element_class_names
-    Pettanr::Application.manifest.system_resources.elements.each do |k, n|
+    Manifest.manifest.system_resources.elements.each do |k, n|
       yield k
     end
   end
index b4d9481..b2b9886 100644 (file)
@@ -1,5 +1,3 @@
-  <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>
+<% dock.tabs.each do |tab| %>
+  <%= render tab.body.template_name, :bay => tab %>
+<% end %>
index 33d35fe..b304c75 100644 (file)
@@ -1,5 +1,5 @@
-<li <%= raw label.element.tag_attr(:tsort) -%>>
-  <div class="elements-tab">
-    <%= render label.face_template_name, :elm => label.element %>
-  </div>
+<li id="<%= label.dom_id %>" class="<%= label.dom_class %>">
+  <a href="#<%= label.body.dom_id %>">
+    <%= label.caption %>
+  </a>
 </li>
index e303ec9..bf2b647 100644 (file)
@@ -1,7 +1,5 @@
-<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>
+<ul class="<%= dock.dom_labels_class -%>">
+  <% dock.tabs.each do |tab| %>
+    <%= render tab.label.template_name, :label => tab.label %>
+  <% end %>
+</ul>
diff --git a/app/views/templates/r/editor/dock/_board_bodys.html.erb b/app/views/templates/r/editor/dock/_board_bodys.html.erb
new file mode 100644 (file)
index 0000000..ae47e30
--- /dev/null
@@ -0,0 +1,5 @@
+<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/_board_label.html.erb b/app/views/templates/r/editor/dock/_board_label.html.erb
new file mode 100644 (file)
index 0000000..33d35fe
--- /dev/null
@@ -0,0 +1,5 @@
+<li <%= raw label.element.tag_attr(:tsort) -%>>
+  <div class="elements-tab">
+    <%= render label.face_template_name, :elm => label.element %>
+  </div>
+</li>
diff --git a/app/views/templates/r/editor/dock/_board_labels.html.erb b/app/views/templates/r/editor/dock/_board_labels.html.erb
new file mode 100644 (file)
index 0000000..e303ec9
--- /dev/null
@@ -0,0 +1,7 @@
+<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>
diff --git a/app/views/templates/r/editor/dock/_dock_bodys.html.erb b/app/views/templates/r/editor/dock/_dock_bodys.html.erb
deleted file mode 100644 (file)
index b2b9886..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<% dock.tabs.each do |tab| %>
-  <%= render tab.body.template_name, :bay => tab %>
-<% end %>
diff --git a/app/views/templates/r/editor/dock/_dock_label.html.erb b/app/views/templates/r/editor/dock/_dock_label.html.erb
deleted file mode 100644 (file)
index b304c75..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<li id="<%= label.dom_id %>" class="<%= label.dom_class %>">
-  <a href="#<%= label.body.dom_id %>">
-    <%= label.caption %>
-  </a>
-</li>
diff --git a/app/views/templates/r/editor/dock/_dock_labels.html.erb b/app/views/templates/r/editor/dock/_dock_labels.html.erb
deleted file mode 100644 (file)
index bf2b647..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<ul class="<%= dock.dom_labels_class -%>">
-  <% dock.tabs.each do |tab| %>
-    <%= render tab.label.template_name, :label => tab.label %>
-  <% end %>
-</ul>
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 487877d..114a17d 100644 (file)
@@ -57,11 +57,11 @@ module Editor
       end
       
       def labels_template_name
-        self.template_dir + 'dock_labels'
+        self.template_dir + 'bay_labels'
       end
       
       def bodys_template_name
-        self.template_dir + 'dock_bodys'
+        self.template_dir + 'bay_bodys'
       end
       
       def dom_id
index 8d82c0a..ffbc556 100644 (file)
@@ -18,11 +18,11 @@ module Editor
       end
       
       def labels_template_name
-        self.template_dir + 'bay_labels'
+        self.template_dir + 'board_labels'
       end
       
       def bodys_template_name
-        self.template_dir + 'bay_bodys'
+        self.template_dir + 'board_bodys'
       end
       
       def dom_id
@@ -75,7 +75,7 @@ module Editor
     
     class BayLabel < Label
       def template_file_name
-        'dock_label'
+        'bay_label'
       end
       
       def bay
index 43315d0..0d43051 100644 (file)
@@ -14,7 +14,7 @@ module Editor
     
     class ElementBoardLabel < BoardLabel
       def template_file_name
-        'bay_label'
+        'board_label'
       end
       
       def face_template_name
index 6b49e60..609802f 100644 (file)
@@ -14,7 +14,7 @@ module Editor
     
     class TorderBoardLabel < BoardLabel
       def template_file_name
-        'bay_label'
+        'board_label'
       end
       
       def face_template_name
@@ -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 e822825..f55b2f1 100644 (file)
@@ -18,7 +18,7 @@ module Editor
     
     class ZorderBoardLabel < BoardLabel
       def template_file_name
-        'bay_label'
+        'board_label'
       end
       
       def face_template_name
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
index 984233a..7752099 100644 (file)
@@ -32,7 +32,10 @@ module Manifest
     # call after load app
     def select_items_loader
       @system_resources.select_items['model_loader'].each {|name, conf|
-        list = Pettanr::Application::manifest.list_managers[conf['model']].open conf['list_name'], nil, nil, nil
+        model_name = conf['model_name']
+        list_name = conf['list_name'] || 'select_items'
+        caption = conf['caption']
+        list = @lists[model_name][list_name]
         @select_items['model'] ||= {}
         @select_items['model'][name] = list.items.map {|item| [item.caption, item.id]}
       }