diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 82cbb1a..2c77102 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -14,4 +14,5 @@ //= require jquery_ujs //= require foundation //= require fancybox +//= require jquery.fileupload //= require_tree . diff --git a/app/controllers/packages_controller.rb b/app/controllers/packages_controller.rb index a37e5bc..ed93103 100644 --- a/app/controllers/packages_controller.rb +++ b/app/controllers/packages_controller.rb @@ -52,9 +52,12 @@ class PackagesController < ApplicationController end def upload + # TODO + raise "name not given" unless params[:name] + @package = Package.find_by(name: params[:name]) end - def upload_by_name - + def upload_image + "uploaded" end end diff --git a/app/views/packages/upload.slim b/app/views/packages/upload.slim new file mode 100644 index 0000000..5e33b3a --- /dev/null +++ b/app/views/packages/upload.slim @@ -0,0 +1,68 @@ +.row.packagepage + .small-12.columns + h1 = "Upload a new screenshot for #{@package.name}>" + p.subtitle = @package.description + +.row.packagepage + .small-8.columns + // First row contains the upload form + .row + .small-6.columns + input id="fileupload" type="file" name="files[]" data-url=upload_image_path(name: @package.name) multiple=true + a.button.radius.expand href=upload_package_by_name_path(name: @package.name) + ' Click or drag a PNG screenshot file here + .small-6.columns + ' Form + - for screenshot in @package.screenshots + .row + .small-6.columns + img src=screenshot.url('large') + .small-6.columns + ' read-only Form + + .small-4.columns + .bigpanel + p Thanks for uploading more screenshots. Please note: + ul + li + ' Screenshots are made public and can freely be used by anyone. + li + ' Your screenshots must be in PNG format. + li + ' Images larger than 800x600 pixels will automatically be reduced. + ' So don't try to put too much detail on a screenshot. + li + ' Your screenshot should contain a typical scene when working with it. + li + ' Nice tools for taking screenshots are 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 + ' Please set your language to english so that everybody understands it. + ' If you don't use english by default please start your application + ' from a shell using after setting "export LANG=C". + li + ' Please only take a screenshot of the respective application and not of + ' your whole desktop (unless the screenshot is meant for a window manager). + li + ' If you are not logged in or lack the reputation then your screenshot + ' may need to be approved by the moderators first. + + //ul.small-block-grid-1.medium-block-grid-2.large-block-grid-2 + // - for screenshot in @package.screenshots + // li + // a.black.fancybox href=screenshot.url('large') rel='fancybox-thumb' title=screenshot.caption + // img src=screenshot.url('large') + // .imgcaption =screenshot.caption + // + +javascript: + $('#fileupload').fileupload({ + dataType: 'json', + done: function (e, data) { + $.each(data.result.files, function (index, file) { + $('
').text(file.name).appendTo(document.body); + }); + } + });