Began working on screenshot upload feature.
This commit is contained in:
parent
8bc497403d
commit
d701947c68
3 changed files with 74 additions and 2 deletions
|
|
@ -14,4 +14,5 @@
|
|||
//= require jquery_ujs
|
||||
//= require foundation
|
||||
//= require fancybox
|
||||
//= require jquery.fileupload
|
||||
//= require_tree .
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
68
app/views/packages/upload.slim
Normal file
68
app/views/packages/upload.slim
Normal file
|
|
@ -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) {
|
||||
$('<p/>').text(file.name).appendTo(document.body);
|
||||
});
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue