[IMP] Improved code for bounce effect on wrong click area.

bzr revid: jra@tinyerp.com-20120711065000-jf3x8xca67jbsdzo
This commit is contained in:
Jiten (OpenERP) 2012-07-11 12:20:00 +05:30
parent ced66d4e23
commit 90eced57d2
3 changed files with 24 additions and 29 deletions

View File

@ -284,21 +284,20 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
} }
this._super(); this._super();
}, },
on_invalidclick : function (){ on_wrong_click : function (){
var self = this; var self = this;
var div = $("<div />", {id:"bounce"}); var div = $("<div />", {id:"bounce"});
this.$element.find(".oe_form_field, .oe_form_group_cell").click(function (e) { this.$element.find(".oe_form_field, .oe_form_group_cell").click(function (e) {
$(".oe_form_button_edit").wrap(div); $(".oe_form_button_edit").wrap(div);
$("#bounce").addClass('oe_bounce_button_left'); $("#bounce").addClass('oe_bounce_button_left');
var val_bounce = $(".oe_form_button_edit"); var edit_btn = $(".oe_form_button_edit");
self.do_bounce(val_bounce); self.do_bounce(edit_btn);
e.stopImmediatePropagation(); e.stopImmediatePropagation();
}); });
}, },
on_record_loaded: function(record) { on_record_loaded: function(record) {
var self = this, set_values = []; var self = this, set_values = [];
self.on_invalidclick(); self.on_wrong_click();
if (!record) { if (!record) {
this.do_warn("Form", "The record could not be found in the database.", true); this.do_warn("Form", "The record could not be found in the database.", true);
return $.Deferred().reject(); return $.Deferred().reject();
@ -600,7 +599,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
var self = this; var self = this;
return this.do_save().then(function(result) { return this.do_save().then(function(result) {
self.set({mode: "view"}); self.set({mode: "view"});
self.on_invalidclick(); self.on_wrong_click();
}); });
}, },

View File

@ -984,11 +984,10 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
throw "Could not find id in dataset" throw "Could not find id in dataset"
} }
self.row_clicked(e); self.row_clicked(e);
} } else {
else{ if (opts.options.$buttons) {
if (opts.options.$buttons){ var create_btn = $(opts.options.$buttons.find('.oe_list_add'));
var bounce_val = $(opts.options.$buttons.find('.oe_list_add')); self.view.do_bounce(create_btn);
self.view.do_bounce(bounce_val);
} }
} }
}); });

View File

@ -415,13 +415,10 @@ instance.web_kanban.KanbanGroup = instance.web.OldWidget.extend({
self.quick.appendTo($(".oe_kanban_group_list_header", self.$records)); self.quick.appendTo($(".oe_kanban_group_list_header", self.$records));
self.quick.focus(); self.quick.focus();
}); });
var click_column = this.$element.find('.oe_kanban_add'); var add_btn = this.$element.find('.oe_kanban_add');
click_column.addClass('oe_kanban_quick_create_bounce'); this.$records.click(function (ev) {
this.$records.click(function(e) { if (ev.target == ev.currentTarget) {
var $target = e.target; self.view.do_bounce(add_btn);
var $currenttarget = e.currentTarget;
if ($target == $currenttarget) {
self.view.do_bounce(click_column);
} }
}); });
this.$records.find('.oe_kanban_show_more').click(this.do_show_more); this.$records.find('.oe_kanban_show_more').click(this.do_show_more);