2009-06-02 00:08:57 +02:00
|
|
|
<% content_for :javascript do %>
|
2009-06-09 00:30:22 +02:00
|
|
|
<script type="text/javascript" src="/javascripts/jquery.uploadify-v1.6.2.mit/jquery.uploadify.js"></script>
|
2009-06-02 00:08:57 +02:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
2009-06-09 00:30:22 +02:00
|
|
|
$(document).ready(function() {
|
|
|
|
$('#photo').fileUpload({
|
|
|
|
uploader:'/javascripts/jquery.uploadify-v1.6.2.mit/uploader.swf',
|
|
|
|
script:'<%= photos_path %>',
|
|
|
|
scriptData: {
|
|
|
|
'<%= get_session_key %>' : encodeURIComponent('<%= u cookies[get_session_key] %>'),
|
|
|
|
'<%= request_forgery_protection_token %>' : encodeURIComponent('<%= u form_authenticity_token %>'),
|
|
|
|
'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')
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onError : function (e,queueId,fileObj,errorObj,res) {
|
2009-06-02 00:08:57 +02:00
|
|
|
}
|
2009-06-09 00:30:22 +02:00
|
|
|
})
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
<% end %>
|
|
|
|
<form>
|
|
|
|
<input type="file" id="photo" name="photo" />
|
|
|
|
<br />
|
|
|
|
<div id="thumbs"></div>
|
|
|
|
</form>
|
2009-06-02 00:08:57 +02:00
|
|
|
|