Skip to content

Commit

Permalink
add inForm option and fix clear button bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbeefeater committed Jan 21, 2018
1 parent 62e85bd commit 69cef16
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## ssi-uploader v1.3.9-beta
* Fix the clear button in no preview mode
* Add inForm(boolean) option that allows to send the files in form.


## ssi-uploader v1.3.1-beta
* Now you can display message from server even if the response is success.

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"main": "dist/ssi-uploader/js/ssi-uploader.js",
"description": "An awesome jquery uploader",
"scripts": {
"start":"gulp",
"build":"gulp compile",
"start": "gulp",
"build": "gulp compile",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
Expand Down
13 changes: 8 additions & 5 deletions src/ssi-uploader/js/ssi-uploader.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/*
* error:an teleiwsei to upload kai iparxei ena sti lista pou den exei patithei
* */

(function (root, factory) {
//@author http://ifandelse.com/its-not-hard-making-your-library-support-amd-and-commonjs/
Expand Down Expand Up @@ -41,7 +38,9 @@
var $clearBtn = $('<button id="ssi-clearBtn" class="ssi-hidden ssi-button info" >' + this.language.clear +
'</button>');
var $abortBtn = $('<button id="ssi-abortBtn" class="ssi-button error ssi-cancelAll ssi-hidden" ><span class="inBtn">' + this.language.abort + ' </span></button>');

if(this.options.inForm){
$uploadBtn.hide();
}
this.$element.append($('<div class="ssi-buttonWrapper">').append($chooseBtn, $abortBtn, $uploadBtn, $clearBtn));
var $uploadBox;
if (!this.options.preview) {
Expand All @@ -66,7 +65,9 @@
});
$input.on('change', function () { //choose files
thisS.toUploadFiles(this.files);
$input.val('');
if(!thisS.options.inForm){
$input.val('');
}
});
//drag n drop
if (thisS.options.dropZone) {
Expand Down Expand Up @@ -324,6 +325,7 @@
j++;
}
} else {
$clearBtn.prop('disabled', false);
thisS.$element.find('.ssi-namePreview').html((index === 0 ? cutFileName(filename, ext, 13) : (thisS.currentListLength + 1) + ' ' + thisS.language.files));//set name preview
$fileList.append('<tr class="ssi-space"><td></td></tr>' +//append files element to dom
'<tr class="ssi-toUploadTr ssi-pending"><td><div id="ssi-uploadProgress' + index + '" class="ssi-hidden ssi-uploadProgress ssi-uploadProgressNoPre"></div>' +
Expand Down Expand Up @@ -788,6 +790,7 @@
responseValidation: false,
ignoreCallbackErrors: false,
maxFileSize: 2,
inForm: false,
ajaxOptions: {},
onUpload: function () {
},
Expand Down

0 comments on commit 69cef16

Please sign in to comment.