[IMP] web view: add complete name file in the title and cut label after 25 chars...
authorChristophe Matthieu <chm@openerp.com>
Fri, 30 Nov 2012 11:56:25 +0000 (12:56 +0100)
committerChristophe Matthieu <chm@openerp.com>
Fri, 30 Nov 2012 11:56:25 +0000 (12:56 +0100)
bzr revid: chm@openerp.com-20121130115625-i776h334c3ym1mw9

addons/web/static/src/js/views.js

index d0ac653..5a05d2a 100644 (file)
@@ -1144,12 +1144,13 @@ instance.web.Sidebar = instance.web.Widget.extend({
         var items = [];
         var prefix = this.session.url('/web/binary/saveas', {model: 'ir.attachment', field: 'datas', filename_field: 'name'});
         _.each(attachments,function(a) {
-            a.label = a.name;
+            a.label = a.name.length > 25 ? a.name.substr(0,25) + '...' : a.name;
             if(a.type === "binary") {
                 a.url = prefix  + '&id=' + a.id + '&t=' + (new Date().getTime());
             }
-            a.title =   _t("Create by :") + '\n' + a.create_uid[1] + ' ' + instance.web.format_value(a.create_date, {type:"datetime"}) + 
-                        (a.create_uid[0] != a.write_uid[0] ? '\n' + _t("Modify by :") + '\n' + a.write_uid[1] + ' ' + instance.web.format_value(a.write_date, {type:"datetime"}) : '');
+            a.title =   _t("Attachment :") + '\n   ' + a.name + '\n' + 
+                        _t("Created by :") + '\n   ' + a.create_uid[1] + ' ' + instance.web.format_value(a.create_date, {type:"datetime"}) + 
+                        (a.create_uid[0] != a.write_uid[0] ? '\n' + _t("Modified by :") + '\n   ' + a.write_uid[1] + ' ' + instance.web.format_value(a.write_date, {type:"datetime"}) : '');
         });
         self.items['files'] = attachments;
         self.redraw();