[ADD] Add a icon for remove pictures from product and partner

This commit is contained in:
Mehul Mehta 2014-05-21 17:04:39 +05:30 committed by Thibault Delavallée
parent 6bc5218718
commit a6b9413a78
4 changed files with 11 additions and 8 deletions

View File

@ -2325,7 +2325,7 @@
.openerp .oe_form .oe_form_field_image .oe_form_field_image_controls { .openerp .oe_form .oe_form_field_image .oe_form_field_image_controls {
position: absolute; position: absolute;
top: 1px; top: 1px;
padding: 4px 0; padding: 6px 0;
width: 100%; width: 100%;
display: none; display: none;
text-align: center; text-align: center;

View File

@ -1902,7 +1902,7 @@ $sheet-padding: 16px
.oe_form_field_image_controls .oe_form_field_image_controls
position: absolute position: absolute
top: 1px top: 1px
padding: 4px 0 padding: 6px 0
width: 100% width: 100%
display: none display: none
text-align: center text-align: center

View File

@ -5506,9 +5506,13 @@ instance.web.form.FieldBinary = instance.web.form.AbstractField.extend(instance.
this._super.apply(this, arguments); this._super.apply(this, arguments);
}, },
initialize_content: function() { initialize_content: function() {
var self= this;
this.$el.find('input.oe_form_binary_file').change(this.on_file_change); this.$el.find('input.oe_form_binary_file').change(this.on_file_change);
this.$el.find('button.oe_form_binary_file_save').click(this.on_save_as); this.$el.find('button.oe_form_binary_file_save').click(this.on_save_as);
this.$el.find('.oe_form_binary_file_clear').click(this.on_clear); this.$el.find('.oe_form_binary_file_clear').click(this.on_clear);
this.$el.find('.oe_form_binary_file_edit').click(function(event){
self.$el.find('input.oe_form_binary_file').click();
});
}, },
on_file_change: function(e) { on_file_change: function(e) {
var self = this; var self = this;
@ -5676,8 +5680,6 @@ instance.web.form.FieldBinaryImage = instance.web.form.FieldBinary.extend({
return; return;
$img.css("max-width", "" + self.options.size[0] + "px"); $img.css("max-width", "" + self.options.size[0] + "px");
$img.css("max-height", "" + self.options.size[1] + "px"); $img.css("max-height", "" + self.options.size[1] + "px");
$img.css("margin-left", "" + (self.options.size[0] - $img.width()) / 2 + "px");
$img.css("margin-top", "" + (self.options.size[1] - $img.height()) / 2 + "px");
}); });
$img.on('error', function() { $img.on('error', function() {
$img.attr('src', self.placeholder); $img.attr('src', self.placeholder);

View File

@ -1310,15 +1310,16 @@
<t t-name="FieldBinaryImage"> <t t-name="FieldBinaryImage">
<span class="oe_form_field oe_form_field_image" t-att-style="widget.node.attrs.style"> <span class="oe_form_field oe_form_field_image" t-att-style="widget.node.attrs.style">
<div class="oe_form_field_image_controls oe_edit_only"> <div class="oe_form_field_image_controls oe_edit_only">
<t t-call="HiddenInputFile"> <i class="fa fa-pencil fa-1g pull-left col-md-offset-1 oe_form_binary_file_edit" title="Edit"/>
<t t-set="fileupload_id" t-value="widget.fileupload_id"/> <i class="fa fa-trash-o fa-1g col-md-offset-5 oe_form_binary_file_clear" title="Clear"/>
Edit
</t>
<div class="oe_form_binary_progress" style="display: none"> <div class="oe_form_binary_progress" style="display: none">
<img t-att-src='_s + "/web/static/src/img/throbber.gif"' width="16" height="16"/> <img t-att-src='_s + "/web/static/src/img/throbber.gif"' width="16" height="16"/>
<b>Uploading ...</b> <b>Uploading ...</b>
</div> </div>
</div> </div>
<t t-call="HiddenInputFile">
<t t-set="fileupload_id" t-value="widget.fileupload_id"/>
</t>
</span> </span>
</t> </t>
<t t-name="FieldBinaryImage-img"> <t t-name="FieldBinaryImage-img">