Commit 67d53ef1

mo k <mo@mokhan.ca>
2012-10-21 02:19:11
start to build out the new photo upload page using jquery-fileupload gem.
1 parent ec0388c
Changed files (4)
app
assets
controllers
views
app/assets/javascripts/application.js
@@ -11,5 +11,6 @@
 //= require jquery.colorbox
 //= require jquery.validate
 //= require jquery.masonry
+//= require jquery-fileupload
 //= require bootstrap
 //= require_tree .
app/assets/stylesheets/application.css.scss
@@ -3,6 +3,7 @@
  * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
  * the top of the compiled file, but it's generally better to create a new file per style scope.
  *= require colorbox
+ *= require jquery.fileupload-ui
  *= require_self
  *= require_tree . 
 */
app/controllers/photos_controller.rb
@@ -10,7 +10,7 @@ class PhotosController < ApplicationController
 
   def create
     if @photo.save
-      redirect_to(@creation, :notice => 'A new photo was added to the album.') 
+      redirect_to new_creation_photo_url(@photo.creation, :notice => 'A new photo was added to the album.')
     else
       flash[:error] = "could not upload photo"
     end
app/views/photos/_form.html.erb
@@ -3,6 +3,18 @@
     $(function(){ });
   </script>
 <% end %>
+
+<div class="row">
+  <div class="span12">
+    <ul class="thumbnails">
+      <li class="span6"><a class="thumbnail gallery" href="<%= @primary_photo.image.large.url %>"><img src="<%= @primary_photo.image.large.url %>" alt="<%= @creation.name %>" /></a></li>
+      <% @creation.photos.each do |photo| %>
+      <li class="span3"><img src="<%= photo.image.thumb.url.to_s %>" alt="<%= @creation.name %>" class="thumbnail" /></li>
+      <% end %>
+    </ul>
+  </div>
+</div>
+
 <%= form_for([@creation, @photo], :html => {:multipart => true, :class => "form-horizontal"}) do |f| %>
   <fieldset>
     <div class="control-group">