app/assets/javascripts/caboose/model/bound_select.js in caboose-cms-0.3.62 vs app/assets/javascripts/caboose/model/bound_select.js in caboose-cms-0.3.63

- old
+ new

@@ -17,27 +17,31 @@ this.message = this.el + '_message'; this.placeholder = this.el + '_placeholder'; $('#'+this.el).wrap($('<div/>') .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($('<div/>') .attr('id', this.placeholder) - .addClass('placeholder') + .addClass('mb_placeholder') .append($('<span/>') .html(this.attribute.nice_name + ': ') ) ); } + var this2 = this; $('#'+this.el+'_container').append($('<input/>') + .attr('type', 'text') .attr('id', this.el) + .addClass('mb_fake_option') .attr('placeholder', this.attribute.empty_text) - .on('focus', function() { this2.edit(); }) + .click(function() { this2.edit(); }) .val(this.attribute.text.length > 0 ? this.attribute.text : this.attribute.empty_text) ); if (this.attribute.width) $('#'+this.el).css('width', this.attribute.width); @@ -53,21 +57,20 @@ //var this2 = this; //this.attribute.populate_options(function() { // this2.print_options(this2); //}); - - var this2 = this; + this.attribute.populate_options(function() { var select = $('<select/>') .attr('id', this2.el + '_select') - .addClass('fake') - .css('width', $('#'+this2.el).outerWidth()) + .addClass('mb_fake') + .css('width', $('#'+this2.el).outerWidth()) .on('change', function() { $('#'+this2.el).val($('#'+this2.el+'_select').val()); this2.save(); - }); + }); // Make sure the existing value is in the list of options var exists = false; $.each(this2.attribute.options, function(i, option) { if (option.value == this2.attribute.value) { @@ -125,11 +128,10 @@ view: function() { }, - edit: function() { - + edit: function() { }, save: function() { this.attribute.value = $('#'+this.el).val(); var this2 = this;