mirror of https://github.com/OCA/web.git
[IMP] Merge 'web_widget_prefixed_url'
parent
10a55bd5c9
commit
530314cbfc
|
@ -1,2 +1,5 @@
|
||||||
* Simone Orsi <simone.orsi@camptocamp.com>
|
* Simone Orsi <simone.orsi@camptocamp.com>
|
||||||
* Alexey Pelykh <alexey.pelykh@brainbeanapps.com>
|
* Alexey Pelykh <alexey.pelykh@brainbeanapps.com>
|
||||||
|
* Jay Vora <jay.vora@serpentcs.com>
|
||||||
|
* Swapnesh Shah <s.shah.serpentcs@gmail.com>
|
||||||
|
* Joan Sisquella <joan.sisquella@forgeflow.com>
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
Extend URL widget features to ease customization of anchor's text.
|
Extend URL widget features to ease customization of anchor's text.
|
||||||
|
|
||||||
By default the URL widget will show the plain URL.
|
By default, the URL widget will show the plain URL.
|
||||||
You can specify an attribute `text` to provide a static label too.
|
You can specify an attribute to provide a static label too.
|
||||||
|
|
||||||
With this module you can use a field for link's inner text.
|
With this module, you can use a field for link's inner text using attribute
|
||||||
|
'text_field'. You can also add a prefix to the link using attribute
|
||||||
|
'prefix_name'.
|
||||||
|
|
||||||
|
Until 13.0 this functionality was separated in modules 'web_widget_url_advanced'
|
||||||
|
and 'web_widget_prefixed_url'
|
||||||
|
|
|
@ -25,3 +25,15 @@ This is going to change the rendering from
|
||||||
to
|
to
|
||||||
|
|
||||||
.. figure:: ../static/description/after.png
|
.. figure:: ../static/description/after.png
|
||||||
|
|
||||||
|
Or user can add any hyperlink text using 'prefix_name' attribute
|
||||||
|
|
||||||
|
.. code-block:: xml
|
||||||
|
|
||||||
|
<field name="skype_name" widget="url" 'prefix_name': 'skype'/>
|
||||||
|
|
||||||
|
both can be applied inside the options attribute too:
|
||||||
|
|
||||||
|
.. code-block:: xml
|
||||||
|
|
||||||
|
<field name="skype_name" widget="url" options="{'prefix_name': 'skype'}"/>
|
||||||
|
|
|
@ -23,5 +23,17 @@ odoo.define("web_widget_url_advanced", function(require) {
|
||||||
this.attrs.text = field_value;
|
this.attrs.text = field_value;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @override
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_renderReadonly: function() {
|
||||||
|
this._super.apply(this, arguments);
|
||||||
|
var prefix = this.attrs.prefix_name || this.attrs.options.prefix_name;
|
||||||
|
if (prefix) {
|
||||||
|
this.$el.attr("href", prefix + ":" + this.value);
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue