<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -66,26 +66,19 @@ class PhotosController &lt; ApplicationController
   # Mark a photo as primary.
   # This marks the other photos as non-primary as a side-effect.
   def update
-    if @photo.nil? or @photo.primary?
-      redirect_to edit_person_url(current_person) and return
-    end
-    # This should only have one entry, but be paranoid.
-    @old_primary = current_person.photos.select(&amp;:primary?)
-  
+    @photo = Photo.find(params[:id])
     respond_to do |format|
-      if @photo.update_attributes(:primary =&gt; true)
-        @old_primary.each { |p| p.update_attributes!(:primary =&gt; false) }
-        format.html { redirect_to(edit_person_path(current_person)) }
-      else    
-        format.html do
-          flash[:error] = &quot;Invalid image!&quot;
-          redirect_to home_url
-        end
+      if @photo.update_attributes(params[:photo])
+        flash[:success] = &quot;Photo successfully updated&quot;
+        format.html { redirect_to(photo_path(@photo)) }
+      else
+        format.html { render :action =&gt; &quot;new&quot; }
       end
     end
   end
 
   def destroy
+    @gallery = @photo.gallery
     redirect_to person_galleries_path(current_person) and return if @photo.nil?
     @photo.destroy
     flash[:success] = &quot;Photo deleted&quot;
@@ -141,7 +134,7 @@ class PhotosController &lt; ApplicationController
     def correct_user_required
       @photo = Photo.find(params[:id])
       if @photo.nil?
-        redirect_to edit_person_url(current_person)
+        redirect_to home_url
       elsif @photo.person != current_person
         redirect_to home_url
       end</diff>
      <filename>app/controllers/photos_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,2 +1,5 @@
 &lt;%=link_to image_tag(photo.public_filename(:thumbnail)), photo_path(photo)%&gt;&lt;br/&gt;
-&lt;%=link_to image_tag(&quot;icons/close.gif&quot;), photo_path(photo), :method =&gt; :delete, :confirm =&gt; &quot;Do you really want to delete the photo?&quot;%&gt;
+&lt;% if current_person == photo.person %&gt;
+	&lt;%=link_to &quot;Edit&quot;, edit_photo_path(photo) %&gt; |
+	&lt;%=link_to image_tag(&quot;icons/close.gif&quot;), photo_path(photo), :method =&gt; :delete, :confirm =&gt; &quot;Do you really want to delete the photo?&quot;%&gt;
+&lt;% end %&gt;</diff>
      <filename>app/views/galleries/_photo.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,13 +1,27 @@
 &lt;%= error_messages_for :photo %&gt;
 
-&lt;% form_for @photo, :html =&gt; { :multipart =&gt; true } do |f| -%&gt;
-  &lt;div class=&quot;form_field&quot;&gt;
-    &lt;%= image_tag(@display_photo.public_filename(:thumbnail)) %&gt;&lt;br /&gt;
-    &lt;label for=&quot;photo&quot;&gt;Update your photo:&lt;/label&gt;&lt;br /&gt;
-    &lt;%= f.file_field :uploaded_data %&gt;
-  &lt;/div&gt;
-  &lt;div class=&quot;form_field&quot;&gt;
-    &lt;%= submit_tag 'Update' %&gt;
-    &lt;%= f.submit &quot;Cancel&quot;, :id =&gt; &quot;cancel&quot; %&gt;
-  &lt;/div&gt;
-&lt;% end -%&gt;
\ No newline at end of file
+
+&lt;%- column_div :type =&gt; :primary do -%&gt;
+&lt;h2&gt;Edit photo&lt;/h2&gt;
+
+	&lt;% form_for @photo, :html =&gt; { :multipart =&gt; true } do |f| -%&gt;
+	  &lt;div class=&quot;form_field&quot;&gt;
+	    &lt;%= image_tag(@display_photo.public_filename(:thumbnail)) %&gt;
+	  &lt;/div&gt;
+		
+		&lt;div class=&quot;form_field&quot;&gt;
+	    &lt;label for=&quot;photo&quot;&gt;Title:&lt;/label&gt;
+	    &lt;%= f.text_field :title %&gt;
+	  &lt;/div&gt;
+	  &lt;div class=&quot;form_field&quot;&gt;
+	    &lt;label for=&quot;photo&quot;&gt;Upload a photo:&lt;/label&gt;
+	    &lt;%= f.file_field :uploaded_data %&gt;
+	  &lt;/div&gt;
+	  &lt;div class=&quot;form_field&quot;&gt;
+	    &lt;%= submit_tag 'Update' %&gt;
+	    &lt;%= f.submit &quot;Cancel&quot;, :id =&gt; &quot;cancel&quot; %&gt;
+	  &lt;/div&gt;
+	&lt;% end -%&gt;
+	
+&lt;% end %&gt;
+	
\ No newline at end of file</diff>
      <filename>app/views/photos/edit.html.erb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>9487f18d0557d58fb37b6e729e929d701ef470b0</id>
    </parent>
  </parents>
  <author>
    <name>Piotr Jakubowski</name>
    <email>piotrj@piotr-jakubowskis-macbook.local</email>
  </author>
  <url>http://github.com/piotrj/insoshi/commit/33b28d9f6ee33754f94f880dcb5f59ddf6ed9d4e</url>
  <id>33b28d9f6ee33754f94f880dcb5f59ddf6ed9d4e</id>
  <committed-date>2008-06-19T21:31:54-07:00</committed-date>
  <authored-date>2008-06-15T18:20:42-07:00</authored-date>
  <message>Photo editing</message>
  <tree>6bc3066b9dfa1c73a80cec1317371397827a9d0c</tree>
  <committer>
    <name>Long Nguyen</name>
    <email>long@dr4gn.com</email>
  </committer>
</commit>
