Commit 4688a3ae

mo khan <mo@mokhan.ca>
2014-06-07 22:46:06
update links to images in views.
1 parent 4a1a0c6
app/views/admin/photos/index.html.erb
@@ -7,9 +7,10 @@
         <tr>
           <th>id</th>
           <th>processing</th>
-          <th>tmp</th>
-          <th>latitude</th>
-          <th>longitude</th>
+          <th>filename</th>
+          <th>original</th>
+          <th>content type</th>
+          <th>geolocation</th>
           <th>created</th>
           <th>updated</th>
         </tr>
@@ -19,9 +20,10 @@
           <tr>
             <td><%= link_to photo.id, admin_photo_path(photo.id) %></td>
             <td><%= photo.image_processing %></td>
-            <td><%= photo.image.root %>/<%= photo.image.cache_dir %>/<%= photo.image_tmp %></td>
-            <td><%= photo.latitude %></td>
-            <td><%= photo.longitude %></td>
+            <td><%= photo.image %></td>
+            <td><%= photo.original_filename %></td>
+            <td><%= photo.content_type %></td>
+            <td><%= photo.latitude %> <%= photo.longitude %></td>
             <td><%= time_ago_in_words(photo.created_at) %> ago</td>
             <td><%= time_ago_in_words(photo.updated_at) %> ago</td>
           </tr>
app/views/admin/photos/show.html.erb
@@ -6,34 +6,36 @@
       <thead>
         <tr>
           <th>id</th>
-          <th>cake</th>
-          <th>tmp</th>
           <th>processing</th>
-          <th>latitude</th>
-          <th>longitude</th>
-          <th>created at</th>
-          <th>updated at</th>
+          <th>filename</th>
+          <th>original</th>
+          <th>content type</th>
+          <th>geolocation</th>
+          <th>created</th>
+          <th>updated</th>
         </tr>
       </thead>
       <tbody>
       <tr>
         <td><%= link_to @photo.id, admin_photo_path(@photo.id) %></td>
-        <td><%= link_to @photo.creation.name, creation_path(@photo.creation) %></td>
-        <td><%= @photo.image_tmp %></td>
         <td><%= @photo.image_processing %></td>
-        <td><%= @photo.latitude %></td>
-        <td><%= @photo.longitude %></td>
+        <td><%= @photo.image %></td>
+        <td><%= @photo.original_filename %></td>
+        <td><%= @photo.content_type %></td>
+        <td><%= @photo.latitude %> <%= @photo.longitude %></td>
         <td><%= @photo.created_at %></td>
         <td><%= @photo.updated_at %></td>
       </tr>
       </tbody>
     </table>
 
-    <h2><%= @photo.image.root %><%= @photo.image.url %></h2>
-    <%= image_tag @photo.image.url %>
+    <h2><%= @photo.image %></h2>
+    <%= image_tag @photo.url_for(:original) %>
+    <%= image_tag @photo.url_for(:large) %>
+    <%= image_tag @photo.url_for(:thumb) %>
     <ul>
-    <% @results.each do |result| %>
-      <li><%= result.formatted_address %></li>
+      <% @results.each do |result| %>
+        <li><%= result.formatted_address %></li>
     <% end %>
     </ul>
   </div>
app/views/creations/index.html.erb
@@ -50,7 +50,7 @@
           <div class="span4">
             <div class="thumbnail">
               <%= link_to creation do %>
-                <%= image_tag creation.primary_image.image.large.url %>
+                <%= image_tag creation.primary_image.url_for(:large) %>
               <% end %>
               <div class="caption">
                 <h3><%= link_to creation.name, creation %> <em><small>by <%= link_to shrink(creation.user.name, 20), profile_path(creation.user) %></small></em></h3>
app/views/creations/show.html.erb
@@ -31,7 +31,7 @@
 
 <div class="row">
   <div class="span6">
-    <img class="thumbnail" src="<%= @creation.primary_image.image.large.url %>" alt="<%= @creation.name %>" />
+    <img class="thumbnail" src="<%= @creation.primary_image.url_for(:large) %>" alt="<%= @creation.name %>" />
   </div>
   <div class="span6">
     <h1><%= link_to @creation.name, creation_path(@creation) %></h1>
@@ -80,7 +80,7 @@
       <% @creation.photos.each do |photo| %>
         <li class="span2">
           <%= link_to creation_photo_path(@creation, photo) do %>
-            <%= image_tag(photo.image.thumb.url, :class => "thumbnail") %>
+            <%= image_tag(photo.url_for(:thumb), :class => "thumbnail") %>
           <% end %>
         </li>
       <% end %>
app/views/my/dashboard/_creation.html.erb
@@ -1,6 +1,6 @@
 <div class="media">
   <%= link_to item, class: 'pull-left' do %>
-    <img class="media-object" data-src="<%= item.primary_image.thumb_url %>" alt="64x64" style="width: 64px; height: 64px;" src="<%= item.primary_image.thumb_url %>">
+    <img class="media-object" data-src="<%= item.primary_image.url_for(:thumb) %>" alt="64x64" style="width: 64px; height: 64px;" src="<%= item.primary_image.url_for(:thumb) %>">
   <% end %>
   <div class="media-body">
     <h4 class="media-heading"><%= item.name %></h4>
app/views/photos/show.html.erb
@@ -2,7 +2,7 @@
   <div class="span12">
     <h1><%= link_to @creation.name, creation_path(@creation) %></h1>
     <%= link_to creation_photo_path(@creation, @photo) do %>
-      <%= image_tag(@photo.image.url, :class => "thumbnail") %>
+      <%= image_tag(@photo.url_for(:original), :class => "thumbnail") %>
     <% end %>
   </div>
 </div>
@@ -13,7 +13,7 @@
       <% @creation.photos.each do |photo| %>
         <li class="span2">
           <%= link_to creation_photo_path(@creation, photo) do %>
-            <%= image_tag(photo.image.thumb.url, class: "thumbnail") %>
+            <%= image_tag(photo.url_for(:thumb), class: "thumbnail") %>
           <% end %>
         </li>
     <% end %>
spec/features/add_to_favorites_spec.rb
@@ -6,7 +6,7 @@ describe "adding a cake to your favorites", :js => true do
 
   before :each do
     creation.photos.first.update_attribute(:image_processing, nil)
-    system "cp #{creation.photos.first.image.file.file} #{creation.photos.first.image.file.file.gsub(/example/, 'large_example')}"
+    #system "cp #{creation.photos.first.image.file.file} #{creation.photos.first.image.file.file.gsub(/example/, 'large_example')}"
     visit user_session_path
     within('.form-inline') do
       fill_in('user_email', :with => me.email)