[ADD] Recovered delete icon for the attachments

bzr revid: fme@openerp.com-20120613161712-91h2yvg0rykwun2j
This commit is contained in:
Fabien Meghazi 2012-06-13 18:17:12 +02:00
parent 8401b686b6
commit 784bec95fd
4 changed files with 82 additions and 26 deletions

View File

@ -1066,11 +1066,24 @@
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.openerp .oe_dropdown_menu li {
position: relative;
list-style-type: none;
float: none;
display: block;
background-color: none;
}
.openerp .oe_dropdown_menu li:hover {
background-color: #f0f0fa;
background-image: -webkit-gradient(linear, left top, left bottom, from(#f0f0fa), to(#eeeef6));
background-image: -webkit-linear-gradient(top, #f0f0fa, #eeeef6);
background-image: -moz-linear-gradient(top, #f0f0fa, #eeeef6);
background-image: -ms-linear-gradient(top, #f0f0fa, #eeeef6);
background-image: -o-linear-gradient(top, #f0f0fa, #eeeef6);
background-image: linear-gradient(to bottom, #f0f0fa, #eeeef6);
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
.openerp .oe_dropdown_menu li a {
display: block;
padding: 3px 6px;
@ -1083,20 +1096,40 @@
}
.openerp .oe_dropdown_menu li a:hover {
text-decoration: none;
background-color: #f0f0fa;
background-image: -webkit-gradient(linear, left top, left bottom, from(#f0f0fa), to(#eeeef6));
background-image: -webkit-linear-gradient(top, #f0f0fa, #eeeef6);
background-image: -moz-linear-gradient(top, #f0f0fa, #eeeef6);
background-image: -ms-linear-gradient(top, #f0f0fa, #eeeef6);
background-image: -o-linear-gradient(top, #f0f0fa, #eeeef6);
background-image: linear-gradient(to bottom, #f0f0fa, #eeeef6);
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
.openerp .oe_dropdown_menu li .oe_sidebar_delete_item {
position: absolute;
bottom: 1px;
right: 4px;
display: none;
width: 12px;
height: 12px;
line-height: 12px;
padding: 1px;
color: #8786b7;
line-height: 8px;
text-align: center;
font-weight: bold;
text-shadow: 0 1px 1px white;
}
.openerp .oe_dropdown_menu li .oe_sidebar_delete_item:hover {
text-decoration: none;
color: white;
background: #8786b7;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
}
.openerp .oe_dropdown_menu li:hover .oe_sidebar_delete_item {
display: inline-block;
}
.openerp .oe_sidebar {
white-space: nowrap;
}
.openerp .oe_sidebar .oe_dropdown_menu li {
padding-right: 16px;
}
.openerp .oe_sidebar .oe_sidebar_add_attachment {
cursor: pointer;
padding-left: 6px;

View File

@ -858,6 +858,10 @@ $colour4: #8a89ba
@include radius(3px)
@include box-shadow(0 1px 4px rgba(0,0,0,0.3))
li
&:hover
@include vertical-gradient(#f0f0fa, #eeeef6)
@include box-shadow(none)
position: relative
list-style-type: none
float: none
display: block
@ -873,10 +877,33 @@ $colour4: #8a89ba
cursor: pointer
&:hover
text-decoration: none
@include vertical-gradient(#f0f0fa, #eeeef6)
@include box-shadow(none)
.oe_sidebar_delete_item
position: absolute
bottom: 1px
right: 4px
display: none
width: 12px
height: 12px
line-height: 12px
padding: 1px
color: #8786b7
line-height: 8px
text-align: center
font-weight: bold
text-shadow: 0 1px 1px white
&:hover
text-decoration: none
color: white
background: #8786b7
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4)
@include radius(2px)
&:hover
.oe_sidebar_delete_item
display: inline-block
.oe_sidebar
white-space: nowrap
.oe_dropdown_menu li
padding-right: 16px
.oe_sidebar_add_attachment
cursor: pointer
padding-left: 6px

View File

@ -857,7 +857,7 @@ instance.web.Sidebar = instance.web.Widget.extend({
self.items['files'] = attachments;
self.redraw();
this.$('.oe_sidebar_add_attachment .oe-binary-file').change(this.on_attachment_changed);
//this.$element.find('.oe-sidebar-attachment-delete').click(this.on_attachment_delete);
this.$element.find('.oe_sidebar_delete_item').click(this.on_attachment_delete);
},
on_attachment_changed: function(e) {
var $e = $(e.target);
@ -870,16 +870,14 @@ instance.web.Sidebar = instance.web.Widget.extend({
}
},
on_attachment_delete: function(e) {
return;
var self = this, $e = $(e.currentTarget);
var name = _.str.trim($e.parent().find('a.oe-sidebar-attachments-link').text());
if (confirm(_.str.sprintf(_t("Do you really want to delete the attachment %s?"), name))) {
this.rpc('/web/dataset/unlink', {
model: 'ir.attachment',
ids: [parseInt($e.attr('data-id'))]
}, function(r) {
$e.parent().remove();
self.do_notify("Delete an attachment", "The attachment '" + name + "' has been deleted");
var self = this;
e.preventDefault();
e.stopPropagation();
var self = this;
var $e = $(e.currentTarget);
if (confirm(_t("Do you really want to delete this attachment ?"))) {
(new instance.web.DataSet(this, 'ir.attachment')).unlink([parseInt($e.attr('data-id'), 10)]).then(function() {
self.do_attachement_update(self.dataset, self.model_id);
});
}
}

View File

@ -517,9 +517,7 @@
<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-raw="item.label"/>
</a>
<!--<a href="#" class="oe-sidebar-attachment-delete" t-att-data-id="attachment.id" t-attf-title="Delete the attachment #{attachment.name}">
<img t-att-src='_s + "/web/static/src/img/attachments-close.png"' width="15" height="15" border="0"/>
</a>-->
<a class="oe_sidebar_delete_item" t-att-data-id="item.id" title="Delete this attachment">x</a>
</li>
<li t-if="section.name == 'files'" class="oe_sidebar_add_attachment">
<t t-call="HiddenInputFile">