OSDN Git Service

fix form
authoryasushiito <yas@pen-chan.jp>
Fri, 18 Apr 2014 07:09:44 +0000 (16:09 +0900)
committeryasushiito <yas@pen-chan.jp>
Fri, 18 Apr 2014 07:09:44 +0000 (16:09 +0900)
app/assets/javascripts/manifest/work/forms.js.coffee.erb
app/views/home/index.html.erb
app/views/templates/r/form/_extend_form.html.erb [moved from app/views/templates/r/form/_extend_fform.html.erb with 54% similarity]
app/views/templates/r/form/_fields.html.erb
config/locales/pettanr.ja.yml
lib/locmare/form.rb
lib/locmare/form/extend_field.rb
lib/locmare/form/field.rb
lib/manifest/item/base.rb
public/local_manifest.json

index 3811bb5..fcda8f0 100644 (file)
       'open', \r
       'commercial', \r
       'official', \r
       'open', \r
       'commercial', \r
       'official', \r
-      'attribution:', \r
+      'attribution', \r
       'derive', \r
       'thumbnail', \r
       'gif_convert', \r
       'derive', \r
       'thumbnail', \r
       'gif_convert', \r
index 54accf3..e50c6e8 100644 (file)
@@ -1,64 +1,69 @@
 <h1><%= t '.title' -%></h1>
 <h1><%= t '.title' -%></h1>
+<% if @operators.author -%>
 <h2><%= link_to h(@operators.author.name), main_app.author_path(@operators.author) -%></h2>
 <h3><%= t('.updated_scroll') -%></h3>
 <h2><%= link_to h(@operators.author.name), main_app.author_path(@operators.author) -%></h2>
 <h3><%= t('.updated_scroll') -%></h3>
-<table>
-  <tr height="100px">
-    <td width="200px" align="center" valign="middle">
-      <%= link_to t_m('Scroll'), '/home/scrolls' %>
-      <%= link_to t('*'), new_scroll_path %>
-    </td>
-    <td width="200px" align="center" valign="middle">
-      <%= link_to t_m('ScrollPanel'), '/home/scroll_panels' %>
-      <%= link_to t('*'), new_scroll_panel_path %>
-    </td>
-    <td width="200px" align="center" valign="middle">
-      <%= link_to t_m('Comic'), '/home/comics' %>
-      <%= link_to t('*'), new_comic_path %>
-    </td>
-    <td width="200px" align="center" valign="middle">
-      <%= link_to t_m('Story'), '/home/stories' %>
-      <%= link_to t('*'), new_story_path %>
-    </td>
-  </tr>
-  <tr height="100px">
-    <td width="200px" align="center" valign="middle">
-      <%= link_to t_m('StorySheet'), '/home/story_sheets' %>
-      <%= link_to t('*'), new_story_sheet_path %>
-    </td>
-    <td width="200px" align="center" valign="middle">
-      <%= link_to t_m('Sheet'), '/home/sheets' %>
-      <%= link_to t('*'), new_sheet_path %>
-    </td>
-    <td width="200px" align="center" valign="middle">
-      <%= link_to t_m('SheetPanel'), '/home/sheet_panels' %>
-      <%= link_to t('*'), new_sheet_panel_path %>
-    </td>
-    <td width="200px" align="center" valign="middle">
-      <%= link_to t_m('Panel'), '/home/panels' %>
-      <%= link_to t('*'), new_panel_path %>
-    </td>
-  </tr>
-</table>
-<h3><%= t('.used_element') -%></h3>
-<table>
-  <tr height="100px">
-    <td width="200px" align="center" valign="middle">
-      <%= link_to t_m('PanelPicture'), '/home/panel_pictures' %>
-    </td>
-    <td width="200px" align="center" valign="middle">
-      <%= link_to t_m('SpeechBalloon'), '/home/speech_balloons' %>
-    </td>
-    <td width="200px" align="center" valign="middle">
-      <%= link_to t_m('GroundPicture'), '/home/ground_pictures' %>
-    </td>
-    <td width="200px" align="center" valign="middle">
-      <%= link_to t_m('GroundColor'), '/home/ground_colors' %>
-      <%= link_to t('*'), new_ground_color_path %>
-    </td>
-    <td width="200px" align="center" valign="middle">
-    </td>
-  </tr>
-</table>
+  <table>
+    <tr height="100px">
+      <td width="200px" align="center" valign="middle">
+        <%= link_to t_m('Scroll'), '/home/scrolls' %>
+        <%= link_to t('*'), new_scroll_path %>
+      </td>
+      <td width="200px" align="center" valign="middle">
+        <%= link_to t_m('ScrollPanel'), '/home/scroll_panels' %>
+        <%= link_to t('*'), new_scroll_panel_path %>
+      </td>
+      <td width="200px" align="center" valign="middle">
+        <%= link_to t_m('Comic'), '/home/comics' %>
+        <%= link_to t('*'), new_comic_path %>
+      </td>
+      <td width="200px" align="center" valign="middle">
+        <%= link_to t_m('Story'), '/home/stories' %>
+        <%= link_to t('*'), new_story_path %>
+      </td>
+    </tr>
+    <tr height="100px">
+      <td width="200px" align="center" valign="middle">
+        <%= link_to t_m('StorySheet'), '/home/story_sheets' %>
+        <%= link_to t('*'), new_story_sheet_path %>
+      </td>
+      <td width="200px" align="center" valign="middle">
+        <%= link_to t_m('Sheet'), '/home/sheets' %>
+        <%= link_to t('*'), new_sheet_path %>
+      </td>
+      <td width="200px" align="center" valign="middle">
+        <%= link_to t_m('SheetPanel'), '/home/sheet_panels' %>
+        <%= link_to t('*'), new_sheet_panel_path %>
+      </td>
+      <td width="200px" align="center" valign="middle">
+        <%= link_to t_m('Panel'), '/home/panels' %>
+        <%= link_to t('*'), new_panel_path %>
+      </td>
+    </tr>
+  </table>
+  <h3><%= t('.used_element') -%></h3>
+  <table>
+    <tr height="100px">
+      <td width="200px" align="center" valign="middle">
+        <%= link_to t_m('PanelPicture'), '/home/panel_pictures' %>
+      </td>
+      <td width="200px" align="center" valign="middle">
+        <%= link_to t_m('SpeechBalloon'), '/home/speech_balloons' %>
+      </td>
+      <td width="200px" align="center" valign="middle">
+        <%= link_to t_m('GroundPicture'), '/home/ground_pictures' %>
+      </td>
+      <td width="200px" align="center" valign="middle">
+        <%= link_to t_m('GroundColor'), '/home/ground_colors' %>
+        <%= link_to t('*'), new_ground_color_path %>
+      </td>
+      <td width="200px" align="center" valign="middle">
+      </td>
+    </tr>
+  </table>
+<% else -%>
+  <h2><%= t('.author') -%></h2>
+  <h3><%= link_to t('.not_author'), main_app.new_author_path -%></h2>
+<% end -%>
 <% if @operators.artist -%>
   <h2><%= link_to h(@operators.artist.name), main_app.artist_path(@operators.artist) -%></h2>
   <h3><%= t('.updated_picture') -%></h3>
 <% if @operators.artist -%>
   <h2><%= link_to h(@operators.artist.name), main_app.artist_path(@operators.artist) -%></h2>
   <h3><%= t('.updated_picture') -%></h3>
@@ -81,6 +86,5 @@
   </table>
 <% else -%>
   <h2><%= t('.artist') -%></h2>
   </table>
 <% else -%>
   <h2><%= t('.artist') -%></h2>
-  <h3><%= t('.updated_picture') -%></h3>
   <h3><%= link_to t('.not_artist'), main_app.new_artist_path -%></h2>
 <% end -%>
   <h3><%= link_to t('.not_artist'), main_app.new_artist_path -%></h2>
 <% end -%>
@@ -1,4 +1,4 @@
-<%= form_for(form.item, :html => form.item.tag_attributes('form', 'data-form-name' => form.form_name)) do |f| %>
+<%= form_for(form.item) do |f| %>
   <%= render 'system/error_explanation', :obj => form.item %>
   <%= render form.fields_template_name, :form => form, :f => f %>
 <% end %>
   <%= render 'system/error_explanation', :obj => form.item %>
   <%= render form.fields_template_name, :form => form, :f => f %>
 <% end %>
index 15b510e..7202fd2 100644 (file)
@@ -1,5 +1,5 @@
 <div class="fields">
   <% form.each_field do |field_name, field| %>
 <div class="fields">
   <% form.each_field do |field_name, field| %>
-    <%= render field.template_name, :field => field %>
+    <%= render field.template_name, field.template_option %>
   <% end %>
 </div>
   <% end %>
 </div>
index 309d9e1..0581854 100644 (file)
@@ -483,7 +483,9 @@ ja:
       catch: つかんでいるコマ
       used_element: 最近使った部品
       updated_picture: 最近更新した画像
       catch: つかんでいるコマ
       used_element: 最近使った部品
       updated_picture: 最近更新した画像
+      author: 作家
       artist: 絵師
       artist: 絵師
+      not_author: 作品を公開するには作家登録
       not_artist: 画像を公開するには絵師登録
     scrolls:
       title: 最近更新したスクロール
       not_artist: 画像を公開するには絵師登録
     scrolls:
       title: 最近更新したスクロール
@@ -1084,6 +1086,9 @@ ja:
       title: 作家プロフィール編集
     destroy:
       title: 休筆
       title: 作家プロフィール編集
     destroy:
       title: 休筆
+    submit:
+      new: 登録
+      edit: 変更
   artists:
     index:
       title: 絵師一覧
   artists:
     index:
       title: 絵師一覧
@@ -1102,6 +1107,9 @@ ja:
       title: 絵師プロフィール編集
     destroy:
       title: 活動停止
       title: 絵師プロフィール編集
     destroy:
       title: 活動停止
+    submit:
+      new: 登録
+      edit: 変更
   system_pictures:
     index:
       title: システム画像一覧
   system_pictures:
     index:
       title: システム画像一覧
index a9e3054..ce92660 100644 (file)
@@ -54,8 +54,8 @@ module Locmare
     def init_fields
       @manifest.each_field do |field_name, field_manifest| 
         if boost_name = @item.class.find_boost_name(field_name)
     def init_fields
       @manifest.each_field do |field_name, field_manifest| 
         if boost_name = @item.class.find_boost_name(field_name)
+        p [field_name]
           extend_form_name = @item.boosters[boost_name].model_name
           extend_form_name = @item.boosters[boost_name].model_name
-          extend_form_manifest = LocalManifest.manifest.forms[extend_form_name]
           extend_item = @item.boosters[boost_name].extend_item
           @fields[field_name] = ExtendForm.new self, extend_form_name, extend_item, @mounted, @operators
         else
           extend_item = @item.boosters[boost_name].extend_item
           @fields[field_name] = ExtendForm.new self, extend_form_name, extend_item, @mounted, @operators
         else
@@ -97,13 +97,7 @@ module Locmare
     
     def init_fields
       @manifest.each_field do |field_name, field_manifest| 
     
     def init_fields
       @manifest.each_field do |field_name, field_manifest| 
-        if boost_name = @item.class.find_boost_name(field_name)
-          extend_form_name = @item.boosters[boost_name].model_name
-          extend_form_manifest = LocalManifest.manifest.forms[extend_form_name]
-          @fields[field_name] = ExtendField.new self, field_name, field_manifest, @item.boosters[n].extend_item
-        else
-       #   @fields[field_name] = Field.new self, field_name, field_manifest
-        end
+        @fields[field_name] = ExtendField.new self, field_name, field_manifest
       end
     end
     
       end
     end
     
@@ -111,6 +105,10 @@ module Locmare
       "extend_form"
     end
     
       "extend_form"
     end
     
+    def template_option
+      {:form=> self}
+    end
+    
   end
   
 end
   end
   
 end
index 1987c4a..01abed5 100644 (file)
@@ -1,6 +1,7 @@
 module Locmare
   module FormModule
     class ExtendField
 module Locmare
   module FormModule
     class ExtendField
+      include FieldModule
       attr :form, :field_name, :field_manifest, 
         :label, :tag, :helpers, :options
       def initialize form, field_name, field_manifest
       attr :form, :field_name, :field_manifest, 
         :label, :tag, :helpers, :options
       def initialize form, field_name, field_manifest
@@ -33,7 +34,7 @@ module Locmare
       end
       
       def options tag_options = {}
       end
       
       def options tag_options = {}
-        self.item.field_tag_attributes(@field_manifest.column_name, tag_options).merge(self.mount_option)
+        tag_options
       end
       
       def form_field_name
       end
       
       def form_field_name
@@ -56,6 +57,10 @@ module Locmare
         self.template_dir + self.template_file_name
       end
       
         self.template_dir + self.template_file_name
       end
       
+      def template_option
+        {:field => self}
+      end
+      
       def row_break_template_dir
         @form.template_dir + 'row_break/'
       end
       def row_break_template_dir
         @form.template_dir + 'row_break/'
       end
index fc24e93..5fa970b 100644 (file)
@@ -60,6 +60,10 @@ module Locmare
         self.template_dir + self.template_file_name
       end
       
         self.template_dir + self.template_file_name
       end
       
+      def template_option
+        {:field => self}
+      end
+      
       def row_break_template_dir
         @form.template_dir + 'row_break/'
       end
       def row_break_template_dir
         @form.template_dir + 'row_break/'
       end
index 6fc61dc..cfe34ac 100644 (file)
@@ -30,7 +30,7 @@ module Manifest
       
       def find_boost_name column_name
         @boost.each do |boost_name, boost_manifest|
       
       def find_boost_name column_name
         @boost.each do |boost_name, boost_manifest|
-          return boost_name if boost_manifest.extend_column_name == column_name
+          return boost_name if boost_manifest.settings_column_name == column_name
         end
         nil
       end
         end
         nil
       end
index 6bf75e8..a6d0dd0 100644 (file)
         "open",\r
         "commercial",\r
         "official",\r
         "open",\r
         "commercial",\r
         "official",\r
-        "attribution:",\r
+        "attribution",\r
         "derive",\r
         "thumbnail",\r
         "gif_convert",\r
         "derive",\r
         "thumbnail",\r
         "gif_convert",\r