From 81438678cde6567611f5459c97520c3d286a9270 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 26 Aug 2010 17:10:19 -0700 Subject: [PATCH] Refactored more photo js out to photos.js. That should be it for that refactor --- app/views/photos/_new_photo.haml | 30 ------------------------------ public/javascripts/photos.js | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/app/views/photos/_new_photo.haml b/app/views/photos/_new_photo.haml index 270fc7609..32fd2a3e8 100644 --- a/app/views/photos/_new_photo.haml +++ b/app/views/photos/_new_photo.haml @@ -1,33 +1,3 @@ -:javascript - $(function() { - $("#photo_image").html5_upload({ - // WE INSERT ALBUM_ID PARAM HERE - url: "/photos?album_id=#{@album.id}", - sendBoundary: window.FormData || $.browser.mozilla, - setName: function(text) { - $("#progress_report_name").text(text); - }, - onFinish: function(event, total){ - $("#add_photo_button").html( "Add Photos" ); - $("#add_photo_loader").fadeOut(400); - - $("#photo_title_status").text("Done!"); - $("#progress_report").html("Good job me!"); - - $("#add_photo_button").addClass("uploading_complete"); - }, - onStart: function(event, total){ - $("#add_photo_button").html( "Uploading Photos" ); - $("#add_photo_loader").fadeIn(400); - - $("form.new_photo").fadeOut(0); - $("#progress_report").fadeIn(0); - $("#photo_title_status").text("Uploading..."); - return true; - } - }); - }); - %h1 %span{:id=>"photo_title_status"} Add photos to diff --git a/public/javascripts/photos.js b/public/javascripts/photos.js index b04585402..3980c008e 100644 --- a/public/javascripts/photos.js +++ b/public/javascripts/photos.js @@ -22,3 +22,30 @@ function reset_photo_fancybox(){ $("#new_photo_pane").html(ajax.responseText) }); } + +$("#photo_image").html5_upload({ + // WE INSERT ALBUM_ID PARAM HERE + url: "/photos?album_id="+$(".album_id")[0].id, + sendBoundary: window.FormData || $.browser.mozilla, + setName: function(text) { + $("#progress_report_name").text(text); + }, + onFinish: function(event, total){ + $("#add_photo_button").html( "Add Photos" ); + $("#add_photo_loader").fadeOut(400); + + $("#photo_title_status").text("Done!"); + $("#progress_report").html("Good job me!"); + + $("#add_photo_button").addClass("uploading_complete"); + }, + onStart: function(event, total){ + $("#add_photo_button").html( "Uploading Photos" ); + $("#add_photo_loader").fadeIn(400); + + $("form.new_photo").fadeOut(0); + $("#progress_report").fadeIn(0); + $("#photo_title_status").text("Uploading..."); + return true; + } +});