Victor Tabuenca (OpenERP) has proposed merging lp:~openerp-dev/openerp-web/trunk-fix_fieldtext-vta into lp:openerp-web.
Requested reviews: OpenERP Core Team (openerp) For more details, see: https://code.launchpad.net/~openerp-dev/openerp-web/trunk-fix_fieldtext-vta/+merge/138916 Clean code of FieldText widget, and fix its behaviour. -- https://code.launchpad.net/~openerp-dev/openerp-web/trunk-fix_fieldtext-vta/+merge/138916 Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openerp-web/trunk-fix_fieldtext-vta.
=== modified file 'addons/web/static/src/js/view_form.js' --- addons/web/static/src/js/view_form.js 2012-12-06 16:17:49 +0000 +++ addons/web/static/src/js/view_form.js 2012-12-10 08:12:23 +0000 @@ -2518,53 +2518,22 @@ initialize_content: function() { var self = this; this.$textarea = this.$el.find('textarea'); - this.default_height = this.$textarea.css('height'); if (!this.get("effective_readonly")) { this.$textarea.change(_.bind(function() { self.internal_set_value(instance.web.parse_value(self.$textarea.val(), self)); + self.$textarea.autosize(); }, this)); } else { this.$textarea.attr('disabled', 'disabled'); } - this.$el.keyup(function (e) { - if (e.which === $.ui.keyCode.ENTER) { - e.stopPropagation(); - } - }); - this.setupFocus(this.$textarea); }, render_value: function() { + var show_value = instance.web.format_value(this.get('value'), this, ''); + this.$textarea.val(show_value); + if (show_value !== '') { + this.$textarea.autosize(); + } $(window).resize(); - var show_value = instance.web.format_value(this.get('value'), this, ''); - if (show_value === '') { - this.$textarea.css('height', parseInt(this.default_height)+"px"); - } - this.$textarea.val(show_value); - this.$textarea.autosize(); - }, - is_syntax_valid: function() { - if (!this.get("effective_readonly") && this.$textarea) { - try { - var value_ = instance.web.parse_value(this.$textarea.val(), this, ''); - return true; - } catch(e) { - return false; - } - } - return true; - }, - is_false: function() { - return this.get('value') === '' || this._super(); - }, - focus: function($el) { - this.$textarea.focus(); - }, - set_dimensions: function (height, width) { - this._super(height, width); - this.$textarea.css({ - width: width, - minHeight: height - }); }, });
_______________________________________________ Mailing list: https://launchpad.net/~openerp-dev-gtk Post to : openerp-dev-gtk@lists.launchpad.net Unsubscribe : https://launchpad.net/~openerp-dev-gtk More help : https://help.launchpad.net/ListHelp