[MERGE] [IMP] improve bounce effect on readonly form

bzr revid: mat@openerp.com-20130529154243-5y5psw3eqce91uxe
This commit is contained in:
Martin Trigaux 2013-05-29 17:42:43 +02:00
commit c57336af8e
3 changed files with 35 additions and 1 deletions

View File

@ -2147,6 +2147,16 @@
.openerp .oe_form_readonly .oe_form .oe_form_field_date {
width: auto;
}
.openerp .oe_form_readonly .oe_form_field_boolean .boolean{
position: relative;
top: -14px;
width: 14px;
height: 14px;
z-index:10000;
/* IE needs a color in order for the layer to respond to mouse events */
backgroundColor: "#fff";
opacity: 0;
}
.openerp .oe_form_nosheet {
margin: 16px;
}

View File

@ -1701,6 +1701,15 @@ $sheet-padding: 16px
display: none !important
.oe_form .oe_form_field_date
width: auto
.oe_form_field_boolean.boolean
position: relative
top: -20px
width: 14px
height: 14px
z-index: 10000
// IE needs a color in order for the layer to respond to mouse events
backgroundColor: "#fff"
opacity: 0
// Sheet and padding
.oe_form_nosheet
margin: 16px

View File

@ -203,7 +203,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
this.has_been_loaded.resolve();
// Add bounce effect on button 'Edit' when click on readonly page view.
this.$el.find(".oe_form_group_row,.oe_form_field,label").on('click', function (e) {
this.$el.find(".oe_form_group_row,.oe_form_field,label,h1,.oe_title,.oe_notebook_page, .oe_list_content").on('click', function (e) {
if(self.get("actual_mode") == "view") {
var $button = self.options.$buttons.find(".oe_form_button_edit");
$button.openerpBounce();
@ -2743,6 +2743,7 @@ instance.web.form.FieldBoolean = instance.web.form.AbstractField.extend({
}, this));
var check_readonly = function() {
self.$checkbox.prop('disabled', self.get("effective_readonly"));
self.click_disabled_boolean();
};
this.on("change:effective_readonly", this, check_readonly);
check_readonly.call(this);
@ -2754,6 +2755,13 @@ instance.web.form.FieldBoolean = instance.web.form.AbstractField.extend({
focus: function() {
var input = this.$checkbox && this.$checkbox[0];
return input ? input.focus() : false;
},
click_disabled_boolean: function(){
var $disabled = this.$el.find('input[type=checkbox]:disabled');
$disabled.each(function (){
$(this).next('div').remove();
$(this).closest("span").append($('<div class="boolean"></div>'));
});
}
});
@ -5213,6 +5221,13 @@ instance.web.form.FieldBinaryImage = instance.web.form.FieldBinary.extend({
url = this.placeholder;
}
var $img = $(QWeb.render("FieldBinaryImage-img", { widget: this, url: url }));
$($img).click(function(e) {
if(self.view.get("actual_mode") == "view") {
var $button = $(".oe_form_button_edit");
$button.openerpBounce();
e.stopPropagation();
}
});
this.$el.find('> img').remove();
this.$el.prepend($img);
$img.load(function() {