From: yasushiito Date: Fri, 25 Oct 2013 09:49:21 +0000 (+0900) Subject: merge v06sheet X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=6f2a183413df55de274cf896a0b54fceb6be00bf;p=pettanr%2Fpettanr.git merge v06sheet --- 6f2a183413df55de274cf896a0b54fceb6be00bf diff --cc app/assets/javascripts/application.js index 9dbdb97f,ce8c00b4..912b599f --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@@ -7,12 -7,9 +7,13 @@@ //= require jquery //= require jquery_ujs //= require jquery.ui.all +//= require jquery.validate +//= require jquery.validate.additional-methods +//= require jquery.validate.localization/messages_ja //= require textchange +//= require configurations //= require pettanr_editor + //= require pettanr_sheeter //= require writing_formats //= require_directory ./helpers //= require speech_balloon_templates diff --cc app/assets/stylesheets/test.css.scss index 2c3f8ef5,74983c82..ea390d34 --- a/app/assets/stylesheets/test.css.scss +++ b/app/assets/stylesheets/test.css.scss @@@ -16,21 -16,24 +16,39 @@@ div.md5 text-align: left; } +input.error { + border-width: 3px; + border-style: solid; + border-color: #ef29ef; +} +textarea.error { + border-style: solid; + border-color: #111; +} +select.error { + border-style: solid; + border-color: #111; +} + + .sheet { + position: relative; + overflow: hidden; + float: left; + clear: left; + } + + .sheet-data { + float: left; + } + + .sheet-break { + clear: both; + } + + .sheet_panel { + position: absolute; + } + .pettanr-comic-wrapper { margin: 1em auto; } diff --cc app/views/comics/_form.html.erb index 84b983cc,84b983cc..5d9ce6af --- a/app/views/comics/_form.html.erb +++ b/app/views/comics/_form.html.erb @@@ -5,18 -5,18 +5,26 @@@ <%= f.label :title %>
<%= f.text_field :title %> ++
++
<%= f.label :description %>
<%= f.text_area :description %>
++
++
<%= f.label :visible %>
<%= f.collection_select :visible, t_select_items(MagicNumber['comic_visible_items']), :last, :first, :html => {:selected => @comic.visible} %>
++
++
<%= f.label :author_id %>
<%= h @author.name %>
++
++
<%= f.submit %>
diff --cc app/views/home/index.html.erb index d8653b12,345ca40c..1bd720e9 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@@ -1,6 -1,7 +1,6 @@@

<%= t '.title' -%>

-

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

-

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

+

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

diff --cc app/views/scroll_panels/_form.html.erb index 00000000,f2f70ad5..0cf77a8e mode 000000,100644..100644 --- a/app/views/scroll_panels/_form.html.erb +++ b/app/views/scroll_panels/_form.html.erb @@@ -1,0 -1,20 +1,26 @@@ + <%= form_for(@scroll_panel) do |f| %> + <%= render 'system/error_explanation', :obj => @scroll_panel %> + +
+ <%= f.label :scroll_id %>
+ <%= f.number_field :scroll_id %> +
++
++
+
+ <%= f.label :t %>
+ <%= f.number_field :t %> +
++
++
+
+ <%= f.label :panel_id %>
+ <%= f.number_field :panel_id %> +
++
++
+ +
+ <%= f.submit %> +
+ <% end %> diff --cc app/views/scroll_panels/edit.html.erb index 00000000,dc72ec58..1d67f75e mode 000000,100644..100644 --- a/app/views/scroll_panels/edit.html.erb +++ b/app/views/scroll_panels/edit.html.erb @@@ -1,0 -1,5 +1,4 @@@ +

<%= t('.title') %>

+

<%= notice %>

+ + <%= render 'form' %> -<%= button_to 'Destroy', @scroll_panel, confirm: 'Are you sure?', method: :delete %> diff --cc app/views/scrolls/_form.html.erb index 00000000,3ca23fb0..d0a51d06 mode 000000,100644..100644 --- a/app/views/scrolls/_form.html.erb +++ b/app/views/scrolls/_form.html.erb @@@ -1,0 -1,23 +1,31 @@@ + <%= form_for(@scroll) do |f| %> + <%= render 'system/error_explanation', :obj => @scroll %> + +
+ <%= f.label :title %>
+ <%= f.text_field :title %> +
++
++
+
+ <%= f.label :description %>
+ <%= f.text_area :description %> +
++
++
+
+ <%= f.label :visible %>
+ <%= f.collection_select :visible, t_select_items(MagicNumber['scroll_visible_items']), :last, :first, :html => {:selected => @scroll.visible} %> +
++
++
+
+ <%= f.label :author_id %>
+ <%= h @author.name %> +
++
++
+
+ <%= f.submit %> +
+ <% end %> diff --cc app/views/sheet_panels/_form.html.erb index 00000000,6f178a8d..e534ca67 mode 000000,100644..100644 --- a/app/views/sheet_panels/_form.html.erb +++ b/app/views/sheet_panels/_form.html.erb @@@ -1,0 -1,28 +1,32 @@@ + <%= form_for(elm) do |f| %> + <%= render 'system/error_explanation', :obj => elm %> + +
+ <%= f.label :x %> + <%= f.number_field :x, elm.field_tag_attributes(:x, no_attr, :size => 5) %> + + <%= f.label :y %> + <%= f.number_field :y, elm.field_tag_attributes(:y, no_attr, :size => 5) %> +
++
++
+
+ <%= f.label :z %> + <%= f.number_field :z, elm.field_tag_attributes(:z, no_attr, :size => 5) %> + + <%= f.label :t %> + <%= f.number_field :t, elm.field_tag_attributes(:t, no_attr, :size => 5) %> +
++
++
+ + <%= f.hidden_field :panel_id, elm.field_tag_attributes(:panel_id, no_attr) %> + <%= f.hidden_field :sheet_id, elm.field_tag_attributes(:sheet_id, no_attr) %> + <% unless elm.new_record? %> + <%= f.hidden_field :id, elm.field_tag_attributes(:id, no_attr) %> + <% end %> + +
+ <%= f.submit t('sheet_panels.submit'), :class => "submit" %> +
+ <% end %> diff --cc app/views/sheets/_form.html.erb index 00000000,c061d5eb..4975a236 mode 000000,100644..100644 --- a/app/views/sheets/_form.html.erb +++ b/app/views/sheets/_form.html.erb @@@ -1,0 -1,99 +1,105 @@@ +
+ +
+ <%= form_for(@sheet) do |f| %> + <%= render 'system/error_explanation', :obj => @sheet %> + +
+ <%= f.label :caption %> + <%= f.text_field :caption, :id => @sheet.field_tag_id(:caption), :sheet_id => @sheet.tag_sheet_id, :column => :caption -%> +
++
++
+
+ <%= f.label :width %> + <%= f.number_field :width, :size => 5, :id => @sheet.field_tag_id(:width), :sheet_id => @sheet.tag_sheet_id, :column => :width %> + + <%= f.label :height %> + <%= f.number_field :height, :size => 5, :id => @sheet.field_tag_id(:height), :sheet_id => @sheet.tag_sheet_id, :column => :height %> + +
++
++
+
+ <%= f.label :visible %> + <%= f.collection_select :visible, t_select_items(MagicNumber['sheet_visible_items']), :last, :first, {:html => {:selected => @sheet.visible}}, {:id => @sheet.field_tag_id(:visible), :sheet_id => @sheet.tag_sheet_id, :column => :visible} %> +
++
++
+ <% unless @sheet.new_record? %> + <%= f.hidden_field :id, :id => @sheet.field_tag_id(:id), :sheet_id => @sheet.tag_sheet_id, :column => :id %> + <% end %> +
+ <%= f.submit 'sheets.submit', :class => "submit" %> +
+ <% end %> +
+
+
+
    + <% @sheet.sheet_elements.each do |elm| %> + <%= render 'element_tab', :elm => elm %> + <% end %> +
+ <% @sheet.sheet_elements.each do |elm| %> +
+
+ <%= render elm.form_template, :elm => elm, :no_attr => 0 %> + <%= hidden_field_tag '_destroy', '', :id => elm.field_tag_id(:_destroy), :sheet_id => elm.tag_sheet_id, :element_id => elm.tag_element_id, :element_type => elm.tag_element_type, :column => :_destroy %> +
+
+ <% end %> +
+
+
+
+
    + <% @sheet.sheet_elements.each do |elm| %> +
  • +
    + <%= render elm.path_name + '/element_face', :elm => elm %> +
    +
  • + <% end %> +
+
+
+ <% @sheet.sheet_elements.each do |elm| %> +
+ <%= render elm.scenario_template, :elm => elm, :no_attr => 0 %> +
+ <% end %> +
+
+
+
+
+
+
    + <% @sheet.zorderd_elements.each do |elm| %> +
  • +
    + <%= render elm.class.to_s.tableize + '/element_face', :elm => elm %> +
    +
  • + <% end %> +
+
+
+
+
+
+ <%= form_for(@sheet, :html => {:jqform => 'pettanr-sheet-form'}) do |f| %> + <%= render 'system/error_explanation', :obj => @sheet %> + + <%= text_field_tag "json", '', :id => 'pettanr-sheet-json' %> +
+ <%= submit_tag t('sheets.create_from_json'), :id => 'pettanr-sheet-submit' -%> +
+ <% end %> diff --cc app/views/stories/_form.html.erb index 8d705f58,4355267d..d5d80a42 --- a/app/views/stories/_form.html.erb +++ b/app/views/stories/_form.html.erb @@@ -5,14 -5,26 +5,38 @@@ <%= f.label :comic_id %>
<%= f.number_field :comic_id %> ++
++
+
+ <%= f.label :title %>
+ <%= f.text_field :title %> +
++
++
+
+ <%= f.label :description %>
+ <%= f.text_area :description %> +
++
++
+
+ <%= f.label :visible %>
+ <%= f.collection_select :visible, t_select_items(MagicNumber['story_visible_items']), :last, :first, :html => {:selected => @story.visible} %> +
++
++
+
+ <%= f.label :author_id %>
+ <%= h @author.name %> +
++
++
<%= f.label :t %>
<%= f.number_field :t %>
-
- <%= f.label :panel_id %>
- <%= f.number_field :panel_id %> ++
+
<%= f.submit %> diff --cc app/views/story_sheets/_form.html.erb index 00000000,601a0f91..3d8b0752 mode 000000,100644..100644 --- a/app/views/story_sheets/_form.html.erb +++ b/app/views/story_sheets/_form.html.erb @@@ -1,0 -1,20 +1,26 @@@ + <%= form_for(@story_sheet) do |f| %> + <%= render 'system/error_explanation', :obj => @story_sheet %> + +
+ <%= f.label :story_id %>
+ <%= f.number_field :story_id %> +
++
++
+
+ <%= f.label :sheet_id %>
+ <%= f.number_field :sheet_id %> +
++
++
+
+ <%= f.label :t %>
+ <%= f.number_field :t %> +
++
++
+ +
+ <%= f.submit %> +
+ <% end %> diff --cc app/views/story_sheets/edit.html.erb index 00000000,7e45d59d..1d67f75e mode 000000,100644..100644 --- a/app/views/story_sheets/edit.html.erb +++ b/app/views/story_sheets/edit.html.erb @@@ -1,0 -1,5 +1,4 @@@ +

<%= t('.title') %>

+

<%= notice %>

+ + <%= render 'form' %> -<%= button_to 'Destroy', @story_sheet, confirm: 'Are you sure?', method: :delete %> diff --cc db/migrate/20130911043458_copy_to_scroll.rb index 00000000,fe977c8f..37f9f544 mode 000000,100644..100644 --- a/db/migrate/20130911043458_copy_to_scroll.rb +++ b/db/migrate/20130911043458_copy_to_scroll.rb @@@ -1,0 -1,20 +1,23 @@@ + require Rails.root + 'config/environment' + class CopyToScroll < ActiveRecord::Migration + def up + ::Comic.find(:all).each do |i| + attr = i.attributes + attr.delete 'id' + ::Scroll.create! attr + end + ::Story.find(:all).each do |i| + attr = i.attributes + attr.delete 'id' ++ attr.delete 'x' ++ attr.delete 'y' ++ attr.delete 'z' + attr['scroll_id'] = attr['comic_id'] + attr.delete 'comic_id' + ::ScrollPanel.create! attr + end + end + + def down + end + end diff --cc spec/models/panel_spec.rb index f9aa5722,416fb177..20afa074 --- a/spec/models/panel_spec.rb +++ b/spec/models/panel_spec.rb @@@ -30,9 -31,9 +31,6 @@@ describe Panel d @panel.width = 1 @panel.height = 1 @panel.border = 0 -- @panel.x = -99999 -- @panel.y = -99999 -- @panel.z = 1 @panel.publish = 0 @panel.should be_valid end @@@ -40,9 -41,9 +38,6 @@@ @panel.width = 99999 @panel.height = 99999 @panel.border = 99999 -- @panel.x = 99999 -- @panel.y = 99999 -- @panel.z = 99999 @panel.publish = 99999 @panel.should be_valid end @@@ -102,48 -103,48 +97,6 @@@ @panel.should be_valid end end -- context 'xを検証するとき' do -- it '数値でなければ失敗する' do -- @panel.x = 'a' -- @panel.should_not be_valid -- end -- it '0なら通る' do -- @panel.x = '0' -- @panel.should be_valid -- end -- it '負でも通る' do -- @panel.x = -1 -- @panel.should be_valid -- end -- end -- context 'yを検証するとき' do -- it '数値でなければ失敗する' do -- @panel.y = 'a' -- @panel.should_not be_valid -- end -- it '0なら通る' do -- @panel.y = '0' -- @panel.should be_valid -- end -- it '負でも通る' do -- @panel.y = -1 -- @panel.should be_valid -- end -- end -- context 'zを検証するとき' do -- it '数値でなければ失敗する' do -- @panel.z = 'a' -- @panel.should_not be_valid -- end -- it '0なら失敗する' do -- @panel.z = '0' -- @panel.should_not be_valid -- end -- it '負なら失敗する' do -- @panel.z = -1 -- @panel.should_not be_valid -- end -- end context 'author_idを検証するとき' do it 'nullなら失敗する' do @panel.author_id = nil