[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

@ -92,7 +92,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
this._super(); this._super();
}, },
on_loaded: function(data) { on_loaded: function(data) {
var self = this; var self = this;
if (!data) { if (!data) {
throw new Error("No data provided."); throw new Error("No data provided.");
} }
@ -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();
@ -599,8 +598,8 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
on_button_save: function() { on_button_save: function() {
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();
}); });
}, },
@ -2996,7 +2995,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({
return def; return def;
}, },
reload_current_view: function() { reload_current_view: function() {
var self = this; var self = this;
return self.is_loaded = self.is_loaded.pipe(function() { return self.is_loaded = self.is_loaded.pipe(function() {
var active_view = self.viewmanager.active_view; var active_view = self.viewmanager.active_view;
var view = self.viewmanager.views[active_view].controller; var view = self.viewmanager.views[active_view].controller;

View File

@ -984,13 +984,12 @@ 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);
}
} }
}
}); });
}, },
row_clicked: function (e, view) { row_clicked: function (e, view) {

View File

@ -415,15 +415,12 @@ 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);
if (this.state.folded) { if (this.state.folded) {
this.do_toggle_fold(); this.do_toggle_fold();