2009-06-02 00:08:57 +02:00
|
|
|
<% content_for :javascript do %>
|
2010-04-13 21:10:40 +02:00
|
|
|
<script type="text/javascript" src="/javascripts/uploadify-2.1/jquery.uploadify.v2.1.0.min.js"></script>
|
|
|
|
<script type="text/javascript" src="/javascripts/uploadify-2.1/swfobject.js"></script>
|
2009-06-02 00:08:57 +02:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function() {
|
2010-04-13 21:10:40 +02:00
|
|
|
$('#photo_file').uploadify({
|
|
|
|
uploader:'/javascripts/uploadify-2.1/uploadify.swf',
|
2009-06-02 00:08:57 +02:00
|
|
|
script:'<%= photos_path %>',
|
2010-04-13 21:10:40 +02:00
|
|
|
fileDataName : 'photo[file]',
|
2009-06-02 00:08:57 +02:00
|
|
|
scriptData: {
|
2009-06-03 21:30:09 +02:00
|
|
|
'<%= get_session_key %>' : encodeURIComponent('<%= u cookies[get_session_key] %>'),
|
2010-04-13 21:10:40 +02:00
|
|
|
'authenticity_token' : encodeURIComponent('<%= u form_authenticity_token if protect_against_forgery?%>'),
|
2009-06-02 00:08:57 +02:00
|
|
|
'photo[album_id]' : "<%= @album.id %>"
|
|
|
|
},
|
|
|
|
cancelImg:'/javascripts/jquery.uploadify-v1.6.2.mit/cancel.png',
|
|
|
|
multi:true,
|
|
|
|
auto:true,
|
|
|
|
onComplete : function (e,queueId,fileObj,res,data) {
|
|
|
|
if (res.substring(0, 7) === "FILEID:") {
|
|
|
|
var image = $('<img>').appendTo('#thumbs')
|
|
|
|
image.css('display','none')
|
|
|
|
image.attr('src', res.substring(7) )
|
|
|
|
image.fadeIn('slow')
|
|
|
|
}
|
2009-06-03 01:33:39 +02:00
|
|
|
},
|
|
|
|
onError : function (e,queueId,fileObj,errorObj,res) {
|
2009-06-02 00:08:57 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
<% end %>
|
|
|
|
<form>
|
2010-04-13 21:10:40 +02:00
|
|
|
<input type="file" id="photo_file" />
|
2009-06-02 00:08:57 +02:00
|
|
|
<br />
|
|
|
|
<div id="thumbs"></div>
|
|
|
|
</form>
|
|
|
|
|
2009-06-10 01:22:48 +02:00
|
|
|
<br /><%= link_to "Edit uploaded photos", untouched_album_photos_path( @album ) %>
|
2009-06-09 00:30:22 +02:00
|
|
|
<br /><%= link_to "Back to #{@album.title}", @album %>
|