-# Copyright (c) 2010, Diaspora Inc. This file is -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. #profile_photo_upload = owner_image_tag(:thumb_medium) #file-upload.button =t('.upload') -if !aspect.nil? && aspect != :getting_started %br %br %p \...#{t('.or_select_one')} = link_to t('_photos'), person_photos_path(person) #publisher_photo_upload :javascript function createUploader(){ var uploader = new qq.FileUploaderBasic({ element: document.getElementById('file-upload'), params: {'photo' : {'pending' : true, 'aspect_ids' : "all"}}, allowedExtensions: ['jpg', 'jpeg', 'png'], action: "#{photos_path}", debug: true, button: document.getElementById('file-upload'), sizeLimit: 4194304, onProgress: function(id, fileName, loaded, total){ var progress = Math.round(loaded / total * 100 ); $('#fileInfo').text(fileName + ' ' + progress + '%'); }, messages: { typeError: "#{t('photos.new_photo.invalid_ext')}", sizeError: "#{t('photos.new_photo.size_error')}", emptyError: "#{t('photos.new_photo.empty')}" }, onSubmit: function(id, fileName){ $('#file-upload').addClass("loading"); $("#profile_photo_upload").find(".avatar").fadeTo(200,0.5); }, onComplete: function(id, fileName, responseJSON){ $('#fileInfo').text(fileName + ' completed').fadeOut(2000); $('#file-upload').removeClass("loading"); var id = responseJSON.data.photo.id; var url = responseJSON.data.photo.url; var oldPhoto = $('#photo_id'); if(oldPhoto.length == 0) { $('#update_profile_form').prepend(""); }else{ oldPhoto.val(id); } $("#profile_photo_upload").find(".avatar").fadeTo(200,1); $("#profile_photo_upload").find(".avatar").attr("src",url); } }); } window.onload = createUploader;