From 0af4aea08c1bf459b9a625757918f3a1ae06dd12 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Thu, 15 Jan 2015 11:40:12 +0100 Subject: [PATCH] [IMP] have titles work everywhere --- .../static/src/js/attachment_preview.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/attachment_preview/static/src/js/attachment_preview.js b/attachment_preview/static/src/js/attachment_preview.js index 20423827..0d6abff9 100644 --- a/attachment_preview/static/src/js/attachment_preview.js +++ b/attachment_preview/static/src/js/attachment_preview.js @@ -131,7 +131,7 @@ openerp.attachment_preview = function(instance) attachment_id, $target.siblings('a').attr('href'), attachment_extension, - _t('Preview')); + $target.attr('alt')); }); return (new instance.web.Model('ir.attachment')).call( 'get_binary_extension', @@ -173,10 +173,10 @@ openerp.attachment_preview = function(instance) { var link = this._super.apply(this, arguments); link += _.template( - '<%-preview_text%>', + '<%-preview_text%>', { preview_id: options.id, - preview_text: _t('Preview'), + preview_text: _.str.sprintf(_t('Preview %s'), this.string), preview_model: options.model, preview_field: this.id, preview_filename: this.filename || '', @@ -218,8 +218,9 @@ openerp.attachment_preview = function(instance) self.name, self.view.datarecord.id), extension, - self.view.datarecord[self.node.attrs.filename]); + _.str.sprintf(_t('Preview %s'), self.field.string)); }); + $element.attr('title', _.str.sprintf(_t('Preview %s'), self.field.string)); } else { @@ -228,6 +229,10 @@ openerp.attachment_preview = function(instance) }); }); } + else + { + this.$el.find('.oe-binary-preview').remove(); + }; }, }); }