OSDN Git Service

t#29316:up;add full credit
authoryasushiito <yas@pen-chan.jp>
Thu, 25 Oct 2012 08:49:18 +0000 (17:49 +0900)
committeryasushiito <yas@pen-chan.jp>
Thu, 25 Oct 2012 08:49:18 +0000 (17:49 +0900)
app/models/license.rb
app/models/picture.rb
app/models/resource_picture.rb
app/views/original_pictures/_history_list.html.erb
app/views/pictures/_head.html.erb
app/views/resource_pictures/show.html.erb

index 3a4a1b6..bd344c9 100644 (file)
@@ -69,4 +69,14 @@ class License < ActiveRecord::Base
     res
   end
   
     res
   end
   
+  def credit_pictures_attr
+    return @credit_pictures_attr if @credit_pictures_attr
+    begin
+      @credit_pictures_attr = JSON.parse(self.credit_pictures)
+    rescue 
+    end
+    @credit_pictures_attr = {} unless @credit_pictures_attr
+    @credit_pictures_attr
+  end
+  
 end
 end
index 4669b4b..3ca0c1f 100644 (file)
@@ -128,6 +128,10 @@ class Picture < ActiveRecord::Base
     "#{self.classname.tableize}/attributes/credit"
   end
   
     "#{self.classname.tableize}/attributes/credit"
   end
   
+  def full_credit_template
+    "#{self.classname.tableize}/attributes/full_credit"
+  end
+  
   def credit_data
     begin
       @credit_data = JSON.parse(self.credit) unless @credit_data
   def credit_data
     begin
       @credit_data = JSON.parse(self.credit) unless @credit_data
index 851216d..817b2cb 100644 (file)
@@ -201,6 +201,10 @@ class ResourcePicture < ActiveRecord::Base
     "#{self.classname.tableize}/attributes/credit"
   end
   
     "#{self.classname.tableize}/attributes/credit"
   end
   
+  def full_credit_template
+    "#{self.classname.tableize}/attributes/full_credit"
+  end
+  
   def credit_data
     begin
       @credit_data = JSON.parse(self.credit) unless @credit_data
   def credit_data
     begin
       @credit_data = JSON.parse(self.credit) unless @credit_data
index 603671a..6688272 100644 (file)
@@ -4,7 +4,7 @@
   <table class="no-border">
     <tr>
       <td>
   <table class="no-border">
     <tr>
       <td>
-        <%= tag(:img, picture.opt_img_tag) -%>
+        <%= link_to(tag(:img, picture.opt_img_tag), picture_path(picture.id)) -%>
       </td>
       <td>
         <%= render picture.credit_template, :picture => picture %>
       </td>
       <td>
         <%= render picture.credit_template, :picture => picture %>
index 6cb17a8..9952d43 100644 (file)
@@ -1,31 +1,14 @@
+<h2>revision:<%= picture.revision %></h2>
 <img src="<%= picture.url -%>">
 <img src="<%= picture.url -%>">
-<table>
-  <tr>
-    <th>credit</th>
-    <th>artist</th>
-    <th>properties</th>
-    <th>revision</th>
-  </tr>
-  <tr>
-    <td>
-      <%= render picture.credit_template, :picture => picture %>
-    </td>
-    <td>
-      <%= link_to(h(picture.artist.name), artist_path(picture.artist)) %>
-    </td>
-    <td>
-      <div>
-        <%= picture.ext %>
-      </div>
-      <div>
-        <%= picture.width %>x<%= picture.height %>px
-      </div>
-      <div>
-        <%= picture.filesize %>bytes
-      </div>
-    </td>
-    <td>
-      <%= picture.revision %>
-    </td>
-  </tr>
-</table>
+<h2>credit</h2>
+<%= render picture.full_credit_template, :picture => picture %>
+<h2>properties</h2>
+<div>
+  <%= picture.ext %>
+</div>
+<div>
+  <%= picture.width %>x<%= picture.height %>px
+</div>
+<div>
+  <%= picture.filesize %>bytes
+</div>
index 081e7f0..4d60081 100644 (file)
@@ -1,30 +1,16 @@
 <h1>Resource Picture #<%= @resource_picture.id %></h1>
 <p id="notice"><%= notice %></p>
 <img src="<%= @resource_picture.url 'full' -%>">
 <h1>Resource Picture #<%= @resource_picture.id %></h1>
 <p id="notice"><%= notice %></p>
 <img src="<%= @resource_picture.url 'full' -%>">
-<table>
-  <tr>
-    <th>credit</th>
-    <th>artist</th>
-    <th>properties</th>
-  </tr>
-  <tr>
-    <td>
-      <%= render @resource_picture.credit_template, :picture => @resource_picture %>
-    </td>
-    <td>
-      <%= link_to(h(@resource_picture.artist.name), artist_path(@resource_picture.artist)) %>
-    </td>
-    <td>
-      <div>
-        <%= @resource_picture.ext %>
-      </div>
-      <div>
-        <%= @resource_picture.width %>x<%= @resource_picture.height %>px
-      </div>
-      <div>
-        <%= @resource_picture.filesize %>bytes
-      </div>
-    </td>
-  </tr>
-</table>
+<h2>credit</h2>
+<%= render @resource_picture.full_credit_template, :picture => @resource_picture %>
+<h2>properties</h2>
+<div>
+  <%= @resource_picture.ext %>
+</div>
+<div>
+  <%= @resource_picture.width %>x<%= @resource_picture.height %>px
+</div>
+<div>
+  <%= @resource_picture.filesize %>bytes
+</div>
 <%= link_to 'Back', resource_pictures_path %>
 <%= link_to 'Back', resource_pictures_path %>