diaspora/app/views/photos/_new_photo.haml
2010-11-19 15:25:14 +01:00

33 lines
1.4 KiB
Text

-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
:javascript
function createUploader(){
var uploader = new qq.FileUploader({
element: document.getElementById('file-upload'),
params: {'photo' : { 'to' : "#{aspect_id}"}, 'set_profile_image' : "#{set_profile_image if defined?(set_profile_image)}"},
allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'],
action: "#{photos_path}",
template: '<div class="qq-uploader">' +
'<div class="qq-upload-drop-area"><span>#{t('.drop')}</span></div>' +
'<div class="qq-upload-button">#{t('.upload')}</div>' +
'<ul class="qq-upload-list"></ul>' +
'</div>',
fileTemplate: '<li>' +
'<span class="qq-upload-file"></span>' +
'<span class="qq-upload-spinner"></span>' +
'<span class="qq-upload-size"></span>' +
'<a class="qq-upload-cancel" href="#">#{t('cancel')}</a>' +
'<span class="qq-upload-failed-text">#{t('.failed')}</span>' +
'</li>',
messages: {
typeError: "#{t('.invalid_ext')}",
sizeError: "#{t('.size_error')}",
emptyError: "#{t('.empty')}"
}
});
}
window.onload = createUploader;
#file-upload