[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({
|
openerp.web.form.FieldEmail = openerp.web.form.FieldChar.extend({
|
||||||
template: 'FieldEmail',
|
template: 'FieldEmail',
|
||||||
start: function() {
|
bind_events: function() {
|
||||||
this._super.apply(this, arguments);
|
this._super();
|
||||||
this.$element.find('button').click(this.on_button_clicked);
|
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() {
|
on_button_clicked: function() {
|
||||||
if (!this.value || !this.is_valid()) {
|
if (!this.value || !this.is_valid()) {
|
||||||
this.do_warn("E-mail error", "Can't send email to invalid e-mail address");
|
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;
|
return value;
|
||||||
},
|
},
|
||||||
set_value: function (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({
|
openerp.web.page.FieldUrlReadonly = openerp.web.page.FieldURIReadonly.extend({
|
||||||
set_value: function (value) {
|
set_value: function (value) {
|
||||||
var s = /(\w+):(.+)/.exec(value);
|
var s = /(\w+):(.+)/.exec(value);
|
||||||
|
@ -175,7 +169,6 @@ openerp.web.page = function (openerp) {
|
||||||
});
|
});
|
||||||
openerp.web.page.readonly = openerp.web.form.widgets.extend({
|
openerp.web.page.readonly = openerp.web.form.widgets.extend({
|
||||||
'frame': 'openerp.web.page.WidgetFrameReadonly',
|
'frame': 'openerp.web.page.WidgetFrameReadonly',
|
||||||
'email': 'openerp.web.page.FieldEmailReadonly',
|
|
||||||
'url': 'openerp.web.page.FieldUrlReadonly',
|
'url': 'openerp.web.page.FieldUrlReadonly',
|
||||||
'selection' : 'openerp.web.page.FieldSelectionReadonly',
|
'selection' : 'openerp.web.page.FieldSelectionReadonly',
|
||||||
'reference': 'openerp.web.page.FieldReferenceReadonly',
|
'reference': 'openerp.web.page.FieldReferenceReadonly',
|
||||||
|
|
|
@ -966,18 +966,25 @@
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
<t t-name="FieldEmail">
|
<t t-name="FieldEmail">
|
||||||
<table t-attf-class="oe_form_field_#{type}" cellpadding="0" cellspacing="0" border="0" width="100%">
|
<t t-if="!widget.get('effective_readonly')">
|
||||||
<tr>
|
<table t-attf-class="oe_form_field_#{type}" cellpadding="0" cellspacing="0" border="0" width="100%">
|
||||||
<td width="100%">
|
<tr>
|
||||||
<t t-call="FieldChar"/>
|
<td width="100%">
|
||||||
</td>
|
<t t-call="FieldChar"/>
|
||||||
<td width="16">
|
</td>
|
||||||
<button class="oe_button oe_field_button" type="button" title="Send an e-mail with your default e-mail client">
|
<td width="16">
|
||||||
<img t-att-src='_s + "/web/static/src/img/icons/terp-mail-message-new.png"'/>
|
<button class="oe_button oe_field_button" type="button" title="Send an e-mail with your default e-mail client">
|
||||||
</button>
|
<img t-att-src='_s + "/web/static/src/img/icons/terp-mail-message-new.png"'/>
|
||||||
</td>
|
</button>
|
||||||
</tr>
|
</td>
|
||||||
</table>
|
</tr>
|
||||||
|
</table>
|
||||||
|
</t>
|
||||||
|
<t t-if="widget.get('effective_readonly')">
|
||||||
|
<div>
|
||||||
|
<a href="#" class="oe_form_uri"/>
|
||||||
|
</div>
|
||||||
|
</t>
|
||||||
</t>
|
</t>
|
||||||
<t t-name="FieldUrl">
|
<t t-name="FieldUrl">
|
||||||
<table t-attf-class="oe_form_field_#{type}" cellpadding="0" cellspacing="0" border="0" width="100%">
|
<table t-attf-class="oe_form_field_#{type}" cellpadding="0" cellspacing="0" border="0" width="100%">
|
||||||
|
|
Loading…
Reference in New Issue