Commit 637fd74b
Changed files (3)
app
controllers
views
creations
photos
app/controllers/photos_controller.rb
@@ -1,8 +1,9 @@
class PhotosController < ApplicationController
before_filter :authenticate_user!
- before_filter :find_creation
+ before_filter :find_creation, :except => [:index]
def index
+ @creation = Creation.find(params[:creation_id])
@photos = @creation.photos
respond_to do |format|
format.html # index.html.erb
app/views/creations/show.html.erb
@@ -64,7 +64,7 @@ $(function() {
<% if @creation.photos_count > 1 %>
<div class="row">
<div class="span12">
- <%= link_to "view all photos »".html_safe, creation_photos_path(@creation), :class => "pull-right" %>
+ <%= link_to "view #{pluralize(@creation.photos_count-1, "other photo")} »".html_safe, creation_photos_path(@creation), :class => "pull-right" %>
<ul class="thumbnails">
<% @creation.photos.each do |photo| %>
<li class="span2"><%= image_tag photo.image.thumb.url, :class => "thumbnail" %></li>
app/views/photos/index.html.erb
@@ -0,0 +1,28 @@
+
+<div class="row">
+ <div class="span12">
+ <%= link_to "« Back to creation".html_safe, creation_path(@creation) %>
+ <div class="row">
+ <div class="span3"> </div>
+ <div class="span6">
+ <div id="myCarousel" class="carousel slide">
+ <ol class="carousel-indicators">
+ <% @photos.each_with_index do |photo, index| %>
+ <li data-target="#myCarousel" data-slide-to="<%= index %>" class="<%= index == 0 ? "active" : "" %>"></li>
+ <% end %>
+ </ol>
+ <!-- Carousel items -->
+ <div class="carousel-inner">
+ <% @photos.each_with_index do |photo,index| %>
+ <div class="item <%= index == 0 ? "active" : "" %>"><%= image_tag photo.image.url, :class => "thumbnail" %></div>
+ <% end %>
+ </div>
+ <!-- Carousel nav -->
+ <a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>
+ <a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
+ </div>
+ </div>
+ <div class="span3"> </div>
+ </div>
+ </div>
+</div>