[imp] refactored field image

bzr revid: nicolas.vanhoren@openerp.com-20120319154744-o3k73ugs3s48p8fg
This commit is contained in:
niv-openerp
2012-03-19 16:47:44 +01:00
parent c9efa25028
commit e3ba4192e4
2 changed files with 11 additions and 11 deletions
+11 -4
View File
@@ -3365,6 +3365,9 @@ openerp.web.form.FieldBinary = openerp.web.form.AbstractField.extend({
openerp.web.form.FieldBinaryFile = openerp.web.form.FieldBinary.extend({
template: 'FieldBinaryFile',
start: function() {
this._super();
},
update_dom: function() {
this._super.apply(this, arguments);
this.$element.find('.oe-binary-file-set, .oe-binary-file-clear').toggle(!this.readonly);
@@ -3406,10 +3409,14 @@ openerp.web.form.FieldBinaryImage = openerp.web.form.FieldBinary.extend({
start: function() {
this._super.apply(this, arguments);
this.$image = this.$element.find('img.oe-binary-image');
},
update_dom: function() {
this._super.apply(this, arguments);
this.$element.find('.oe-binary').toggle(!this.readonly);
var check_visibility = function() {
if (!this.get("effective_readonly"))
this.$element.find('.oe-binary').show();
else
this.$element.find('.oe-binary').hide();
}
this.on("change:effective_readonly", this, check_visibility);
_.bind(check_visibility, this)();
},
set_value: function(value) {
this._super.apply(this, arguments);
-7
View File
@@ -68,12 +68,6 @@ openerp.web.page = function (openerp) {
/** @namespace */
openerp.web.page = {};
openerp.web.page.FieldBinaryImageReaonly = openerp.web.form.FieldBinaryImage.extend({
update_dom: function() {
this._super.apply(this, arguments);
this.$element.find('.oe-binary').hide();
}
});
openerp.web.page.FieldBinaryFileReadonly = openerp.web.form.FieldBinary.extend({
form_template: 'FieldURI.readonly',
start: function() {
@@ -97,7 +91,6 @@ openerp.web.page = function (openerp) {
});
openerp.web.page.readonly = openerp.web.form.widgets.extend({
'binary': 'openerp.web.page.FieldBinaryFileReadonly',
'image': 'openerp.web.page.FieldBinaryImageReaonly',
});