readme. trying to get multiple objects in form
This commit is contained in:
parent
69936b9622
commit
b42910636b
4
README
4
README
|
@ -9,13 +9,13 @@ Made by Espen Antonsen
|
||||||
* Read and writes EXIF
|
* Read and writes EXIF
|
||||||
* Organize in albums (events in iPhoto)
|
* Organize in albums (events in iPhoto)
|
||||||
* Combine albums in collections (albums in iPhoto)
|
* Combine albums in collections (albums in iPhoto)
|
||||||
* Upload multiple photos (using uploadify)
|
* Upload multiple photos
|
||||||
* Tag photos. Can also tag albums (actually all photos in album is tagged)
|
* Tag photos. Can also tag albums (actually all photos in album is tagged)
|
||||||
* User management with roles and permissions.
|
* User management with roles and permissions.
|
||||||
|
|
||||||
== Requirements
|
== Requirements
|
||||||
|
|
||||||
Tested with Ruby 1.8.6 and Rails 2.3
|
Rails 2.3
|
||||||
|
|
||||||
Software
|
Software
|
||||||
- FreeImage (required for Image_Science)
|
- FreeImage (required for Image_Science)
|
||||||
|
|
|
@ -98,9 +98,10 @@ class PhotosController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_multiple
|
def update_multiple
|
||||||
@photos = Photo.find(params[:photo_ids])
|
@photos = params[:photos][:photo]
|
||||||
@photos.each do |photo|
|
@photos.each do |photo_id|
|
||||||
photo.update_attributes!(params[:photo].reject { |k,v| v.blank? })
|
photo = Photo.find( photo_id )
|
||||||
|
photo.update_attributes!(params[:photos][:photo][photo_id].reject { |k,v| v.blank? })
|
||||||
end
|
end
|
||||||
flash[:notice] = "Updated photos!"
|
flash[:notice] = "Updated photos!"
|
||||||
redirect_to photos_path
|
redirect_to photos_path
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
<ul><%= render :partial => @photos %></ul>
|
<% form_for :photos, :url => update_multiple_photos_path, :html => { :method => :put } do |f| %>
|
||||||
|
<% for photo in @photos %>
|
||||||
|
<p>
|
||||||
|
<% f.fields_for photo do |p|%>
|
||||||
|
<%= p.text_field :title, :index => photo.id %>
|
||||||
|
<%= p.text_field :tags, :index => photo.id, :value => photo.tag_list %>
|
||||||
|
<% end%>
|
||||||
|
</p>
|
||||||
|
<% end%>
|
||||||
|
<p><%= f.submit "Submit" %></p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<br /><%= link_to "Back to #{@album.title}", @album %>
|
<br /><%= link_to "Back to #{@album.title}", @album %>
|
|
@ -34,4 +34,5 @@ $(document).ready(function() {
|
||||||
<div id="thumbs"></div>
|
<div id="thumbs"></div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<br /><%= link_to "Edit uploaded photos", untouched_album_photos_path( @album ) %>
|
||||||
<br /><%= link_to "Back to #{@album.title}", @album %>
|
<br /><%= link_to "Back to #{@album.title}", @album %>
|
|
@ -7,10 +7,10 @@ ActionController::Routing::Routes.draw do |map|
|
||||||
map.resources :photos,
|
map.resources :photos,
|
||||||
:collection => { :untouched => :get, :edit_multiple => :post, :update_multiple => :put, :upload => :get }
|
:collection => { :untouched => :get, :edit_multiple => :post, :update_multiple => :put, :upload => :get }
|
||||||
map.resources :albums, :collection => { :untouched => :get} do |album|
|
map.resources :albums, :collection => { :untouched => :get} do |album|
|
||||||
album.resources :photos, :collection => { :untouched => :get, :upload => :get, :edit_multiple => :get }
|
album.resources :photos, :collection => { :untouched => :get, :upload => :get, :edit_multiple => :get }, :shallow => true
|
||||||
end
|
end
|
||||||
map.resources :collections
|
map.resources :collections
|
||||||
map.resources :tags, :has_many => [ :photos, :albums ]
|
map.resources :tags, :has_many => [ :photos, :albums ], :shallow => true
|
||||||
|
|
||||||
map.resources :users, :controller => "admin/users"
|
map.resources :users, :controller => "admin/users"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue