Upload starts automatically when Javascript is enabled
This commit is contained in:
parent
52590d866e
commit
4ee670e438
2 changed files with 10 additions and 6 deletions
|
|
@ -40,7 +40,8 @@ load_reviews = function() {
|
||||||
|
|
||||||
// Initialize the upload form.
|
// Initialize the upload form.
|
||||||
upload_form_init = function() {
|
upload_form_init = function() {
|
||||||
// Disable the submit button until files are selected.
|
// Disable the submit button if Javascript is supported.
|
||||||
|
// Upload will start right after selecting images.
|
||||||
$('#file-submit').hide();
|
$('#file-submit').hide();
|
||||||
|
|
||||||
// Install event handler to notice when files were selected.
|
// Install event handler to notice when files were selected.
|
||||||
|
|
@ -50,8 +51,8 @@ upload_form_init = function() {
|
||||||
upload_form_files_selected = function() {
|
upload_form_files_selected = function() {
|
||||||
no_files = this.files.length;
|
no_files = this.files.length;
|
||||||
if (no_files > 0) {
|
if (no_files > 0) {
|
||||||
$('#file-label').html(no_files+" files selected");
|
$('#file-label').html(no_files+" files selected - uploading…"); // change label
|
||||||
$('#file-select-button').addClass('success');
|
$('#file-select-button').attr('disabled','disabled'); // disable select button
|
||||||
$('#file-submit').fadeIn('slow');
|
$('#file-form').submit(); // start upload
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,14 @@
|
||||||
- else
|
- else
|
||||||
' There are no screenshots yet for #{@package.name}.
|
' There are no screenshots yet for #{@package.name}.
|
||||||
|
|
||||||
= form_tag(upload_image_path, multipart: true)
|
= form_for :screenshot, url: upload_image_path, html: { multipart: true, id: 'file-form' } do |f|
|
||||||
|
|
||||||
|
/ = form_tag(upload_image_path, multipart: true, id: 'file-form')
|
||||||
|
|
||||||
.row
|
.row
|
||||||
.small-6.columns
|
.small-6.columns
|
||||||
input.hidden-inputfile type="file" name="file" id="file" multiple=true
|
/ input.hidden-inputfile type="file" name="image" id="file" multiple=true
|
||||||
|
= f.file_field :image, id: 'file', multiple: true, class: 'hidden-inputfile'
|
||||||
label for="file"
|
label for="file"
|
||||||
a.button id="file-select-button"
|
a.button id="file-select-button"
|
||||||
= fa_stacked_icon "image", base: "circle-thin"
|
= fa_stacked_icon "image", base: "circle-thin"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue