BoundSelect = BoundControl.extend({ //el: false, //model: false, //attribute: false, //binder: false, message: false, placeholder: false, init: function(params) { for (var thing in params) this[thing] = params[thing]; this.el = this.el ? this.el : this.model.name.toLowerCase() + '_' + this.model.id + '_' + this.attribute.name; this.message = this.el + '_message'; this.placeholder = this.el + '_placeholder'; $('#'+this.el).wrap($('
') .attr('id', this.el + '_container') .addClass('mb_container') .css('position', 'relative') ); $('#'+this.el+'_container').empty(); if (this.attribute.fixed_placeholder == true) { $('#'+this.el+'_container').append($('
') .attr('id', this.placeholder) .addClass('mb_placeholder') .append($('') .html(this.attribute.nice_name + ': ') ) ); } var this2 = this; $('#'+this.el+'_container').append($('') .attr('type', 'text') .attr('id', this.el) .addClass('mb_fake_option') .attr('placeholder', this.attribute.empty_text) .click(function() { this2.edit(); }) .val(this.attribute.text && this.attribute.text.length > 0 ? this.attribute.text : this.attribute.empty_text) ); if (this.attribute.width) $('#'+this.el).css('width', this.attribute.width); if (this.attribute.fixed_placeholder) { var w = $('#'+this.placeholder).outerWidth(); $('#'+this.el) .css('padding-left', '+=' + w) .css('width', '-=' + w); } //this.update_options(); //var this2 = this; //this.attribute.populate_options(function() { // this2.print_options(this2); //}); this.attribute.populate_options(function() { var select = $('') // .attr('id', that.el + '_select') // .addClass('fake') // .css('width', $('#'+that.el).outerWidth()) // .on('change', function() { // $('#'+that.el).val($('#'+that.el+'_select').val()); // that.save(); // }); // // $.each(that.attribute.options, function(i, option) { // var opt = $('