<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/views/thumbnail/new.html.erb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -38,11 +38,11 @@ class Thumbnail &lt; Application
     @video.thumbnail_position = params[:percentage]
     @video.save
     
-    @video.successfull_encodings.each do | video |
+    @video.successful_encodings.each do | video |
       video.upload_thumbnail_to_s3
     end
     
-    redirect &quot;/videos/#{@video.key}&quot;
+    redirect url(:video, @video.key)
   end
   
   private</diff>
      <filename>app/controllers/thumbnail.rb</filename>
    </modified>
    <modified>
      <diff>@@ -112,11 +112,13 @@ class Videos &lt; Application
     else
       case content_type
       when :html  
+        url = Panda::Config[:choose_thumbnail] ? &quot;/videos/#{@video.key}/thumbnail/new?iframe=true&quot; : @video.upload_redirect_url
+        
         # Special internal Panda case: textarea hack to get around the fact that the form is submitted with a hidden iframe and thus the response is rendered in the iframe
         if params[:iframe] == &quot;true&quot;
-          &quot;&lt;textarea&gt;&quot; + {:location =&gt; @video.redirect_after_upload}.to_json + &quot;&lt;/textarea&gt;&quot;
+          &quot;&lt;textarea&gt;&quot; + {:location =&gt; url}.to_json + &quot;&lt;/textarea&gt;&quot;
         else
-          redirect @video.redirect_after_upload
+          redirect url
         end
       end
     end</diff>
      <filename>app/controllers/videos.rb</filename>
    </modified>
    <modified>
      <diff>@@ -79,6 +79,7 @@ class Video &lt; SimpleDB::Base
   
   # Delete an original video and all it's encodings.
   def obliterate!
+    # TODO: should this raise an exception if the file does not exist?
     self.delete_from_s3
     self.encodings.each do |e|
       e.delete_from_s3
@@ -97,10 +98,6 @@ class Video &lt; SimpleDB::Base
     self.status == 'empty'
   end
   
-  def redirect_after_upload
-    Panda::Config[:choose_thumbnail] ? &quot;/videos/#{self.key}/thumbnail/new?iframe=true&quot; : self.upload_redirect_url
-  end
-  
   def upload_redirect_url
     Panda::Config[:upload_redirect_url].gsub(/\$id/,self.key)
   end</diff>
      <filename>app/models/video.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,6 @@
 
 &lt;ul id=&quot;screenshots&quot;&gt;
   &lt;% @percentages.each do | percentage |%&gt;
-    &lt;li&gt;&lt;%= link_to image_tag(@video.thumbnail_tmp_url(percentage)), &quot;/videos/#{@video.key}/save_thumbnail?percentage=#{percentage}&amp;iframe=#{params[:iframe]}&quot; %&gt;&lt;/li&gt;
+    &lt;li&gt;&lt;%= link_to image_tag(@video.thumbnail_tmp_url(percentage)), &quot;/videos/#{@video.key}/thumbnail/update?percentage=#{percentage}&amp;iframe=#{params[:iframe]}&quot; %&gt;&lt;/li&gt;
   &lt;% end %&gt;
 &lt;/ul&gt;
\ No newline at end of file</diff>
      <filename>app/views/thumbnail/edit.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 &lt;ul class=&quot;actions&quot;&gt;
   &lt;li&gt;&lt;%= link_to &quot;Add to queue&quot;, &quot;/videos/#{@video.key}/add_to_queue&quot; %&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;%= link_to &quot;Change thumbnail&quot;, &quot;/videos/#{@video.key}/choose_thumbnail&quot; %&gt;&lt;/li&gt;
+  &lt;li&gt;&lt;%= link_to &quot;Change thumbnail&quot;, &quot;/videos/#{@video.key}/thumbnail/edit&quot; %&gt;&lt;/li&gt;
   &lt;li&gt;
     &lt;%= form_for(@video, :action =&gt; url(:video, :id =&gt; @video.key), :method =&gt; :delete) do %&gt;
       &lt;%= submit &quot;Delete video&quot;, :onclick =&gt; &quot;var agree=confirm('This will delete the original video file and all its encodings');if (agree) {return true} else {return false}&quot; %&gt;</diff>
      <filename>app/views/videos/show_parent.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -23,6 +23,9 @@ Merb.logger.info(&quot;Compiling routes...&quot;)
 Merb::Router.prepare do |r|
   r.resources :videos, :member =&gt; {:form =&gt; :get, :upload =&gt; :post, :done =&gt; :get, :state =&gt; :get, :add_to_queue =&gt; :get }, :collection =&gt; {:exp =&gt; :get} do |video|
     video.resource :thumbnail
+    # Using get requests right now for create and update
+    video.match('/thumbnail/create').to(:controller =&gt; &quot;thumbnail&quot;, :action =&gt; &quot;create&quot;)
+    video.match('/thumbnail/update').to(:controller =&gt; &quot;thumbnail&quot;, :action =&gt; &quot;update&quot;)
   end
   
   r.match(&quot;/signup&quot;).to(:controller =&gt; &quot;accounts&quot;, :action =&gt; &quot;new&quot;)</diff>
      <filename>config/router.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,103 +1,103 @@
-// jQuery.nginxUploadProgress = function(settings) {
-//  settings = jQuery.extend({
-//    interval: 2000,
-//    progress_bar_id: &quot;progressbar&quot;,
-//    nginx_progress_url: &quot;/progress&quot;
-//  }, settings);
-//  
-//  var options = { 
-//       beforeSubmit: function(formData, jqForm, options) {
-//        $('#uploader').hide();
-//        $('#uploading').show();
-//        this.timer = setInterval(function() { jQuery.nginxUploadProgressFetch(this, settings['nginx_progress_url'], settings['progress_bar_id'], settings['uuid']) }, settings['interval']);
-//        return true; 
-//      },
-//       complete: function(xhr, statusText)  {
-//        data = $.httpData(xhr, &quot;json&quot;);
-//        if (data.location) { // # TODO check http status!
-//            location.href = data.location;
-//        } else {
-//            $('#uploading').hide();
-//            if (data.error == &quot;NotValid&quot;) {
-//                $('#error').html(&quot;This video upload was not valid. Please try beginning the upload process again.&quot;);
-//            } else if (data.error == &quot;FormatNotRecognised&quot;) {
-//                $('#uploader').show();
-//                $('#error').html('The video format was not recognised. Please ensure that your video follows the &lt;a href=&quot;http://pandastream.com/docs/upload_format_guidelines&quot; target=&quot;_blank&quot;&gt;upload format guidelines&lt;/a&gt;.');
-//            } else {
-//                $('#uploader').show();
-//                $('#error').html('Unfortunately there was an error uploading your video. We have been notified of this issue. Please try uploading your video again shortly.');
-//            }
-//        }
-//      },
-//       dataType: 'json'        // 'xml', 'script', or 'json' (expected server response type) 
-//   }; 
-//  
-//   // bind form using 'ajaxForm' 
-//   $('#upload').ajaxForm(options);
-// };
-// 
-// jQuery.nginxUploadProgress.inum = 0;
-// 
-// jQuery.nginxUploadProgressFetch = function(e, nginx_progress_url, progress_bar_id, uuid) {
-//  // window.console.log(&quot;fetcing progress for &quot;+uuid)
-//  jQuery.nginxUploadProgress.inum++;
-// 
-//  $.ajax({
-//    type: &quot;GET&quot;,
-//    url: nginx_progress_url,
-//    dataType: &quot;json&quot;,
-//    beforeSend: function(xhr) {
-//      xhr.setRequestHeader(&quot;X-Progress-ID&quot;, uuid);
-//      // window.console.log(&quot;setting headers: &quot;+uuid)
-//    },
-//    complete: function(xhr, statusText) {
-//      // window.console.log(&quot;complete!: &quot;+statusText);
-//    },
-//    success: function(upload) {
-//      /* change the width if the inner progress-bar */
-//      if (upload.state == 'uploading') {
-//        bar = $('#'+progress_bar_id);
-//        w = Math.floor((upload.received / upload.size)*100);
-//        bar.width(w + '%');
-// 
-//        // Panda specific
-//        bar.show();
-// 
-//        // Update ETA
-//        eta_seconds = ((upload.size / upload.received) * jQuery.nginxUploadProgress.inum) - jQuery.nginxUploadProgress.inum;
-// 
-//        if (eta_seconds &lt; 60) {
-//          eta_str = &quot;under a minute&quot;
-//        } else if (eta_seconds &lt; (60*5)) {
-//          eta_str = &quot;a few minutes&quot;
-//        } else if (eta_seconds &lt; (60*15)) {
-//          eta_str = &quot;fifteen minutes&quot;
-//        } else if (eta_seconds &lt; (60*30)) {
-//          eta_str = &quot;about half an hour&quot;
-//        } else if (eta_seconds &lt; (60*45)) {
-//          eta_str = &quot;around 45 minutes&quot;
-//        } else if (eta_seconds &lt; (60*60)) {
-//          eta_str = &quot;less than an hour&quot;
-//        } else if (eta_seconds &gt; (60*60)) {
-//          eta_str = &quot;over an hour&quot;;
-//        } else if (eta_seconds &gt; (60*60*2)) {
-//          eta_str = &quot;a few hours&quot;;
-//        } else if (eta_seconds &gt; (60*60*3)) {
-//          eta_str = &quot;several hours&quot;;
-//        } else if (eta_seconds &gt; (60*60*6)) {
-//          eta_str = &quot;quite a long time... at least 6 hours&quot;;
-//        }
-// 
-//        $(&quot;#eta&quot;).html(eta_str);
-//      } else if (upload.state == 'error') { 
-//        $('#uploading').hide();
-//        if (upload.status == 413) {
-//          $('#error').html(&quot;Sorry, that video file is too large. Could you resave it as a smaller one (under 60MB) please?&quot;);
-//        } else {
-//          $('#error').html('Unfortunately there was an error uploading your video. We have been notified of this issue. Please try uploading your video again shortly.');
-//        }
-//      }
-//    }
-//  });
-// };
-// 
+jQuery.nginxUploadProgress = function(settings) {
+ settings = jQuery.extend({
+   interval: 2000,
+   progress_bar_id: &quot;progressbar&quot;,
+   nginx_progress_url: &quot;/progress&quot;
+ }, settings);
+ 
+ var options = { 
+      beforeSubmit: function(formData, jqForm, options) {
+       $('#uploader').hide();
+       $('#uploading').show();
+       this.timer = setInterval(function() { jQuery.nginxUploadProgressFetch(this, settings['nginx_progress_url'], settings['progress_bar_id'], settings['uuid']) }, settings['interval']);
+       return true; 
+     },
+      complete: function(xhr, statusText)  {
+       data = $.httpData(xhr, &quot;json&quot;);
+       if (data.location) { // # TODO check http status!
+           location.href = data.location;
+       } else {
+           $('#uploading').hide();
+           if (data.error == &quot;NotValid&quot;) {
+               $('#error').html(&quot;This video upload was not valid. Please try beginning the upload process again.&quot;);
+           } else if (data.error == &quot;FormatNotRecognised&quot;) {
+               $('#uploader').show();
+               $('#error').html('The video format was not recognised. Please ensure that your video follows the &lt;a href=&quot;http://pandastream.com/docs/upload_format_guidelines&quot; target=&quot;_blank&quot;&gt;upload format guidelines&lt;/a&gt;.');
+           } else {
+               $('#uploader').show();
+               $('#error').html('Unfortunately there was an error uploading your video. We have been notified of this issue. Please try uploading your video again shortly.');
+           }
+       }
+     },
+      dataType: 'json'        // 'xml', 'script', or 'json' (expected server response type) 
+  }; 
+ 
+  // bind form using 'ajaxForm' 
+  $('#upload').ajaxForm(options);
+};
+
+jQuery.nginxUploadProgress.inum = 0;
+
+jQuery.nginxUploadProgressFetch = function(e, nginx_progress_url, progress_bar_id, uuid) {
+ // window.console.log(&quot;fetcing progress for &quot;+uuid)
+ jQuery.nginxUploadProgress.inum++;
+
+ $.ajax({
+   type: &quot;GET&quot;,
+   url: nginx_progress_url,
+   dataType: &quot;json&quot;,
+   beforeSend: function(xhr) {
+     xhr.setRequestHeader(&quot;X-Progress-ID&quot;, uuid);
+     // window.console.log(&quot;setting headers: &quot;+uuid)
+   },
+   complete: function(xhr, statusText) {
+     // window.console.log(&quot;complete!: &quot;+statusText);
+   },
+   success: function(upload) {
+     /* change the width if the inner progress-bar */
+     if (upload.state == 'uploading') {
+       bar = $('#'+progress_bar_id);
+       w = Math.floor((upload.received / upload.size)*100);
+       bar.width(w + '%');
+
+       // Panda specific
+       bar.show();
+
+       // Update ETA
+       eta_seconds = ((upload.size / upload.received) * jQuery.nginxUploadProgress.inum) - jQuery.nginxUploadProgress.inum;
+
+       if (eta_seconds &lt; 60) {
+         eta_str = &quot;under a minute&quot;
+       } else if (eta_seconds &lt; (60*5)) {
+         eta_str = &quot;a few minutes&quot;
+       } else if (eta_seconds &lt; (60*15)) {
+         eta_str = &quot;fifteen minutes&quot;
+       } else if (eta_seconds &lt; (60*30)) {
+         eta_str = &quot;about half an hour&quot;
+       } else if (eta_seconds &lt; (60*45)) {
+         eta_str = &quot;around 45 minutes&quot;
+       } else if (eta_seconds &lt; (60*60)) {
+         eta_str = &quot;less than an hour&quot;
+       } else if (eta_seconds &gt; (60*60)) {
+         eta_str = &quot;over an hour&quot;;
+       } else if (eta_seconds &gt; (60*60*2)) {
+         eta_str = &quot;a few hours&quot;;
+       } else if (eta_seconds &gt; (60*60*3)) {
+         eta_str = &quot;several hours&quot;;
+       } else if (eta_seconds &gt; (60*60*6)) {
+         eta_str = &quot;quite a long time... at least 6 hours&quot;;
+       }
+
+       $(&quot;#eta&quot;).html(eta_str);
+     } else if (upload.state == 'error') { 
+       $('#uploading').hide();
+       if (upload.status == 413) {
+         $('#error').html(&quot;Sorry, that video file is too large. Could you resave it as a smaller one (under 60MB) please?&quot;);
+       } else {
+         $('#error').html('Unfortunately there was an error uploading your video. We have been notified of this issue. Please try uploading your video again shortly.');
+       }
+     }
+   }
+ });
+};
+</diff>
      <filename>public/javascripts/jquery.nginxUploadProgress.js</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>spec/helpers/thumbnails_helper_spec.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>048133ba1c608206f09611e2c13d3e58657aefb3</id>
    </parent>
  </parents>
  <author>
    <name>Martyn Loughran</name>
    <email>martyn@new-bamboo.co.uk</email>
  </author>
  <url>http://github.com/reddavis/panda/commit/16a479bbe68566517a308736754ab8865f23156e</url>
  <id>16a479bbe68566517a308736754ab8865f23156e</id>
  <committed-date>2008-10-06T06:29:40-07:00</committed-date>
  <authored-date>2008-10-06T06:29:40-07:00</authored-date>
  <message>Finished refactoring the thumbnail code out of video controller and got the UI working correctly.</message>
  <tree>d91fa8ad2f7aea6b0d329fa09f902f34542e7390</tree>
  <committer>
    <name>Martyn Loughran</name>
    <email>martyn@new-bamboo.co.uk</email>
  </committer>
</commit>
