diff --git a/app/assets/javascripts/gallery.js b/app/assets/javascripts/gallery.js index 26f7ca5..8135aa8 100644 --- a/app/assets/javascripts/gallery.js +++ b/app/assets/javascripts/gallery.js @@ -16,29 +16,31 @@ function form_submit() { var length_upload var count_upload var send_start - $( 'form#fileupload' ).ajaxSuccess(function() { - if (typeof length_upload == "undefined"){ - count_upload = 1 - length_upload = $('#file-list').find('li.template-upload').length - } - else{ - count_upload ++ - } - if (count_upload === length_upload){ - send_start = undefined - $.ajax({ - url : "/admin/galleries/start_upload_process", - dataType : "json", - type : "post", - error: function(){ - alert('init upload process failed, please try again later.') - }, - success: function(){ - window.location.href = '/admin/galleries/upload_process' - } - }) - } - }); + if (temp_length>1){ + $( 'form#fileupload' ).ajaxSuccess(function() { + if (typeof length_upload == "undefined"){ + count_upload = 1 + length_upload = $('#file-list').find('li.template-upload').length + } + else{ + count_upload ++ + } + if (count_upload === length_upload){ + send_start = undefined + $.ajax({ + url : "/admin/galleries/start_upload_process", + dataType : "json", + type : "post", + error: function(){ + alert('init upload process failed, please try again later.') + }, + success: function(){ + window.location.href = '/admin/galleries/upload_process' + } + }) + } + }); + } } function form_only_one_submit() { var temp_length = 1