= render 'receive_upload' h1 = "Upload screenshots for #{@package.name}" .grid-x .small-7.cell p.subtitle = @package.description p ' You are about to upload a screenshot for the #{@package.name} ' package. Thanks for your contribution. = form_for :screenshot, url: upload_receive_path, html: { multipart: true, id: 'file-form' } do |f| .grid-x .small-6.cell input.hidden-inputfile type="file" name="file[]" id="file" multiple=true label for="file" a.button id="file-select-button" = fa_stacked_icon "image", base: "circle-thin" span id="file-label" ' Upload screenshots .small-6.cell button.button type="submit" id="file-submit" = fa_stacked_icon "upload", base: "circle-thin" ' Start upload / - if @package.screenshots.any? / p Just for your information - these screenshots have already been uploaded: / - @package.screenshots.all.each do |ss| / a.black.fancybox href =url_for(ss.simage_url(:large)) rel='fancybox-thumb' title=ss.caption / = small_img(ss) .small-5.cell.bigpanel p.subtitle Your upload… ul li ' should contain a typical scene when working with it li ' should show the actual application and not just ' your whole desktop (unless the screenshot is meant for a window manager) li ' needs to be in PNG or JPEG format li ' can be multiple images at once li ' needs to be approved by the moderators first before it is publicly visible li ' will be reduced if it is wider or higher than 2000 pixels. ' So don't try to capture too much detail in a screenshot. It may become ' unreadable. Shrink the application's window if possible. li ' will be made public and can freely be used by anyone li ' can be taken by screenshot tools like shutter, ksnapshot (KDE), ' gimp, xwd or scrot. See the a href='http://wiki.debian.org/ScreenShots' Debian wiki ' for more information on how to make screenshots under Debian. li ' should show the application in english if feasible. ' If you don't use english by default please start your application ' from a shell using after setting "export LANG=C". javascript: // Hide the submit button unless images are selected for upload $(document).ready(upload_form_init); // Handle Ctrl-V to paste an image directly document.onpaste = function (event) { console.log("paste!"); var items = (event.clipboardData || event.originalEvent.clipboardData).items; // /*Make Sure Only One File is Copied*/ // if (items.length != 1) { // return; // } for (var i = 0 ; i < items.length ; i++) { var item = items[i]; console.log(item); console.log("item size="+item.size); if (!item.type.startsWith('image/')) { console.log("Skipping file with type "+item.type); continue } console.log(item.type); var file = item.getAsFile(); console.log(file); upload_file_with_ajax(file); } } function upload_file_with_ajax(file) { if (file==null) { console.log("File was null. Strange."); display_error('Maybe the image was too large.'); return; } var formData = new FormData(); formData.append('file', file); $.ajax('#{{upload_receive_path(format: :json)}}' , { type: 'POST', contentType: false, processData: false, data: formData, //dataType: 'json', error: function(xhr, txt, err) { console.log("AJAX file upload returned error: "+txt+" / "+err); display_error('Did you copy a proper image into your clipboard?'); }, success: function(res) { console.log("AJAX file upload was ok"); // Go back to details page to show the new upload window.location.replace("#{{package_path(@package)}}"); } }); } function display_error(msg) { $('#messages').html( '