summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields/basic_fields.js
diff options
context:
space:
mode:
authorDavid Monjoie <dmo@odoo.com>2017-03-21 09:10:06 +0100
committerAaron Bohy <aab@odoo.com>2017-04-11 19:44:38 +0200
commitb9a2a3e320221506db3c8175d402decfc96c34ce (patch)
tree58aff55735abbf4b2a0536806bd63ce433a1b112 /addons/web/static/src/js/fields/basic_fields.js
parentb889e4b3e6d531ccb0e8f4107b50f1131e65e528 (diff)
[ADD] web: add url widget tests and documentation
Diffstat (limited to 'addons/web/static/src/js/fields/basic_fields.js')
-rw-r--r--addons/web/static/src/js/fields/basic_fields.js18
1 files changed, 18 insertions, 0 deletions
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')