Skip to content

Commit

Permalink
Fix #116: Hide remove and upload buttons until unless file(s) are sel…
Browse files Browse the repository at this point in the history
…ected
  • Loading branch information
kartik-v committed Jan 7, 2015
1 parent 7540922 commit 6419937
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ version 4.1.5
7. (bug #113): Icon layout template undefined when using user template.
8. (bug #114): Prevent multiple file selection when using single file configuration.
9. (enh #115): Autosize file caption responsively on window resize.
10. (enh #116): Hide remove and upload buttons until unless file(s) are selected.

version 4.1.4
=============
Expand Down
4 changes: 3 additions & 1 deletion css/fileinput.css
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@
padding-top: 30px;
text-align:right
}
.file-input-new .file-preview, .file-input-new .close, .file-input-new .glyphicon-file, .file-input-new .fileinput-remove-button, .file-input-new .fileinput-upload-button {
.file-input-new .file-preview, .file-input-new .close, .file-input-new .glyphicon-file,
.file-input-new .fileinput-remove-button, .file-input-new .fileinput-upload-button,
.file-input-ajax-new .fileinput-remove-button, .file-input-ajax-new .fileinput-upload-button {
display: none;
}

Expand Down
2 changes: 1 addition & 1 deletion css/fileinput.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions js/fileinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@
$zone.prepend('<div class="' + self.dropZoneTitleClass + '">' + self.dropZoneTitle + '</div>');
}
self.$container.removeClass('file-input-new');
addCss(self.$container, 'file-input-ajax-new');
},
initFileActions: function() {
var self = this;
Expand Down Expand Up @@ -1370,7 +1371,7 @@
self.showFileIcon();
}
self.setCaption(log);
self.$container.removeClass('file-input-new');
self.$container.removeClass('file-input-new file-input-ajax-new');
if (arguments.length == 1) {
self.raise('fileselect', [numFiles, label]);
}
Expand Down Expand Up @@ -1425,7 +1426,7 @@
self.isError = throwError(msg, null, null, null);
self.$captionContainer.find('.kv-caption-icon').hide();
self.$caption.html(self.msgValidationError);
self.$container.removeClass('file-input-new');
self.$container.removeClass('file-input-new file-input-ajax-new');
return;
}
if (!self.isIE9) {
Expand Down Expand Up @@ -1537,7 +1538,7 @@
return '<button type="button" title="' + self.cancelTitle + '" class="hide ' + css + '">' + self.cancelIcon + self.cancelLabel + '</button>';
},
renderUpload: function () {
var self = this, css = self.uploadClass + ' kv-fileinput-upload', content = '', status = '';
var self = this, css = self.uploadClass + ' kv-fileinput-upload fileinput-upload-button', content = '', status = '';
if (!self.showUpload) {
return '';
}
Expand Down
4 changes: 2 additions & 2 deletions js/fileinput.min.js

Large diffs are not rendered by default.

0 comments on commit 6419937

Please sign in to comment.