From: yasushiito Date: Fri, 18 Apr 2014 07:09:44 +0000 (+0900) Subject: fix form X-Git-Url: http://git.osdn.net/view?p=pettanr%2Fpettanr.git;a=commitdiff_plain;h=40e590105ff1c1ce18ecf3c8aec0e3e5087ae7a8 fix form --- diff --git a/app/assets/javascripts/manifest/work/forms.js.coffee.erb b/app/assets/javascripts/manifest/work/forms.js.coffee.erb index 3811bb51..fcda8f0a 100644 --- a/app/assets/javascripts/manifest/work/forms.js.coffee.erb +++ b/app/assets/javascripts/manifest/work/forms.js.coffee.erb @@ -1396,7 +1396,7 @@ 'open', 'commercial', 'official', - 'attribution:', + 'attribution', 'derive', 'thumbnail', 'gif_convert', diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 54accf3e..e50c6e80 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,64 +1,69 @@

<%= t '.title' -%>

+<% if @operators.author -%>

<%= link_to h(@operators.author.name), main_app.author_path(@operators.author) -%>

<%= t('.updated_scroll') -%>

- - - - - - - - - - - - - -
- <%= link_to t_m('Scroll'), '/home/scrolls' %> - <%= link_to t('*'), new_scroll_path %> - - <%= link_to t_m('ScrollPanel'), '/home/scroll_panels' %> - <%= link_to t('*'), new_scroll_panel_path %> - - <%= link_to t_m('Comic'), '/home/comics' %> - <%= link_to t('*'), new_comic_path %> - - <%= link_to t_m('Story'), '/home/stories' %> - <%= link_to t('*'), new_story_path %> -
- <%= link_to t_m('StorySheet'), '/home/story_sheets' %> - <%= link_to t('*'), new_story_sheet_path %> - - <%= link_to t_m('Sheet'), '/home/sheets' %> - <%= link_to t('*'), new_sheet_path %> - - <%= link_to t_m('SheetPanel'), '/home/sheet_panels' %> - <%= link_to t('*'), new_sheet_panel_path %> - - <%= link_to t_m('Panel'), '/home/panels' %> - <%= link_to t('*'), new_panel_path %> -
-

<%= t('.used_element') -%>

- - - - - - - - -
- <%= link_to t_m('PanelPicture'), '/home/panel_pictures' %> - - <%= link_to t_m('SpeechBalloon'), '/home/speech_balloons' %> - - <%= link_to t_m('GroundPicture'), '/home/ground_pictures' %> - - <%= link_to t_m('GroundColor'), '/home/ground_colors' %> - <%= link_to t('*'), new_ground_color_path %> - -
+ + + + + + + + + + + + + +
+ <%= link_to t_m('Scroll'), '/home/scrolls' %> + <%= link_to t('*'), new_scroll_path %> + + <%= link_to t_m('ScrollPanel'), '/home/scroll_panels' %> + <%= link_to t('*'), new_scroll_panel_path %> + + <%= link_to t_m('Comic'), '/home/comics' %> + <%= link_to t('*'), new_comic_path %> + + <%= link_to t_m('Story'), '/home/stories' %> + <%= link_to t('*'), new_story_path %> +
+ <%= link_to t_m('StorySheet'), '/home/story_sheets' %> + <%= link_to t('*'), new_story_sheet_path %> + + <%= link_to t_m('Sheet'), '/home/sheets' %> + <%= link_to t('*'), new_sheet_path %> + + <%= link_to t_m('SheetPanel'), '/home/sheet_panels' %> + <%= link_to t('*'), new_sheet_panel_path %> + + <%= link_to t_m('Panel'), '/home/panels' %> + <%= link_to t('*'), new_panel_path %> +
+

<%= t('.used_element') -%>

+ + + + + + + + +
+ <%= link_to t_m('PanelPicture'), '/home/panel_pictures' %> + + <%= link_to t_m('SpeechBalloon'), '/home/speech_balloons' %> + + <%= link_to t_m('GroundPicture'), '/home/ground_pictures' %> + + <%= link_to t_m('GroundColor'), '/home/ground_colors' %> + <%= link_to t('*'), new_ground_color_path %> + +
+<% else -%> +

<%= t('.author') -%>

+

<%= link_to t('.not_author'), main_app.new_author_path -%>

+<% end -%> <% if @operators.artist -%>

<%= link_to h(@operators.artist.name), main_app.artist_path(@operators.artist) -%>

<%= t('.updated_picture') -%>

@@ -81,6 +86,5 @@ <% else -%>

<%= t('.artist') -%>

-

<%= t('.updated_picture') -%>

<%= link_to t('.not_artist'), main_app.new_artist_path -%>

<% end -%> diff --git a/app/views/templates/r/form/_extend_fform.html.erb b/app/views/templates/r/form/_extend_form.html.erb similarity index 54% rename from app/views/templates/r/form/_extend_fform.html.erb rename to app/views/templates/r/form/_extend_form.html.erb index d3e78934..b9868b6f 100644 --- a/app/views/templates/r/form/_extend_fform.html.erb +++ b/app/views/templates/r/form/_extend_form.html.erb @@ -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 %> diff --git a/app/views/templates/r/form/_fields.html.erb b/app/views/templates/r/form/_fields.html.erb index 15b510e6..7202fd26 100644 --- a/app/views/templates/r/form/_fields.html.erb +++ b/app/views/templates/r/form/_fields.html.erb @@ -1,5 +1,5 @@
<% form.each_field do |field_name, field| %> - <%= render field.template_name, :field => field %> + <%= render field.template_name, field.template_option %> <% end %>
diff --git a/config/locales/pettanr.ja.yml b/config/locales/pettanr.ja.yml index 309d9e15..05818545 100644 --- a/config/locales/pettanr.ja.yml +++ b/config/locales/pettanr.ja.yml @@ -483,7 +483,9 @@ ja: catch: つかんでいるコマ used_element: 最近使った部品 updated_picture: 最近更新した画像 + author: 作家 artist: 絵師 + not_author: 作品を公開するには作家登録 not_artist: 画像を公開するには絵師登録 scrolls: title: 最近更新したスクロール @@ -1084,6 +1086,9 @@ ja: title: 作家プロフィール編集 destroy: title: 休筆 + submit: + new: 登録 + edit: 変更 artists: index: title: 絵師一覧 @@ -1102,6 +1107,9 @@ ja: title: 絵師プロフィール編集 destroy: title: 活動停止 + submit: + new: 登録 + edit: 変更 system_pictures: index: title: システム画像一覧 diff --git a/lib/locmare/form.rb b/lib/locmare/form.rb index a9e30545..ce926605 100644 --- a/lib/locmare/form.rb +++ b/lib/locmare/form.rb @@ -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) + p [field_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 @@ -97,13 +97,7 @@ module Locmare 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 @@ -111,6 +105,10 @@ module Locmare "extend_form" end + def template_option + {:form=> self} + end + end end diff --git a/lib/locmare/form/extend_field.rb b/lib/locmare/form/extend_field.rb index 1987c4aa..01abed51 100644 --- a/lib/locmare/form/extend_field.rb +++ b/lib/locmare/form/extend_field.rb @@ -1,6 +1,7 @@ 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 @@ -33,7 +34,7 @@ module Locmare 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 @@ -56,6 +57,10 @@ module Locmare 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 diff --git a/lib/locmare/form/field.rb b/lib/locmare/form/field.rb index fc24e939..5fa970b4 100644 --- a/lib/locmare/form/field.rb +++ b/lib/locmare/form/field.rb @@ -60,6 +60,10 @@ module Locmare 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 diff --git a/lib/manifest/item/base.rb b/lib/manifest/item/base.rb index 6fc61dc1..cfe34ac8 100644 --- a/lib/manifest/item/base.rb +++ b/lib/manifest/item/base.rb @@ -30,7 +30,7 @@ module 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 diff --git a/public/local_manifest.json b/public/local_manifest.json index 6bf75e84..a6d0dd02 100644 --- a/public/local_manifest.json +++ b/public/local_manifest.json @@ -2933,7 +2933,7 @@ "open", "commercial", "official", - "attribution:", + "attribution", "derive", "thumbnail", "gif_convert",