Commit 907410fd
Changed files (8)
app
controllers
views
admin
photos
shared
creations
photos
config
app/controllers/admin/photos_controller.rb
@@ -0,0 +1,11 @@
+module Admin
+ class PhotosController < AdminController
+ def index
+ @photos = Photo.all
+ end
+
+ def show
+ @photo = Photo.find(params[:id])
+ end
+ end
+end
app/controllers/photos_controller.rb
@@ -11,6 +11,11 @@ class PhotosController < ApplicationController
end
end
+ def show
+ @creation = Creation.find(params[:creation_id])
+ @photo = @creation.photos.find(params[:id])
+ end
+
def new
@photo = Photo.new
end
app/views/admin/photos/index.html.erb
@@ -0,0 +1,30 @@
+<div class="row-fluid">
+ <div class="span12">
+ <%= render :partial => 'admin/shared/admin_nav' %>
+ <h1>Photos <small><%= @photos.count %></small></h1>
+ <table class="table table-condensed">
+ <thead>
+ <tr>
+ <th>id</th>
+ <th>cake</th>
+ <th>created at</th>
+ <th>updated at</th>
+ <th>tmp</th>
+ <th>processing</th>
+ </tr>
+ </thead>
+ <tbody>
+ <% @photos.each do |photo| %>
+ <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>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+ </div>
+</div>
app/views/admin/photos/show.html.erb
@@ -0,0 +1,31 @@
+<div class="row-fluid">
+ <div class="span12">
+ <h1>Photo <small><%= @photo.id %></small></h1>
+ <p><%= link_to "<< Back", admin_photos_path %></p>
+ <table class="table table-condensed">
+ <thead>
+ <tr>
+ <th>id</th>
+ <th>cake</th>
+ <th>created at</th>
+ <th>updated at</th>
+ <th>tmp</th>
+ <th>processing</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>
+ </tr>
+ </tbody>
+ </table>
+
+ <h2><%= @photo.image.url %></h2>
+ <%= image_tag @photo.image.url %>
+ </div>
+</div>
app/views/creations/show.html.erb
@@ -31,7 +31,9 @@
<div class="row">
<div class="span6">
- <img class="thumbnail" src="<%= @creation.primary_image.image.large.url %>" alt="<%= @creation.name %>" />
+ <%= link_to creation_photo_path(@creation, @creation.primary_image) do %>
+ <img class="thumbnail" src="<%= @creation.primary_image.image.large.url %>" alt="<%= @creation.name %>" />
+ <% end %>
</div>
<div class="span6">
<h1><%= link_to @creation.name, creation_path(@creation) %></h1>
@@ -79,7 +81,7 @@
<ul class="thumbnails">
<% @creation.photos.each do |photo| %>
<li class="span2">
- <%= link_to creation_photos_path(@creation) do %>
+ <%= link_to creation_photo_path(@creation, photo) do %>
<%= image_tag(photo.image.thumb.url, :class => "thumbnail") %>
<% end %>
</li>
app/views/photos/show.html.erb
@@ -0,0 +1,7 @@
+<div class="row">
+ <div class="span12">
+ <%= link_to creation_photo_path(@creation, @photo) do %>
+ <%= image_tag(@photo.image.url, :class => "thumbnail") %>
+ <% end %>
+ </div>
+</div>
config/routes.rb
@@ -15,7 +15,7 @@ Cake::Application.routes.draw do
# /creations
resources :creations do
- resources :photos, :only => [:index, :new, :create, :destroy]
+ resources :photos, :only => [:index, :show, :new, :create, :destroy]
resources :favorites, :only => [:index, :create]
get 'page/:page', :action => :index, :on => :collection
get 'mine', :action => :mine, :on => :collection
@@ -66,5 +66,6 @@ Cake::Application.routes.draw do
resources :jobs, only: [:index, :show]
resources :activities, only: [:index]
resources :subscriptions, only: [:index]
+ resources :photos, only: [:index, :show]
end
end