Refactored upload modal into a seperate partial view
This commit is contained in:
parent
af578f6622
commit
fc95fc9d9a
2 changed files with 66 additions and 68 deletions
65
app/views/packages/_details_uploadmodal.slim
Normal file
65
app/views/packages/_details_uploadmodal.slim
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
// Modal upload window
|
||||
#upload-modal.reveal data-reveal=true role='dialog'
|
||||
h1 Upload new screenshots
|
||||
.row
|
||||
.small-4.columns
|
||||
= form_for :screenshot, url: upload_image_path, html: { multipart: true } do |f|
|
||||
/ = image_tag("/images/dummy/upload.svg", style: "width: 100%", id: 'upload-image')
|
||||
a.button.round id='upload-image' Start uploading
|
||||
= f.file_field :image, id: 'fileupload', multiple: true, style: 'display: none'
|
||||
|
||||
.small-8.columns
|
||||
.bigpanel
|
||||
p Thanks for uploading more screenshots. Please note:
|
||||
ul
|
||||
li
|
||||
' Your screenshot should contain a typical scene when working with it.
|
||||
li
|
||||
' Take only a screenshot of the respective application and not of
|
||||
' your whole desktop (unless the screenshot is meant for a window manager).
|
||||
li
|
||||
' Your screenshots must be in PNG format.
|
||||
li
|
||||
' You can upload multiple images at once.
|
||||
li
|
||||
' Your screenshot need to be approved by the moderators first.
|
||||
' You will already see your screenshot but it will not be visible to
|
||||
' others instantly. If moderators reject your upload you will get
|
||||
' notified next time you visit this site (requires cookies).
|
||||
li
|
||||
' Images larger than 800x600 pixels will automatically be reduced.
|
||||
' So don't try to capture too much detail in a screenshot. It may become
|
||||
' unreadable. Shrink the applications window if possible.
|
||||
li
|
||||
' Screenshots are made public and can freely be used by anyone.
|
||||
li
|
||||
' Useful programs for making 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".
|
||||
|
||||
|
||||
javascript:
|
||||
$(function () {
|
||||
var upload_enabled = true;
|
||||
|
||||
// If the image button is clicked then imitate a click on the file
|
||||
// select button that is hidden.
|
||||
$("#upload-image").click( function () {
|
||||
if (upload_enabled) {
|
||||
$("#fileupload").click();
|
||||
}
|
||||
});
|
||||
|
||||
// Files have been selected. Tell the user what's going on and
|
||||
// submit the upload form.
|
||||
$('#fileupload').change( function () {
|
||||
upload_enabled = false;
|
||||
$('#upload-image').html('Please wait...');
|
||||
$('form').submit();
|
||||
});
|
||||
});
|
||||
|
|
@ -57,72 +57,5 @@
|
|||
|
||||
.small-5.medium-5.columns
|
||||
= render(partial: 'details_rightbox', locals: {pkg: @package})
|
||||
// Modal upload window
|
||||
#upload-modal.reveal data-reveal=true role='dialog'
|
||||
h1 Upload new screenshots
|
||||
.row
|
||||
.small-4.columns
|
||||
= form_for :screenshot, url: upload_image_path, html: { multipart: true } do |f|
|
||||
/ = image_tag("/images/dummy/upload.svg", style: "width: 100%", id: 'upload-image')
|
||||
a.button.round id='upload-image' Start uploading
|
||||
= f.file_field :image, id: 'fileupload', multiple: true, style: 'display: none'
|
||||
|
||||
.small-8.columns
|
||||
.bigpanel
|
||||
p Thanks for uploading more screenshots. Please note:
|
||||
ul
|
||||
li
|
||||
' Your screenshot should contain a typical scene when working with it.
|
||||
li
|
||||
' Take only a screenshot of the respective application and not of
|
||||
' your whole desktop (unless the screenshot is meant for a window manager).
|
||||
li
|
||||
' Your screenshots must be in PNG format.
|
||||
li
|
||||
' You can upload multiple images at once.
|
||||
li
|
||||
' Your screenshot need to be approved by the moderators first.
|
||||
' You will already see your screenshot but it will not be visible to
|
||||
' others instantly. If moderators reject your upload you will get
|
||||
' notified next time you visit this site (requires cookies).
|
||||
li
|
||||
' Images larger than 800x600 pixels will automatically be reduced.
|
||||
' So don't try to capture too much detail in a screenshot. It may become
|
||||
' unreadable. Shrink the applications window if possible.
|
||||
li
|
||||
' Screenshots are made public and can freely be used by anyone.
|
||||
li
|
||||
' Useful programs for making 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".
|
||||
|
||||
|
||||
// TODO: allow to remove own uploads
|
||||
|
||||
// TODO: allow non-upload to report (request removal)
|
||||
|
||||
javascript:
|
||||
$(function () {
|
||||
var upload_enabled = true;
|
||||
|
||||
// If the image button is clicked then imitate a click on the file
|
||||
// select button that is hidden.
|
||||
$("#upload-image").click( function () {
|
||||
if (upload_enabled) {
|
||||
$("#fileupload").click();
|
||||
}
|
||||
});
|
||||
|
||||
// Files have been selected. Tell the user what's going on and
|
||||
// submit the upload form.
|
||||
$('#fileupload').change( function () {
|
||||
upload_enabled = false;
|
||||
$('#upload-image').html('Please wait...');
|
||||
$('form').submit();
|
||||
});
|
||||
});
|
||||
= render(partial: 'details_uploadmodal')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue