OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
authoryasushiito <yas@pen-chan.jp>
Fri, 7 Jun 2013 06:25:18 +0000 (15:25 +0900)
committeryasushiito <yas@pen-chan.jp>
Fri, 7 Jun 2013 06:25:18 +0000 (15:25 +0900)
23 files changed:
app/controllers/ground_pictures_controller.rb
app/models/ground_color.rb
app/models/ground_picture.rb
app/models/panel.rb
app/models/panel_picture.rb
app/views/authors/ground_pictures.html.erb
app/views/ground_colors/_body.html.erb
app/views/ground_pictures/_body.html.erb [new file with mode: 0644]
app/views/ground_pictures/_form.html.erb [new file with mode: 0644]
app/views/ground_pictures/_list_item.html.erb
app/views/ground_pictures/_standard.html.erb [new file with mode: 0644]
app/views/ground_pictures/edit.html.erb [new file with mode: 0644]
app/views/ground_pictures/index.html.erb
app/views/ground_pictures/new.html.erb [new file with mode: 0644]
app/views/ground_pictures/show.html.erb
app/views/home/ground_pictures.html.erb
app/views/panel_pictures/_body.html.erb
app/views/panels/_body.html.erb
app/views/panels/_standard.html.erb
app/views/resource_pictures/show.html.erb
config/locales/pettanr.ja.yml
config/magic_number.yml
config/routes.rb

index 2d6aff4..be166c4 100644 (file)
@@ -1,12 +1,12 @@
 class GroundPicturesController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
   if MagicNumber['run_mode'] == 0
-    before_filter :authenticate_user, :only => []
-    before_filter :authenticate_author, :only => []
+    before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy]
+    before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
   else
     before_filter :authenticate_reader, :only => [:index, :show]
-    before_filter :authenticate_user, :only => []
-    before_filter :authenticate_author, :only => []
+    before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy]
+    before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
   end
 
   def index
@@ -29,4 +29,83 @@ class GroundPicturesController < ApplicationController
       format.json { render json: @ground_picture.to_json(GroundPicture.show_json_opt) }
     end
   end
+  
+  def new
+    @ground_picture = GroundPicture.new params[:ground_picture]
+    @ground_picture.supply_default
+    @panel = @ground_picture.panel
+
+    respond_to do |format|
+      format.html
+      format.json { render :json => @ground_picture.to_json(GroundPicture.show_json_opt) }
+    end
+  end
+
+  def edit
+    @ground_picture = GroundPicture.show(params[:id], @author)
+    @panel = Panel.edit(@ground_picture.panel.id, @author)
+    
+    respond_to do |format|
+      format.html
+    end
+  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)
+    
+    respond_to do |format|
+      if @ground_picture.valid?
+        if @ground_picture.store @author
+          flash[:notice] = I18n.t('flash.notice.created', :model => Panel.model_name.human)
+          format.html { redirect_to @panel }
+          format.json { render json: @panel.panel_elements_as_json, status: :created, location: @panel }
+        else
+          format.html { render action: "panels/new" }
+          format.json { render json: @panel.errors, status: :unprocessable_entity }
+        end
+      else
+        format.html { render action: "new" }
+        format.json { render json: @ground_picture.errors, status: :unprocessable_entity }
+      end
+    end
+  end
+
+  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)
+    
+    respond_to do |format|
+      if @ground_picture.store @author
+        flash[:notice] = I18n.t('flash.notice.updated', :model => GroundPicture.model_name.human)
+        format.html { redirect_to @ground_picture }
+        format.json { head :ok }
+      else
+        format.html { render action: "edit" }
+        format.json { render json: @ground_picture.errors, status: :unprocessable_entity }
+      end
+    end
+  end
+
+  def destroy
+    @ground_picture = GroundPicture.show(params[:id], @author)
+    @panel = Panel.edit(@ground_picture.panel.id, @author)
+    
+    respond_to do |format|
+      if @ground_picture.remove @author
+        flash[:notice] = I18n.t('flash.notice.destroyed', :model => GroundPicture.model_name.human)
+        format.html { redirect_to @panel }
+        format.json { head :ok }
+      else
+        flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => GroundPicture.model_name.human)
+        format.html { redirect_to @ground_picture }
+        format.json { render json: @ground_picture.errors, status: :unprocessable_entity }
+      end
+    end
+  end
+  
 end
index e1452d3..59bdbf6 100644 (file)
@@ -120,25 +120,22 @@ class GroundColor < ActiveRecord::Base
   end
   
   def remove au
-    PanelPicture.transaction do
-      d = false
-      panel_pictures_attributes = {}
-      
-      self.panel.panel_pictures.each do |panel_picture|
-        attr = panel_picture.attributes
-        if panel_picture == self
-          attr['_destroy'] = true
-          d = true
-        else
-          if d
-            attr['t']  -= 1 
-          end
+    d = false
+    ground_colors_attributes = {}
+    self.panel.ground_colors.each do |ground_color|
+      attr = ground_color.attributes
+      if ground_color == self
+        attr['_destroy'] = true
+        d = true
+      else
+        if d
+          attr['t']  -= 1 
         end
-        panel_pictures_attributes[panel_picture.id] = attr
       end
-      self.panel.attributes = {:panel_pictures_attributes => panel_pictures_attributes}
-      self.panel.store({}, au)
+      ground_colors_attributes[ground_color.id] = attr
     end
+    self.panel.attributes = {:ground_colors_attributes => ground_colors_attributes}
+    self.panel.store({}, au)
   end
   
   def scenario
index 225db2d..086e5dd 100644 (file)
@@ -9,6 +9,8 @@ class GroundPicture < ActiveRecord::Base
   validates :picture_id, :numericality => true, :existence => {:both => false}
   validates :z, :presence => true, :numericality => {:greater_than => 0}
   
+  @@repeat_texts = ['repeat', 'repeat-x', 'repeat-y', 'no-repeat']
+  
   def supply_default
     self.repeat = 0
     self.x = 0
@@ -28,6 +30,20 @@ class GroundPicture < ActiveRecord::Base
     self.panel.visible? roles
   end
   
+  def opt_div_style full_url, spot = nil, opacity = 20
+    o = spot and spot != self ? "opacity: #{opacity.to_f/100}; filter:alpha(opacity=#{opacity});" : ''
+    "width:#{self.panel.width}px; height:#{self.panel.height}px; z-index:#{self.z}; background-image: url(#{full_url}); background-repeat: #{self.repeat_text}; background-position: #{self.x}px, #{self.y}px; #{o}"
+  end
+  
+  def tmb_opt_img_tag
+    tw, th = PettanImager.thumbnail_size(self.picture.width, self.picture.height)
+    {:src => self.picture.url, :width => tw, :height => th, :alt => self.caption}
+  end
+  
+  def repeat_text
+    @@repeat_texts[self.repeat]
+  end
+  
   def self.default_page_size
     25
   end
@@ -109,6 +125,40 @@ class GroundPicture < ActiveRecord::Base
     {:include => {:panel => {:include => {:author => {}}}, :picture => {:include => {:artist => {}, :license => {}}} }}
   end
   
+  def store au
+    if self.new_record?
+      self.panel.ground_pictures.build(self.attributes)
+    else
+      self.panel.ground_pictures.each do |ground_picture|
+        next unless ground_picture == self
+        attr = self.attributes
+        attr.delete 'id'
+        ground_picture.attributes = attr
+        break
+      end
+    end
+    self.panel.store({}, au)
+  end
+  
+  def remove au
+    d = false
+    ground_pictures_attributes = {}
+    self.panel.ground_pictures.each do |ground_picture|
+      attr = ground_picture.attributes
+      if ground_picture == self
+        attr['_destroy'] = true
+        d = true
+      else
+        if d
+ #         attr['t']  -= 1 
+        end
+      end
+      ground_pictures_attributes[ground_picture.id] = attr
+    end
+    self.panel.attributes = {:ground_pictures_attributes => ground_pictures_attributes}
+    self.panel.store({}, au)
+  end
+  
   def scenario
     ''
   end
index d7dbfc0..dc8948a 100644 (file)
@@ -294,6 +294,7 @@ class Panel < ActiveRecord::Base
     Panel.transaction do
       res = self.save
       unless validate_child
+        res = false
         self.errors.add :base, I18n.t('errors.invalid_t')
         raise ActiveRecord::Rollback
       end
index 8607279..e960e3e 100644 (file)
@@ -57,8 +57,8 @@ class PanelPicture < ActiveRecord::Base
     '/pictures/' + self.filename
   end
   
-  def opt_img_tag opacity = nil
-    o = opacity ? "opacity: #{opacity.to_f/100}; filter:alpha(opacity=#{opacity});" : ''
+  def opt_img_tag spot = nil, opacity = 20
+    o = spot and spot != self ? "opacity: #{opacity.to_f/100}; filter:alpha(opacity=#{opacity});" : ''
     {:src => self.url, :vPicture => self.id, :width => self.width.abs, :height => self.height.abs, :alt => self.caption, :style => "top:#{self.y}px; left:#{self.x}px; z-index:#{self.z}; #{o}"}
   end
   
@@ -172,25 +172,22 @@ class PanelPicture < ActiveRecord::Base
   end
   
   def remove au
-    PanelPicture.transaction do
-      d = false
-      panel_pictures_attributes = {}
-      
-      self.panel.panel_pictures.each do |panel_picture|
-        attr = panel_picture.attributes
-        if panel_picture == self
-          attr['_destroy'] = true
-          d = true
-        else
-          if d
-            attr['t']  -= 1 
-          end
+    d = false
+    panel_pictures_attributes = {}
+    self.panel.panel_pictures.each do |panel_picture|
+      attr = panel_picture.attributes
+      if panel_picture == self
+        attr['_destroy'] = true
+        d = true
+      else
+        if d
+          attr['t']  -= 1 
         end
-        panel_pictures_attributes[panel_picture.id] = attr
       end
-      self.panel.attributes = {:panel_pictures_attributes => panel_pictures_attributes}
-      self.panel.store({}, au)
+      panel_pictures_attributes[panel_picture.id] = attr
     end
+    self.panel.attributes = {:panel_pictures_attributes => panel_pictures_attributes}
+    self.panel.store({}, au)
   end
   
   def scenario
index c886ec1..726c337 100644 (file)
@@ -2,36 +2,20 @@
 
 <table>
   <tr>
-    <th><%= t_m 'GroundPicture.panel_id' -%></th>
+    <th><%= t_m 'GroundPicture.id' -%></th>
+    <th><%= t_m 'GroundPicture.caption' -%></th>
     <th><%= t_m 'GroundPicture.picture_id' -%></th>
     <th><%=   -%></th>
+    <th><%= t_m 'GroundPicture.panel_id' -%></th>
     <th><%= t_m 'GroundPicture.z' -%></th>
     <th><%= t_m 'GroundPicture.repeat' -%></th>
     <th><%= t_m 'GroundPicture.x' -%></th>
     <th><%= t_m 'GroundPicture.y' -%></th>
-    <th><%= t_m 'GroundPicture.created_at' -%></th>
     <th><%= t_m 'GroundPicture.updated_at' -%></th>
   </tr>
 
-  <% @ground_pictures.each do |ground_picture| %>
-    <tr>
-      <td><%= link_to ground_picture.panel_id, panel_path(ground_picture.panel_id) %></td>
-      <% if ground_picture.picture.showable? @author %>
-        <td><%= link_to(tag(:img, ground_picture.picture.tmb_opt_img_tag), ground_picture) -%></td>
-        <td><%= render ground_picture.picture.credit_template, :picture => ground_picture.picture %></td>
-      <% else %>
-        <td>
-          <%= link_to(tag(:img, ground_picture.picture.tail_tmb_opt_img_tag(asset_path('error.png'))), ground_picture) -%>
-        </td>
-        <td></td>
-      <% end %>
-      <td><%= ground_picture.z %></td>
-      <td><%= ground_picture.repeat %><%= MagicNumber['ground_picture_repeat_items'][ground_picture.repeat] %></td>
-      <td><%= ground_picture.x %></td>
-      <td><%= ground_picture.y %></td>
-      <td><%= distance_of_time_in_words_to_now ground_picture.created_at %></td>
-      <td><%= distance_of_time_in_words_to_now ground_picture.updated_at %></td>
-    </tr>
+  <% @ground_pictures.each do |gp| %>
+    <%= render 'ground_pictures/list_item', :ground_picture => gp %>
   <% end %>
 </table>
 <%= paginate(@paginate) %>
index 3316aa8..41b4048 100644 (file)
@@ -18,7 +18,7 @@
       
       </div>
     <% when 'GroundPicture' %>
-      <div id="ground-picture<%= elm.id -%>" class="pettanr-comic-ground-picture" style="width:<%= panel.width -%>px; height:<%= panel.height -%>px; z-index:<%= elm.z -%>; background-image: url(<%= full_url elm.picture.url -%>); background-repeat: <%= MagicNumber['ground_picture_repeat_items'][elm.repeat] -%>; background-position: <%= elm.x -%>px, <%= elm.y -%>px;">
+      <div id="ground-picture<%= elm.id -%>" class="pettanr-comic-ground-picture" style="width:<%= panel.width -%>px; height:<%= panel.height -%>px; z-index:<%= elm.z -%>; background-image: url(<%= full_url elm.picture.url -%>); background-repeat: <%= elm.repeat_text -%>; background-position: <%= elm.x -%>px, <%= elm.y -%>px;">
         
       </div>
     <% end %>
diff --git a/app/views/ground_pictures/_body.html.erb b/app/views/ground_pictures/_body.html.erb
new file mode 100644 (file)
index 0000000..41b4048
--- /dev/null
@@ -0,0 +1,26 @@
+<div class="pettanr-comic-panel" style="width:<%= panel.width %>px;height:<%= panel.height %>px;border-style: solid;border-width: <%= panel.border %>px;border-color:black; background-color:white;">
+  <% panel.panel_elements.each do |elm| %>
+    <% case elm.class.to_s %>
+    <% when 'PanelPicture' %>
+      <%= link_to_unless(elm.link.blank?, tag(:img, elm.opt_img_tag(elm == spot ? nil : 33)), elm.link) %>
+    <% when 'SpeechBalloon' %>
+      <% balloon = elm.balloons.first %>
+      <div id="vballoon<%= elm.id -%>" class="pettanr-comic-balloon" style="width:<%= balloon.width -%>px; height:<%= balloon.height -%>px; top:<%= balloon.y -%>px; left:<%= balloon.x -%>px; z-index:<%= elm.z -%>; ">
+        <img src="<%= balloon.system_picture.url -%>" alt="<%= balloon.caption -%>">
+        <% elm.speeches.each do |speech| %>
+          <p style="top:<%= speech.y -%>px; left:<%= speech.x -%>px;width:<%= speech.width -%>px; height:<%= speech.height -%>px;">
+            <span><%= h speech.content -%></span>
+          </p>
+        <% end %>
+      </div>
+    <% when 'GroundColor' %>
+      <div id="ground-color<%= elm.id -%>" class="pettanr-comic-ground-color" style="width:<%= panel.width -%>px; height:<%= panel.height -%>px; z-index:<%= elm.z -%>; background-color:#<%= format("%06x", elm.code) -%>;">
+      
+      </div>
+    <% when 'GroundPicture' %>
+      <div id="ground-picture<%= elm.id -%>" class="pettanr-comic-ground-picture" style="width:<%= panel.width -%>px; height:<%= panel.height -%>px; z-index:<%= elm.z -%>; background-image: url(<%= full_url elm.picture.url -%>); background-repeat: <%= elm.repeat_text -%>; background-position: <%= elm.x -%>px, <%= elm.y -%>px;">
+        
+      </div>
+    <% end %>
+  <% end %>
+</div>
diff --git a/app/views/ground_pictures/_form.html.erb b/app/views/ground_pictures/_form.html.erb
new file mode 100644 (file)
index 0000000..46f2884
--- /dev/null
@@ -0,0 +1,36 @@
+<%= form_for(@ground_picture) do |f| %>
+  <%= render 'system/error_explanation', :obj => @ground_picture %>
+
+        repeat:
+  <div class="field">
+    <%= f.label :caption %><br />
+    <%= f.text_field :caption %>
+  </div>
+  <div class="field">
+    <%= f.label :repeat %><br />
+    <%= f.collection_select :repeat, t_select_items(MagicNumber['ground_picture_repeat_items']), :last, :first, :html => {:selected => @ground_picture.repeat} %>
+  </div>
+  <div class="field">
+    <%= f.label :x %><br />
+    <%= f.number_field :x %>
+  </div>
+  <div class="field">
+    <%= f.label :y %><br />
+    <%= f.number_field :y %>
+  </div>
+  <div class="field">
+    <%= 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 %>
+  <%= f.hidden_field :picture_id %>
+
+  <div class="actions">
+    <%= f.submit %>
+  </div>
+<% end %>
index 88a71eb..891ff87 100644 (file)
@@ -1,7 +1,14 @@
 <tr>
-  <td><%= link_to ground_picture.panel_id, panel_path(ground_picture.panel_id) %></td>
+  <td>
+    <%= link_to(h(ground_picture.id.to_s), ground_picture_path(ground_picture)) %>
+  </td>
+  <td>
+    <%= link_to(h(truncate(ground_picture.caption, :length => 12)), ground_picture_path(ground_picture)) %>
+  </td>
   <% if ground_picture.picture.showable? @author %>
-    <td><%= link_to(tag(:img, ground_picture.picture.tmb_opt_img_tag), ground_picture) -%></td>
+    <td>
+      <%= link_to(tag(:img, ground_picture.picture.tmb_opt_img_tag), ground_picture.picture) -%>
+    </td>
     <td><%= render ground_picture.picture.credit_template, :picture => ground_picture.picture %></td>
   <% else %>
     <td>
     </td>
     <td></td>
   <% end %>
-  <td><%= ground_picture.z %></td>
-  <td><%= ground_picture.repeat %><%= MagicNumber['ground_picture_repeat_items'][ground_picture.repeat] %></td>
+  <td>
+    <%= link_to panel_icon(:object => ground_picture.panel, :size => 25), panel_path(ground_picture.panel) %>
+    <%= link_to h(truncate((ground_picture.panel.caption), :length => 12)), panel_path(ground_picture.panel) %>
+  </td>
+  <td>
+    <%= ground_picture.z %>
+  </td>
+  <td>
+    <%= ground_picture.repeat_text %>
+  </td>
   <td><%= ground_picture.x %></td>
   <td><%= ground_picture.y %></td>
-  <td><%= distance_of_time_in_words_to_now ground_picture.created_at %></td>
   <td><%= distance_of_time_in_words_to_now ground_picture.updated_at %></td>
 </tr>
diff --git a/app/views/ground_pictures/_standard.html.erb b/app/views/ground_pictures/_standard.html.erb
new file mode 100644 (file)
index 0000000..47dee5d
--- /dev/null
@@ -0,0 +1,6 @@
+<b><%= t_m 'Panel.caption' -%>:</b>
+<%= h(panel.caption) %>
+<%= render 'panel_pictures/body', :panel => panel, :author => author, :spot => spot %>
+<%= render 'panels/footer', :panel => panel, :author => author %>
+<%= render 'panels/licensed_pictures', :licensed_pictures => panel.licensed_pictures %>
+
diff --git a/app/views/ground_pictures/edit.html.erb b/app/views/ground_pictures/edit.html.erb
new file mode 100644 (file)
index 0000000..7fb5b02
--- /dev/null
@@ -0,0 +1,6 @@
+<h1><%= t('.title') %></h1>
+
+<h2><%= t('home.index.catch') -%></h2>
+<%= render 'panels/standard', :panel => @panel, :author => @author %>
+<h2><%= t('ground_colors.update_color') -%></h2>
+<%= render 'form' %>
index a0c589d..113187c 100644 (file)
@@ -2,14 +2,15 @@
 
 <table>
   <tr>
-    <th><%= t_m 'GroundPicture.panel_id' -%></th>
+    <th><%= t_m 'GroundPicture.id' -%></th>
+    <th><%= t_m 'GroundPicture.caption' -%></th>
     <th><%= t_m 'GroundPicture.picture_id' -%></th>
     <th><%=   -%></th>
+    <th><%= t_m 'GroundPicture.panel_id' -%></th>
     <th><%= t_m 'GroundPicture.z' -%></th>
     <th><%= t_m 'GroundPicture.repeat' -%></th>
     <th><%= t_m 'GroundPicture.x' -%></th>
     <th><%= t_m 'GroundPicture.y' -%></th>
-    <th><%= t_m 'GroundPicture.created_at' -%></th>
     <th><%= t_m 'GroundPicture.updated_at' -%></th>
   </tr>
 
diff --git a/app/views/ground_pictures/new.html.erb b/app/views/ground_pictures/new.html.erb
new file mode 100644 (file)
index 0000000..efd7dcb
--- /dev/null
@@ -0,0 +1,20 @@
+<h1><%= t('.title') %></h1>
+<h2><%= t('home.index.catch') -%></h2>
+<%= render 'panels/standard', :panel => @panel, :author => @author %>
+<h2><%= t('ground_pictures.create_ground_picture') -%></h2>
+<% if @ground_picture.picture and @ground_picture.picture.resource_picture %>
+  <table>
+    <tr>
+      <th></th>
+      <th></th>
+      <th><%= t_m 'ResourcePicture.artist_id' -%></th>
+      <th><%= t_m 'ResourcePicture.ext' -%></th>
+      <th><%= t_m 'ResourcePicture.width' -%></th>
+      <th><%= t_m 'ResourcePicture.height' -%></th>
+      <th><%= t_m 'ResourcePicture.filesize' -%></th>
+    </tr>
+
+    <%= render 'resource_pictures/list_item', :resource_picture => @ground_picture.picture.resource_picture %>
+  </table>
+<% end %>
+<%= render 'form' %>
index 51e0115..a48a414 100644 (file)
@@ -1,3 +1,42 @@
 <h1><%= t('.title') %></h1>
 <p id="notice"><%= notice %></p>
 
+<%= render 'panel_pictures/standard', :panel => @ground_picture.panel, :author => @author, :spot => @ground_picture %>
+
+<p>
+  <b><%= t_m 'GroundPicture.caption' -%>:</b>
+  <%= h @ground_picture.caption %>
+</p>
+
+<p>
+  <b><%= t_m 'GroundPicture.z' -%>:</b>
+  <%= @ground_picture.z %>
+</p>
+
+<p>
+  <b><%= t_m 'GroundPicture.repeat' -%>:</b>
+  <%= @ground_picture.repeat %>
+</p>
+
+<p>
+  <b><%= t_m 'GroundPicture.x' -%>:</b>
+  <%= @ground_picture.x %>
+</p>
+
+<p>
+  <b><%= t_m 'GroundPicture.y' -%>:</b>
+  <%= @ground_picture.y %>
+</p>
+
+<p>
+  <b><%= t_m 'GroundPicture.created_at' -%>:</b>
+  <%= l @ground_picture.created_at %>
+</p>
+
+<p>
+  <b><%= t_m 'GroundPicture.updated_at' -%>:</b>
+  <%= l @ground_picture.updated_at %>
+</p>
+
+<%= link_to t('link.edit'), edit_ground_picture_path(@ground_picture) %>
+<%= link_to t('link.destroy'), ground_picture_path(@ground_picture), :method => :delete %>
index a0c589d..adc460f 100644 (file)
@@ -2,19 +2,20 @@
 
 <table>
   <tr>
-    <th><%= t_m 'GroundPicture.panel_id' -%></th>
+    <th><%= t_m 'GroundPicture.id' -%></th>
+    <th><%= t_m 'GroundPicture.caption' -%></th>
     <th><%= t_m 'GroundPicture.picture_id' -%></th>
     <th><%=   -%></th>
+    <th><%= t_m 'GroundPicture.panel_id' -%></th>
     <th><%= t_m 'GroundPicture.z' -%></th>
     <th><%= t_m 'GroundPicture.repeat' -%></th>
     <th><%= t_m 'GroundPicture.x' -%></th>
     <th><%= t_m 'GroundPicture.y' -%></th>
-    <th><%= t_m 'GroundPicture.created_at' -%></th>
     <th><%= t_m 'GroundPicture.updated_at' -%></th>
   </tr>
 
   <% @ground_pictures.each do |gp| %>
-    <%= render 'list_item', :ground_picture => gp %>
+    <%= render 'ground_pictures/list_item', :ground_picture => gp %>
   <% end -%>
 </table>
 <%= paginate(@paginate) %>
index 3316aa8..41b4048 100644 (file)
@@ -18,7 +18,7 @@
       
       </div>
     <% when 'GroundPicture' %>
-      <div id="ground-picture<%= elm.id -%>" class="pettanr-comic-ground-picture" style="width:<%= panel.width -%>px; height:<%= panel.height -%>px; z-index:<%= elm.z -%>; background-image: url(<%= full_url elm.picture.url -%>); background-repeat: <%= MagicNumber['ground_picture_repeat_items'][elm.repeat] -%>; background-position: <%= elm.x -%>px, <%= elm.y -%>px;">
+      <div id="ground-picture<%= elm.id -%>" class="pettanr-comic-ground-picture" style="width:<%= panel.width -%>px; height:<%= panel.height -%>px; z-index:<%= elm.z -%>; background-image: url(<%= full_url elm.picture.url -%>); background-repeat: <%= elm.repeat_text -%>; background-position: <%= elm.x -%>px, <%= elm.y -%>px;">
         
       </div>
     <% end %>
index 09fd3b8..a73039e 100644 (file)
@@ -2,7 +2,7 @@
   <% panel.panel_elements.each do |elm| %>
     <% case elm.class.to_s %>
     <% when 'PanelPicture' %>
-      <%= link_to_unless(elm.link.blank?, tag(:img, elm.opt_img_tag), elm.link) %>
+      <%= link_to_unless(elm.link.blank?, tag(:img, elm.opt_img_tag(elm == spot ? nil : 20)), elm.link) %>
     <% when 'SpeechBalloon' %>
       <% balloon = elm.balloons.first %>
       <div id="vballoon<%= elm.id -%>" class="pettanr-comic-balloon" style="width:<%= balloon.width -%>px; height:<%= balloon.height -%>px; top:<%= balloon.y -%>px; left:<%= balloon.x -%>px; z-index:<%= elm.z -%>; ">
           </p>
         <% end %>
       </div>
+    <% when 'GroundPicture' %>
+      <div id="ground-picture<%= elm.id -%>" class="pettanr-comic-ground-picture" style="<%= elm.opt_div_style(full_url(elm.picture.url)) -%>">
+        
+      </div>
     <% when 'GroundColor' %>
       <div id="ground-color<%= elm.id -%>" class="pettanr-comic-ground-color" style="width:<%= panel.width -%>px; height:<%= panel.height -%>px; z-index:<%= elm.z -%>; background-color:#<%= format("%06x", elm.code) -%>;">
       
       </div>
-    <% when 'GroundPicture' %>
-      <div id="ground-picture<%= elm.id -%>" class="pettanr-comic-ground-picture" style="width:<%= panel.width -%>px; height:<%= panel.height -%>px; z-index:<%= elm.z -%>; background-image: url(<%= full_url elm.picture.url -%>); background-repeat: <%= MagicNumber['ground_picture_repeat_items'][elm.repeat] -%>; background-position: <%= elm.x -%>px, <%= elm.y -%>px;">
-        
-      </div>
     <% end %>
   <% end %>
 </div>
index a67b70a..d8e557a 100644 (file)
@@ -1,6 +1,6 @@
 <b><%= t_m 'Panel.caption' -%>:</b>
 <%= h(panel.caption) %>
-<%= render 'panels/body', :panel => panel, :author => author %>
+<%= render 'panels/body', :panel => panel, :author => author, :spot => nil %>
 <%= render 'panels/footer', :panel => panel, :author => author %>
 <%= render 'panels/licensed_pictures', :licensed_pictures => panel.licensed_pictures %>
 
index 3f76baa..6e6332a 100644 (file)
@@ -50,4 +50,7 @@
   <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}) %>
   </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}) %>
+  </p>
 <% end -%>
index e765971..beec6f3 100644 (file)
@@ -308,10 +308,10 @@ ja:
         public: 公開
     ground_pictures:
       repeat:
-        all: 全体
-        x: 横方向
-        y: 縦方向
-        no: なし
+        repeat: 全体
+        repeat-x: 横方向
+        repeat-y: 縦方向
+        no-repeat: なし
     provider_status:
       status:
         waiting: 待機中
@@ -545,10 +545,22 @@ ja:
       title: 絵地一覧
     show:
       title: 絵地詳細
+    new:
+      title: 絵地作成
+    edit:
+      title: 絵地編集
+    create:
+      title: 絵地作成
+    update:
+      title: 絵地編集
+    destroy:
+      title: 絵地削除
     list:
       title: 絵地 生一覧
     browse:
       title: 絵地 生単票
+    create_ground_picture: 追加する絵地
+    update_ground_picture: 変更する絵地
   ground_colors:
     index:
       title: 色地一覧
index cdee7f7..cfb7b52 100644 (file)
@@ -8,6 +8,6 @@
   
   comic_visible_items: [['select_items.comic.visible.private', 0], ['select_items.comic.visible.public', 1]]
   panel_visible_items: [['select_items.panel.visible.private', 0], ['select_items.panel.visible.public', 1]]
-  ground_picture_repeat_items: ['repeat', 'repeat-x', 'repeat-y', 'no-repeat']
+  ground_picture_repeat_items: [['select_items.ground_pictures.repeat.repeat', 0], ['select_items.ground_pictures.repeat.repeat-x', 1], ['select_items.ground_pictures.repeat.repeat-y', 2], ['select_items.ground_pictures.repeat.no-repeat', 3]]
 
   provider_sources: ['http://sourceforge.jp/projects/pettanr/wiki/ProviderSource/attach/provider_source.json']
index 38fe01c..3c949d9 100644 (file)
@@ -170,11 +170,17 @@ Pettanr::Application.routes.draw do
     end
   end
   resources :ground_pictures do
+    new do
+      get :new
+    end
     collection do
       get :index
       get :show
     end
     member do
+      get :edit
+      put :update
+      delete :destroy
       get :browse
     end
   end