[imp] made email readonly-able
bzr revid: nicolas.vanhoren@openerp.com-20120316113322-wgg7ixwal4qwc55f
This commit is contained in:
parent
36ba035431
commit
7cee52681f
|
@ -1490,10 +1490,19 @@ openerp.web.form.FieldID = openerp.web.form.FieldChar.extend({
|
|||
|
||||
openerp.web.form.FieldEmail = openerp.web.form.FieldChar.extend({
|
||||
template: 'FieldEmail',
|
||||
start: function() {
|
||||
this._super.apply(this, arguments);
|
||||
bind_events: function() {
|
||||
this._super();
|
||||
this.$element.find('button').click(this.on_button_clicked);
|
||||
},
|
||||
render_value: function() {
|
||||
if (!this.get("effective_readonly")) {
|
||||
this._super();
|
||||
} else {
|
||||
this.$element.find('a')
|
||||
.attr('href', 'mailto:' + this.value)
|
||||
.text(this.value);
|
||||
}
|
||||
},
|
||||
on_button_clicked: function() {
|
||||
if (!this.value || !this.is_valid()) {
|
||||
this.do_warn("E-mail error", "Can't send email to invalid e-mail address");
|
||||
|
|
|
@ -75,14 +75,8 @@ openerp.web.page = function (openerp) {
|
|||
return value;
|
||||
},
|
||||
set_value: function (value) {
|
||||
this.$element.find('a')
|
||||
.attr('href', this.scheme + ':' + value)
|
||||
.text(this.format_value(value));
|
||||
}
|
||||
});
|
||||
openerp.web.page.FieldEmailReadonly = openerp.web.page.FieldURIReadonly.extend({
|
||||
scheme: 'mailto'
|
||||
});
|
||||
openerp.web.page.FieldUrlReadonly = openerp.web.page.FieldURIReadonly.extend({
|
||||
set_value: function (value) {
|
||||
var s = /(\w+):(.+)/.exec(value);
|
||||
|
@ -175,7 +169,6 @@ openerp.web.page = function (openerp) {
|
|||
});
|
||||
openerp.web.page.readonly = openerp.web.form.widgets.extend({
|
||||
'frame': 'openerp.web.page.WidgetFrameReadonly',
|
||||
'email': 'openerp.web.page.FieldEmailReadonly',
|
||||
'url': 'openerp.web.page.FieldUrlReadonly',
|
||||
'selection' : 'openerp.web.page.FieldSelectionReadonly',
|
||||
'reference': 'openerp.web.page.FieldReferenceReadonly',
|
||||
|
|
|
@ -966,18 +966,25 @@
|
|||
</div>
|
||||
</t>
|
||||
<t t-name="FieldEmail">
|
||||
<table t-attf-class="oe_form_field_#{type}" cellpadding="0" cellspacing="0" border="0" width="100%">
|
||||
<tr>
|
||||
<td width="100%">
|
||||
<t t-call="FieldChar"/>
|
||||
</td>
|
||||
<td width="16">
|
||||
<button class="oe_button oe_field_button" type="button" title="Send an e-mail with your default e-mail client">
|
||||
<img t-att-src='_s + "/web/static/src/img/icons/terp-mail-message-new.png"'/>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<t t-if="!widget.get('effective_readonly')">
|
||||
<table t-attf-class="oe_form_field_#{type}" cellpadding="0" cellspacing="0" border="0" width="100%">
|
||||
<tr>
|
||||
<td width="100%">
|
||||
<t t-call="FieldChar"/>
|
||||
</td>
|
||||
<td width="16">
|
||||
<button class="oe_button oe_field_button" type="button" title="Send an e-mail with your default e-mail client">
|
||||
<img t-att-src='_s + "/web/static/src/img/icons/terp-mail-message-new.png"'/>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</t>
|
||||
<t t-if="widget.get('effective_readonly')">
|
||||
<div>
|
||||
<a href="#" class="oe_form_uri"/>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
<t t-name="FieldUrl">
|
||||
<table t-attf-class="oe_form_field_#{type}" cellpadding="0" cellspacing="0" border="0" width="100%">
|
||||
|
|
Loading…
Reference in New Issue