/*
* @class FileInput
*/
(function() {
var FileInput;
FileInput = function($input, options) {
if (options == null) {
options = {};
}
this.options = $.extend({}, FileInput.DEFAULTS, options || {});
this.$input = $input;
this.$el = $('
').insertAfter($input).append($input);
this.$filename = $('.pfi-filename', this.$el);
this.$clear_btn = $(this.options.clear_btn_tmpl).addClass('pfi-clear').appendTo($('.pfi-actions', this.$el));
this.$choose_btn = $(this.options.choose_btn_tmpl).addClass('pfi-choose').appendTo($('.pfi-actions', this.$el));
this.onChange();
$input.on('change', (function(_this) {
return function() {
return $.proxy(_this.onChange, _this)();
};
})(this)).on('click', function(e) {
return e.stopPropagation();
});
this.$el.on('click', function() {
return $input.click();
});
this.$choose_btn.on('click', function(e) {
return e.preventDefault();
});
return this.$clear_btn.on('click', (function(_this) {
return function(e) {
$input.wrap('