[IMP] attachment: sidebar rendering of tipsy in html mode, and error fix
bzr revid: chm@openerp.com-20121207080946-f7zr853hvdhdrsk0
This commit is contained in:
parent
a96ef73523
commit
98e87a51ae
|
@ -1349,7 +1349,7 @@ class Binary(openerpweb.Controller):
|
|||
'id': attachment_id
|
||||
}
|
||||
except Exception,e:
|
||||
args = {'erorr':e.faultCode.split('--')[1],'title':e.faultCode.split('--')[0]}
|
||||
args = {'error':e.faultCode }
|
||||
return out % (simplejson.dumps(callback), simplejson.dumps(args))
|
||||
|
||||
class Action(openerpweb.Controller):
|
||||
|
|
|
@ -703,6 +703,9 @@
|
|||
display: block;
|
||||
color: #4c4c4c;
|
||||
text-decoration: none;
|
||||
width: 200px;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
.openerp .oe_dropdown_menu > li > a:hover {
|
||||
text-decoration: none;
|
||||
|
|
|
@ -598,6 +598,9 @@ $sheet-padding: 16px
|
|||
display: block
|
||||
color: #4c4c4c
|
||||
text-decoration: none
|
||||
width: 200px
|
||||
text-overflow: ellipsis
|
||||
overflow: hidden
|
||||
&:hover
|
||||
text-decoration: none
|
||||
.oe_dropdown_arrow:after
|
||||
|
|
|
@ -5143,9 +5143,10 @@ instance.web.form.FieldMany2ManyBinaryMultiFiles = instance.web.form.AbstractFie
|
|||
|
||||
// TODO : activate send on wizard and form
|
||||
|
||||
if (result.erorr || !result.id ) {
|
||||
if (result.error || !result.id ) {
|
||||
|
||||
this.do_warn(result.title, result.erorr);
|
||||
console.log(result.error);
|
||||
this.do_warn(result.error.split('---')[0], result.error.split('---')[1]);
|
||||
files = _.filter(files, function (val) { return !val.upload; });
|
||||
|
||||
} else {
|
||||
|
|
|
@ -1033,6 +1033,11 @@ instance.web.Sidebar = instance.web.Widget.extend({
|
|||
this.$('.oe_form_dropdown_section').each(function() {
|
||||
$(this).toggle(!!$(this).find('li').length);
|
||||
});
|
||||
|
||||
self.$("[title]").tipsy({
|
||||
'html': true,
|
||||
'delayIn': 500,
|
||||
})
|
||||
},
|
||||
/**
|
||||
* For each item added to the section:
|
||||
|
@ -1120,7 +1125,7 @@ instance.web.Sidebar = instance.web.Widget.extend({
|
|||
var self = this;
|
||||
this.dataset = dataset;
|
||||
this.model_id = model_id;
|
||||
if (args && args[0]["erorr"]) {
|
||||
if (args && args[0]["error"]) {
|
||||
instance.web.dialog($('<div>'),{
|
||||
modal: true,
|
||||
title: "OpenERP " + _.str.capitalize(args[0]["title"]),
|
||||
|
@ -1129,7 +1134,7 @@ instance.web.Sidebar = instance.web.Widget.extend({
|
|||
click: function(){
|
||||
$(this).dialog("close");
|
||||
}}]
|
||||
}).html(args[0]["erorr"]);
|
||||
}).html(args[0]["error"]);
|
||||
}
|
||||
if (!model_id) {
|
||||
this.on_attachments_loaded([]);
|
||||
|
@ -1144,13 +1149,10 @@ 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.length > 25 ? a.name.substr(0,25) + '...' : a.name;
|
||||
a.label = a.name;
|
||||
if(a.type === "binary") {
|
||||
a.url = prefix + '&id=' + a.id + '&t=' + (new Date().getTime());
|
||||
}
|
||||
a.title = _t("Attachment :") + '\n ' + a.name + '\n' +
|
||||
(a.create_uid && a.create_uid[0] ? _t("Created by :") + '\n ' + a.create_uid[1] + ' ' + instance.web.format_value(a.create_date, {type:"datetime"}) : '') +
|
||||
(a.create_uid && a.write_uid && 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();
|
||||
|
|
|
@ -594,7 +594,23 @@
|
|||
</button>
|
||||
<ul class="oe_dropdown_menu">
|
||||
<li t-foreach="widget.items[section.name]" t-as="item" t-att-class="item.classname">
|
||||
<a class="oe_sidebar_action_a" t-att-title="item.title" t-att-data-section="section.name" t-att-data-index="item_index" t-att-href="item.url" target="_blank">
|
||||
<t t-if="section.name == 'files'">
|
||||
<t t-set="item.title">
|
||||
<b>Attachment : </b><br/>
|
||||
<t t-raw="item.name"/>
|
||||
</t>
|
||||
<t t-if="item.create_uid and item.create_uid[0]" t-set="item.title">
|
||||
<t t-raw="item.title"/><br/>
|
||||
<b>Created by : </b><br/>
|
||||
<t t-raw="item.create_uid[1] + ' ' + item.create_date"/>
|
||||
</t>
|
||||
<t t-if="item.create_uid and item.write_uid and item.create_uid[0] != item.write_uid[0]" t-set="item.title">
|
||||
<t t-raw="item.title"/><br/>
|
||||
<b>Modified by : </b><br/>
|
||||
<t t-raw="item.write_uid[1] + ' ' + item.write_date"/>
|
||||
</t>
|
||||
</t>
|
||||
<a class="oe_sidebar_action_a" t-att-title="item.title or ''" t-att-data-section="section.name" t-att-data-index="item_index" t-att-href="item.url" target="_blank">
|
||||
<t t-raw="item.label"/>
|
||||
</a>
|
||||
<a t-if="section.name == 'files' and !item.callback" class="oe_sidebar_delete_item" t-att-data-id="item.id" title="Delete this attachment">x</a>
|
||||
|
|
Loading…
Reference in New Issue