mirror of
https://github.com/jasny/bootstrap.git
synced 2026-01-22 20:57:58 -05:00
Color border for error/warning/success for fileupload. Fixed #10
Cancel button clears fileupload widget. Fixed #11
This commit is contained in:
14
js/bootstrap-fileupload.js
vendored
14
js/bootstrap-fileupload.js
vendored
@@ -59,7 +59,12 @@
|
||||
|
||||
change: function(e, invoked) {
|
||||
var file = e.target.files !== undefined ? e.target.files[0] : (e.target.value ? { name: e.target.value.replace(/^.+\\/, '') } : null)
|
||||
if (!file || invoked === 'clear') return
|
||||
if (invoked === 'clear') return
|
||||
|
||||
if (!file) {
|
||||
this.clear()
|
||||
return
|
||||
}
|
||||
|
||||
this.$hidden.val('')
|
||||
this.$hidden.attr('name', '')
|
||||
@@ -91,9 +96,10 @@
|
||||
this.$preview.html('')
|
||||
this.$element.addClass('fileupload-new').removeClass('fileupload-exists')
|
||||
|
||||
this.$input.trigger('change', [ 'clear' ])
|
||||
|
||||
e.preventDefault()
|
||||
if (e) {
|
||||
this.$input.trigger('change', [ 'clear' ])
|
||||
e.preventDefault()
|
||||
}
|
||||
},
|
||||
|
||||
trigger: function(e) {
|
||||
|
||||
@@ -64,7 +64,43 @@
|
||||
.border-radius(0);
|
||||
.box-shadow(none);
|
||||
}
|
||||
|
||||
.fileupload-new.thumbnail-borderless .thumbnail {
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.control-group.warning .fileupload {
|
||||
.uneditable-input {
|
||||
color: #a47e3c;
|
||||
border-color: #a47e3c;
|
||||
}
|
||||
.fileupload-preview {
|
||||
color: #a47e3c;
|
||||
}
|
||||
.thumbnail {
|
||||
border-color: #a47e3c;
|
||||
}
|
||||
}
|
||||
.control-group.error .fileupload {
|
||||
.uneditable-input {
|
||||
color: #b94a48;
|
||||
border-color: #b94a48;
|
||||
}
|
||||
.fileupload-preview {
|
||||
color: #b94a48;
|
||||
}
|
||||
.thumbnail {
|
||||
border-color: #b94a48;
|
||||
}
|
||||
}
|
||||
.control-group.success .fileupload {
|
||||
.uneditable-input {
|
||||
color: #468847;
|
||||
border-color: #468847;
|
||||
}
|
||||
.fileupload-preview {
|
||||
color: #468847;
|
||||
}
|
||||
.thumbnail {
|
||||
border-color: #468847;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user