app/assets/javascripts/caboose/model/bound_select.js in caboose-cms-0.8.43 vs app/assets/javascripts/caboose/model/bound_select.js in caboose-cms-0.8.44
- old
+ new
@@ -8,15 +8,14 @@
message: false,
placeholder: false,
init: function(params) {
- //console.log('control.model.id = ' + this.model.id);
+ var that = this;
for (var thing in params)
this[thing] = params[thing];
- //console.log('control.model.id = ' + this.model.id);
-
+
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';
var wrapper = $('<div/>').attr('id', this.el + '_container').addClass('mb_container').css('position', 'relative');
@@ -46,14 +45,15 @@
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);
+ that.set_placeholder_padding();
+ //setTimeout(function() {
+ // var w = $('#'+that.placeholder).outerWidth(true);
+ // $('#'+that.el).css('padding-left', '+=' + w);//.css('width', '-=' + w);
+ // }, 200);
}
//this.update_options();
//var this2 = this;
@@ -133,9 +133,18 @@
select.append(opt);
});
$('#'+this2.el+'_container').append(select);
$('#'+this2.el+'_select').css('width', $('#'+this2.el).outerWidth());
});
+ },
+
+ set_placeholder_padding: function() {
+ var that = this;
+ var w = $('#'+that.placeholder).outerWidth(true);
+ if (w > 0)
+ $('#'+that.el).css('padding-left', '+=' + w);
+ else
+ setTimeout(function() { that.set_placeholder_padding(); }, 200);
},
//update_options: function() {
// var that = this;
// this.attribute.populate_options(function() {