Color border for error/warning/success for fileupload. Fixed #10

Cancel button clears fileupload widget. Fixed #11
This commit is contained in:
Arnold Daniels
2012-10-12 04:55:13 +02:00
parent 40f0d3c2b3
commit 998051173a
2 changed files with 47 additions and 5 deletions

View File

@@ -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) {

View File

@@ -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;
}
}