Commit 53838b97

mo khan <mo@mokhan.ca>
2014-06-01 21:11:30
display lat and long in photos admin section.
1 parent 9de341f
Changed files (3)
app
app/controllers/admin/photos_controller.rb
@@ -1,11 +1,16 @@
 module Admin
   class PhotosController < AdminController
+    def initialize(photo_repository = Photo)
+      @photo_repository = photo_repository
+      super()
+    end
+
     def index
-      @photos = Photo.order(id: :desc)
+      @photos = @photo_repository.order(id: :desc)
     end
 
     def show
-      @photo = Photo.find(params[:id])
+      @photo = @photo_repository.find(params[:id])
     end
   end
 end
app/views/admin/photos/index.html.erb
@@ -8,8 +8,10 @@
           <th>id</th>
           <th>processing</th>
           <th>tmp</th>
-          <th>created at</th>
-          <th>updated at</th>
+          <th>latitude</th>
+          <th>longitude</th>
+          <th>created</th>
+          <th>updated</th>
         </tr>
       </thead>
       <tbody>
@@ -18,8 +20,10 @@
             <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><%= time_ago_in_words(photo.created_at) %></td>
-            <td><%= time_ago_in_words(photo.updated_at) %></td>
+            <td><%= photo.latitude %></td>
+            <td><%= photo.longitude %></td>
+            <td><%= time_ago_in_words(photo.created_at) %> ago</td>
+            <td><%= time_ago_in_words(photo.updated_at) %> ago</td>
           </tr>
         <% end %>
       </tbody>
app/views/admin/photos/show.html.erb
@@ -7,20 +7,24 @@
         <tr>
           <th>id</th>
           <th>cake</th>
-          <th>created at</th>
-          <th>updated at</th>
           <th>tmp</th>
           <th>processing</th>
+          <th>latitude</th>
+          <th>longitude</th>
+          <th>created at</th>
+          <th>updated at</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.created_at %></td>
-        <td><%= @photo.updated_at %></td>
         <td><%= @photo.image_tmp %></td>
         <td><%= @photo.image_processing %></td>
+        <td><%= @photo.latitude %></td>
+        <td><%= @photo.longitude %></td>
+        <td><%= @photo.created_at %></td>
+        <td><%= @photo.updated_at %></td>
       </tr>
       </tbody>
     </table>