mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
Add the functionality to the text widget
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
'category': '',
|
||||
'description': """
|
||||
|
||||
* Add new 'text_limited' widget for TextField, but data are limited to
|
||||
* Add new functionality for TextField, but data are limited to
|
||||
10 lines or 500 characters (by default).
|
||||
You can change default values by context varibles 'limit_lines' and
|
||||
'limit_chars'.
|
||||
@@ -49,7 +49,6 @@ Example of usage:
|
||||
'static/src/js/text_limited.js',
|
||||
],
|
||||
'qweb': [
|
||||
'static/src/xml/text_limited.xml',
|
||||
],
|
||||
'css': [
|
||||
'static/src/css/text_limited.css',
|
||||
|
||||
@@ -5,8 +5,7 @@ var QWeb = instance.web.qweb;
|
||||
var _t = instance.web._t;
|
||||
|
||||
|
||||
instance.web_text_widget.FieldTextLimited = instance.web.form.FieldText.extend(
|
||||
instance.web.form.ReinitializeFieldMixin, {
|
||||
instance.web.form.FieldText.include({
|
||||
template: 'FieldText',
|
||||
LIMIT_LINES_CONTEXT_KEY: 'limit_lines',
|
||||
LIMIT_LINES_DEFAULT: 10,
|
||||
@@ -53,16 +52,5 @@ instance.web_text_widget.FieldTextLimited = instance.web.form.FieldText.extend(
|
||||
this.$el.find('span.length_limit').html(value.length + '/' + limit_chars);
|
||||
},
|
||||
|
||||
initialize_content: function() {
|
||||
return this._super();
|
||||
},
|
||||
|
||||
store_dom_value: function () {
|
||||
this.limit_value(this.$textarea);
|
||||
return this._super();
|
||||
},
|
||||
});
|
||||
|
||||
instance.web.form.widgets.add('text_limited',
|
||||
'instance.web_text_widget.FieldTextLimited');
|
||||
};
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<templates id="template" xml:space="preserve">
|
||||
<t t-extend="FieldText">
|
||||
<t t-jquery=".oe_form_field_text" t-operation="append">
|
||||
<span class="length_limit"></span>
|
||||
</t>
|
||||
</t>
|
||||
</templates>
|
||||
Reference in New Issue
Block a user