<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -46,12 +46,15 @@ class AlbumPicturesController &lt; ApplicationController
     @album_picture = @album.pictures.find(params[:id])
     @new_picture = !params[:is_new].nil?
     
-    unless @new_picture
+    if !@new_picture
       el_id = @album.pictures.find(:first, 
                                    :conditions =&gt; ['position &lt; ?', @album_picture.position], 
                                    :select =&gt; 'id', 
                                    :order =&gt; 'position DESC')
       @insert_element = &quot;album_picture_#{el_id}&quot; unless el_id.nil?
+    
+    elsif params[:el_id]
+      @insert_element = params[:el_id]
     end
     
     @insert_element ||= 'album_picture_form'</diff>
      <filename>app/controllers/album_pictures_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,7 +9,7 @@
   %ul.albumPictures{:id =&gt; &quot;sortable_album_#{object.id}&quot;}
     = render :partial =&gt; 'album_pictures/show', :collection =&gt; object.pictures
     - if object.can_be_edited_by(@logged_user)
-      %li.albumPictureForm{:id =&gt; 'album_picture_form'}
+      %li.albumPictureForm{:id =&gt; &quot;album_picture_form_#{object.id}&quot;}
         .inner{:style =&gt; (@new_album.nil? ? 'display:none' : nil)}
           = render :partial =&gt; 'album_pictures/form', :locals =&gt; {:object =&gt; object}
         .newPicture{:style =&gt; (@new_album.nil? ? nil : 'display:none')}</diff>
      <filename>app/views/albums/_show.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -645,7 +645,7 @@ var Page = {
       
     onNewAlbumPictureSubmit: function(evt) {
       var el = $(this);
-      el.requestIframeScript({'is_new': 1}, JustRebind);
+      el.requestIframeScript({'is_new': 1, 'el_id': $(this).parents(&quot;.albumPictureForm:first&quot;).attr(&quot;id&quot;)}, JustRebind);
       return true;
     },
       </diff>
      <filename>public/javascripts/application.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1c57509a8a6a0847963dee8a389dedf02545ff11</id>
    </parent>
  </parents>
  <author>
    <name>keith</name>
    <email>keith@firebellydesign.com</email>
  </author>
  <url>http://github.com/jamesu/rucksack/commit/5848e28ed860660a87f1fc2925c7e76ddd6debb2</url>
  <id>5848e28ed860660a87f1fc2925c7e76ddd6debb2</id>
  <committed-date>2009-08-03T12:22:24-07:00</committed-date>
  <authored-date>2009-08-03T08:33:33-07:00</authored-date>
  <message>The id of the photo upload form was hard coded to album_picture_form so if there were multiple albums on a page, when the rjs dynamically inserted the uploaded photo content 'before' the album_picture_form, it would always insert the photo into the first album on the page. This is fixed now so that photos get inserted into the correct album upon uploading

Signed-off-by: James Urquhart &lt;jamesu@gmail.com&gt;</message>
  <tree>2f78695e49ba6afa7f7f4fee145b746ef9eb96c3</tree>
  <committer>
    <name>James Urquhart</name>
    <email>jamesu@gmail.com</email>
  </committer>
</commit>
