From b9a2a3e320221506db3c8175d402decfc96c34ce Mon Sep 17 00:00:00 2001 From: David Monjoie Date: Tue, 21 Mar 2017 09:10:06 +0100 Subject: [ADD] web: add url widget tests and documentation --- addons/web/static/src/js/fields/basic_fields.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'addons/web/static/src/js/fields/basic_fields.js') diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index 91aa9d4e1ce..a1847f6fb3d 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -803,10 +803,28 @@ var FieldPhone = EmailWidget.extend({ var UrlWidget = InputField.extend({ supportedFieldTypes: ['char'], + + /** + * Urls are links in readonly mode. + * + * @override + */ init: function () { this._super.apply(this, arguments); this.tagName = this.mode === 'readonly' ? 'a' : 'input'; }, + + //-------------------------------------------------------------------------- + // Private + //-------------------------------------------------------------------------- + + /** + * In readonly, the widget needs to be a link with proper href and proper + * support for the design, which is achieved by the added classes. + * + * @override + * @private + */ _renderReadonly: function () { this.$el.text(this.value) .addClass('o_form_uri o_text_overflow') -- cgit v1.2.3