From 86aacba3b6b0d126761a6b57a2a0091add5a3061 Mon Sep 17 00:00:00 2001 From: chiu Date: Wed, 30 Oct 2019 22:34:41 +0800 Subject: [PATCH] Update gallery.js --- app/assets/javascripts/gallery.js | 48 ++++++++++++++++--------------- 1 file changed, 25 insertions(+), 23 deletions(-) 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