[FIX] Fixed autosize behaviour.

bzr revid: vta@openerp.com-20120831105042-fuwhrbdgs51x76u6
This commit is contained in:
vta vta@openerp.com 2012-08-31 12:50:42 +02:00
parent a96751985e
commit 34fcb82602
3 changed files with 19 additions and 62 deletions

View File

@ -23,6 +23,7 @@ This module provides the core of the OpenERP Web Client.
"static/lib/jquery.validate/jquery.validate.js",
"static/lib/jquery.ba-bbq/jquery.ba-bbq.js",
"static/lib/spinjs/spin.js",
"static/lib/jquery.autosize/jquery.autosize.js",
"static/lib/jquery.blockUI/jquery.blockUI.js",
"static/lib/jquery.ui/js/jquery-ui-1.8.17.custom.min.js",
"static/lib/jquery.ui.timepicker/js/jquery-ui-timepicker-addon.js",
@ -37,8 +38,7 @@ This module provides the core of the OpenERP Web Client.
"static/lib/underscore/underscore.string.js",
"static/lib/backbone/backbone.js",
"static/lib/cleditor/jquery.cleditor.js",
"static/lib/py.js/lib/py.js",
"static/lib/jquery.autosize/jquery.autosize.js",
"static/lib/py.js/lib/py.js",
"static/src/js/boot.js",
"static/src/js/corelib.js",
"static/src/js/coresetup.js",
@ -68,60 +68,5 @@ This module provides the core of the OpenERP Web Client.
],
'qweb' : [
"static/src/xml/*.xml",
'static/lib/datejs/globalization/en-US.js',
'static/lib/datejs/core.js',
'static/lib/datejs/parser.js',
'static/lib/datejs/sugarpak.js',
'static/lib/datejs/extras.js',
'static/lib/jquery/jquery-1.7.2.js',
'static/lib/jquery.MD5/jquery.md5.js',
'static/lib/jquery.form/jquery.form.js',
'static/lib/jquery.validate/jquery.validate.js',
'static/lib/jquery.ba-bbq/jquery.ba-bbq.js',
'static/lib/spinjs/spin.js',
'static/lib/jquery.blockUI/jquery.blockUI.js',
'static/lib/jquery.ui/js/jquery-ui-1.8.17.custom.min.js',
'static/lib/jquery.ui.timepicker/js/jquery-ui-timepicker-addon.js',
'static/lib/jquery.ui.notify/js/jquery.notify.js',
'static/lib/jquery.deferred-queue/jquery.deferred-queue.js',
'static/lib/jquery.scrollTo/jquery.scrollTo-min.js',
'static/lib/jquery.tipsy/jquery.tipsy.js',
'static/lib/jquery.textext/jquery.textext.js',
'static/lib/jquery.timeago/jquery.timeago.js',
'static/lib/qweb/qweb2.js',
'static/lib/underscore/underscore.js',
'static/lib/underscore/underscore.string.js',
'static/lib/backbone/backbone.js',
'static/lib/cleditor/jquery.cleditor.js',
'static/lib/py.js/lib/py.js',
'static/src/js/boot.js',
'static/src/js/corelib.js',
'static/src/js/coresetup.js',
'static/src/js/dates.js',
'static/src/js/formats.js',
'static/src/js/chrome.js',
'static/src/js/views.js',
'static/src/js/data.js',
'static/src/js/data_export.js',
'static/src/js/data_import.js',
'static/src/js/search.js',
'static/src/js/view_form.js',
'static/src/js/view_list.js',
'static/src/js/view_list_editable.js',
'static/src/js/view_tree.js',
],
'css': [
'static/lib/jquery.ui.bootstrap/css/custom-theme/jquery-ui-1.8.16.custom.css',
'static/lib/jquery.ui.timepicker/css/jquery-ui-timepicker-addon.css',
'static/lib/jquery.ui.notify/css/ui.notify.css',
'static/lib/jquery.tipsy/tipsy.css',
'static/lib/jquery.textext/jquery.textext.css',
'static/src/css/base.css',
'static/src/css/data_export.css',
'static/src/css/data_import.css',
'static/lib/cleditor/jquery.cleditor.css',
],
'qweb': [
'static/src/xml/*.xml',
],
}

View File

@ -59,7 +59,12 @@
} else {
mirror = $(copy).data('ismirror', true).addClass(className || 'autosizejs')[0];
resize = $ta.css('resize') === 'none' ? 'none' : 'horizontal';
// Changed allowed resize only in edit mode by VTA (31/8/2012)
if ($ta.attr('disabled')) {
$ta.css('resize', 'none');
}
// Changed horizontal to vertical by VTA (31/8/2012)
resize = $ta.css('resize') === 'none' ? 'none' : 'vertical';
$ta.data('mirror', $(mirror)).css({
overflow: hidden,

View File

@ -2322,12 +2322,16 @@ instance.web.form.FieldDate = instance.web.form.FieldDatetime.extend({
instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, {
template: 'FieldText',
init: function (field_manager, node) {
this._super(field_manager, node);
},
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() {
this.set({'value': instance.web.parse_value(this.$textarea.val(), this)});
self.set({'value': instance.web.parse_value(self.$textarea.val(), self)});
}, this));
} else {
this.$textarea.attr('disabled', 'disabled');
@ -2340,14 +2344,17 @@ instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.we
this.setupFocus(this.$textarea);
},
set_value: function(value_) {
this._super.apply(this, arguments);
this._super(value_);
this.render_value();
$(window).resize();
},
render_value: function() {
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();
this.$textarea.css('height', parseInt(this.default_height)+"px");
this.$textarea.autosize();
},
is_syntax_valid: function() {
if (!this.get("effective_readonly")) {