OSDN Git Service

t#31470:create pager
[pettanr/pettanr.git] / app / views / original_pictures / index.html.erb
index 8e20075..9d809ad 100644 (file)
@@ -1,18 +1,55 @@
-<h1>Listing original_pictures</h1>
-
-<%= render 'uploader' %>
-<% @original_pictures.each do |original_picture| %>
-  <div>
-    <%= original_picture.filename %>
-    <img src="<%= original_picture.resource_picture.url('thumbnail') -%>">
-    <%= original_picture.width %>x<%= original_picture.height %>
-    <%= original_picture.filesize %>bytes
-    画:<%= h original_picture.artist.name %>
-    license:<%= h License.find(original_picture.license_id || 1).name %>
-  </div>
-<% end %>
-<%= link_to 'open form', new_original_picture_path, :remote => true %>
-  <div id="uploader">
-    uploader
-  </div>
+<h1><%= t '.title' -%></h1>
 
+<%= render 'form' %>
+<table>
+  <tr>
+    <th><%= t_m 'OriginalPicture' -%></th>
+    <th><%= t 'original_pictures.index.history' -%></th>
+    <th><%= t 'original_pictures.index.status' -%></th>
+    <th><%= t_m 'ResourcePicture' -%></th>
+    <th><%=  -%></th>
+    <th><%=  -%></th>
+  </tr>
+  <% @original_pictures.each do |original_picture| %>
+    <tr>
+      <td>
+        <%= link_to tag(:img, original_picture.tmb_opt_img_tag), original_picture %>
+      </td>
+      <td>
+        <% if original_picture.pictures.empty? %>
+          -
+        <% else %>
+          <%= link_to original_picture.history.first.revision, history_original_picture_path(original_picture) %>
+        <% end %>
+      </td>
+      <td>
+        <% case true %>
+        <% when  original_picture.unpublished? %>
+          <%= t('original_pictures.unpublished') %>
+        <% when  original_picture.unlicensed? %>
+          <%= t('original_pictures.unlicensed') %>
+        <% when  original_picture.stopped? %>
+          <%= t('original_pictures.stopped') %>
+        <% when  original_picture.published? %>
+          <%= t('original_pictures.published') %>
+        <% end %>
+      </td>
+      <td>
+        <% if original_picture.resource_picture %>
+          <%= link_to tag(:img, original_picture.resource_picture.tmb_opt_img_tag), original_picture.resource_picture %>
+        <% else %>
+        <% end %>
+      </td>
+      <td>
+        <% if original_picture.resource_picture %>
+          <%= link_to t('original_pictures.index.stop'), original_picture.resource_picture, confirm: 'Are you sure?', method: :delete %>
+        <% else %>
+        <% end %>
+      </td>
+      <td>
+        <%= link_to t('original_pictures.index.destroy'), original_picture, confirm: 'Are you sure?', method: :delete %>
+      </td>
+    </tr>
+  <% end %>
+</table>
+<%= paginate(@paginate) %>