end
def new
- @ground_color = GroundColor.new
- @panel = @author.working_panel
- @ground_color.panel_id = @panel.id
+ @panel = Panel.edit(@author.working_panel, @author)
+ @ground_color = GroundColor.new :panel_id => @panel.id, :code => params[:code].to_i
@ground_color.supply_default
respond_to do |format|
end
def create
- @ground_color = GroundColor.new params[:ground_color]
@panel = Panel.edit(@author.working_panel, @author)
- @ground_color.panel_id = @panel.id
- @ground_color.supply_default
+
+ @ground_color = GroundColor.new
+ @ground_color.attributes = params[:ground_color]
@ground_color.overwrite @panel.id
respond_to do |format|
format.html { redirect_to @panel }
format.json { render json: @panel.panel_elements_as_json, status: :created, location: @panel }
else
- flash[:notice] = I18n.t('flash.notice.not_created', :model => Panel.model_name.human)
- format.html { render action: "panels/new" }
- format.json { render json: @panel.errors, status: :unprocessable_entity }
+ flash[:notice] = I18n.t('flash.notice.not_created', :model => GroundColor.model_name.human)
+ format.html { render action: "new" }
+ format.json { render json: @ground_color.errors, status: :unprocessable_entity }
end
else
flash[:notice] = I18n.t('flash.notice.not_created', :model => GroundColor.model_name.human)
end
def new
- @ground_picture = GroundPicture.new params[:ground_picture]
+ @picture = Picture.show params[:picture_id], @author
+ raise ActiveRecord::Forbidden unless @picture.enable?
+ @panel = Panel.edit(@author.working_panel, @author)
+
+ @ground_picture = GroundPicture.new :panel_id => @panel.id, :picture_id => @picture.id
@ground_picture.supply_default
- @panel = @ground_picture.panel
respond_to do |format|
format.html
end
def create
- @ground_picture = GroundPicture.new params[:ground_picture]
- @ground_picture.supply_default
- @ground_picture.overwrite
- @panel = Panel.edit(@ground_picture.panel.id, @author)
+ @panel = Panel.edit(@author.working_panel, @author)
+
+ @ground_picture = GroundPicture.new
+ @ground_picture.attributes = params[:ground_picture]
+ @ground_picture.overwrite @panel.id
+
+ @picture = Picture.show @ground_picture.picture_id, @author
+ raise ActiveRecord::Forbidden unless @picture.enable?
respond_to do |format|
if @ground_picture.valid?
format.html { redirect_to @panel }
format.json { render json: @panel.panel_elements_as_json, status: :created, location: @panel }
else
- flash[:notice] = I18n.t('flash.notice.not_created', :model => Panel.model_name.human)
- format.html { render action: "panels/new" }
+ flash[:notice] = I18n.t('flash.notice.not_created', :model => GroundPicture.model_name.human)
+ format.html { render action: "new" }
format.json { render json: @panel.errors, status: :unprocessable_entity }
end
else
def update
@ground_picture = GroundPicture.show(params[:id], @author)
@ground_picture.attributes = params[:ground_picture]
- @ground_picture.overwrite
@panel = Panel.edit(@ground_picture.panel.id, @author)
+ @ground_picture.overwrite @panel.id
+
+ @picture = Picture.show @ground_picture.picture_id, @author
+ raise ActiveRecord::Forbidden unless @picture.enable?
respond_to do |format|
if @ground_picture.store @author
end
def new
- @panel_picture = PanelPicture.new params[:panel_picture]
+ @picture = Picture.show params[:picture_id], @author
+ raise ActiveRecord::Forbidden unless @picture.enable?
+ @panel = Panel.edit(@author.working_panel, @author)
+
+ @panel_picture = PanelPicture.new :panel_id => @panel.id, :picture_id => @picture.id
@panel_picture.supply_default
- @panel = @panel_picture.panel
respond_to do |format|
format.html
end
def create
- @panel_picture = PanelPicture.new params[:panel_picture]
- @panel_picture.supply_default
- @panel_picture.overwrite
- @panel = Panel.edit(@panel_picture.panel.id, @author)
+ @panel = Panel.edit(@author.working_panel, @author)
+
+ @panel_picture = PanelPicture.new
+ @panel_picture.attributes = params[:panel_picture]
+ @panel_picture.overwrite @panel.id
+
+ @picture = Picture.show @panel_picture.picture_id, @author
+ raise ActiveRecord::Forbidden unless @picture.enable?
respond_to do |format|
if @panel_picture.valid?
format.html { redirect_to @panel }
format.json { render json: @panel.panel_elements_as_json, status: :created, location: @panel }
else
- flash[:notice] = I18n.t('flash.notice.not_created', :model => Panel.model_name.human)
- format.html { render action: "panels/new" }
+ flash[:notice] = I18n.t('flash.notice.not_created', :model => PanelPicture.model_name.human)
+ format.html { render action: "new" }
format.json { render json: @panel.errors, status: :unprocessable_entity }
end
else
def update
@panel_picture = PanelPicture.show(params[:id], @author)
@panel_picture.attributes = params[:panel_picture]
- @panel_picture.overwrite
@panel = Panel.edit(@panel_picture.panel.id, @author)
+ @panel_picture.overwrite @panel.id
+
+ @picture = Picture.show @panel_picture.picture_id, @author
+ raise ActiveRecord::Forbidden unless @picture.enable?
respond_to do |format|
if @panel_picture.store @author
end
def supply_default
- self.code = 0
+ self.code ||= 0
if self.panel
self.t = self.panel.new_t
self.z = self.panel.new_z
end
end
- def overwrite
+ def overwrite pid
+ self.panel_id = pid
end
def visible? roles
end
end
- def overwrite
+ def overwrite pid
+ self.panel_id = pid
end
def flip
<%= f.label :z %><br />
<%= f.number_field :z %>
</div>
+ <div class="field">
+ <%= f.label :t %><br />
+ <%= f.number_field :t %>
+ </div>
<%= f.hidden_field :panel_id %>
<div class="actions">
<h1><%= t('.title') %></h1>
+<p id="notice"><%= notice %></p>
<h2><%= t('home.index.catch') -%></h2>
<%= render 'panels/standard', :panel => @panel, :author => @author %>
<%= link_to t('link.edit'), edit_ground_color_path(@ground_color) %>
<%= link_to t('link.destroy'), ground_color_path(@ground_color), :method => :delete %>
+
+<% if @author and @author.working? -%>
+ <h3><%= t('home.index.catch') -%></h3>
+ <%= link_to panel_icon(:object => @author.working_panel, :size => 25), panel_path(@author.working_panel) %>
+ <%= link_to @author.working_panel.caption, main_app.panel_path(@author.working_panel) %>
+
+ <p>
+ <%= link_to t('resource_pictures.add_to_panel_for_ground_color'), main_app.new_ground_color_path(:code => @ground_color.code) %>
+ </p>
+<% end -%>
<h1><%= t('.title') %></h1>
+<p id="notice"><%= notice %></p>
+
<h2><%= t('home.index.catch') -%></h2>
<%= render 'panels/standard', :panel => @panel, :author => @author %>
<h2><%= t('ground_pictures.create_ground_picture') -%></h2>
<h1><%= t('.title') %></h1>
+<p id="notice"><%= notice %></p>
+
<h2><%= t('home.index.catch') -%></h2>
<%= render 'panels/standard', :panel => @panel, :author => @author %>
<h2><%= t('panel_pictures.resource_picture') -%></h2>
<h1><%= t '.title' -%></h1>
<p id="notice"><%= notice %></p>
-<%= render 'standard', :panel => @panel, :author => @author %>
+<%= render 'panels/standard', :panel => @panel, :author => @author %>
<%= render 'form' %>
<%= link_to t('link.destroy'), panel_path(@panel), :method => :delete %>
<%= link_to @author.working_panel.caption, main_app.panel_path(@author.working_panel) %>
<p>
- <%= link_to t('resource_pictures.add_to_panel'), main_app.new_panel_picture_path(:panel_picture => {:panel_id => @author.working_panel.id, :picture_id => @resource_picture.picture_id}) %>
+ <%= link_to t('resource_pictures.add_to_panel_for_panel_picture'), main_app.new_panel_picture_path(:picture_id => @resource_picture.picture_id) %>
</p>
<p>
- <%= link_to t('resource_pictures.add_to_panel'), main_app.new_ground_picture_path(:ground_picture => {:panel_id => @author.working_panel.id, :picture_id => @resource_picture.picture_id}) %>
+ <%= link_to t('resource_pictures.add_to_panel_for_ground_picture'), main_app.new_ground_picture_path(:picture_id => @resource_picture.picture_id) %>
</p>
<% end -%>
title: 素材 生一覧
browse:
title: 素材 生単票
- add_to_panel: この素材をつかんだコマに追加する
+ add_to_panel_for_panel_picture: この素材をつかんだコマにコマ絵として追加する
+ add_to_panel_for_ground_picture: この素材をつかんだコマに絵地として追加する
original_picture_license_groups:
new:
title: 画像の公開(ライセンスグループの選択)
end
describe '上書き補充に於いて' do
- it 'defined' do
+ it 'panel_idが設定されている' do
@gp = FactoryGirl.build :ground_picture, :panel_id => @panel.id, :picture_id => @p.id
- @gp.overwrite
+ @gp.overwrite @panel.id
+ @gp.panel_id.should eq @panel.id
end
end