[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();
},
on_loaded: function(data) {
var self = this;
var self = this;
if (!data) {
throw new Error("No data provided.");
}
@ -284,21 +284,20 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
}
this._super();
},
on_invalidclick : function (){
on_wrong_click : function (){
var self = this;
var div = $("<div />", {id:"bounce"});
this.$element.find(".oe_form_field, .oe_form_group_cell").click(function (e) {
$(".oe_form_button_edit").wrap(div);
$("#bounce").addClass('oe_bounce_button_left');
var val_bounce = $(".oe_form_button_edit");
self.do_bounce(val_bounce);
e.stopImmediatePropagation();
});
$(".oe_form_button_edit").wrap(div);
$("#bounce").addClass('oe_bounce_button_left');
var edit_btn = $(".oe_form_button_edit");
self.do_bounce(edit_btn);
e.stopImmediatePropagation();
});
},
on_record_loaded: function(record) {
var self = this, set_values = [];
self.on_invalidclick();
var self = this, set_values = [];
self.on_wrong_click();
if (!record) {
this.do_warn("Form", "The record could not be found in the database.", true);
return $.Deferred().reject();
@ -599,8 +598,8 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
on_button_save: function() {
var self = this;
return this.do_save().then(function(result) {
self.set({mode: "view"});
self.on_invalidclick();
self.set({mode: "view"});
self.on_wrong_click();
});
},
@ -2996,7 +2995,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({
return def;
},
reload_current_view: function() {
var self = this;
var self = this;
return self.is_loaded = self.is_loaded.pipe(function() {
var active_view = self.viewmanager.active_view;
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"
}
self.row_clicked(e);
}
else{
if (opts.options.$buttons){
var bounce_val = $(opts.options.$buttons.find('.oe_list_add'));
self.view.do_bounce(bounce_val);
}
} else {
if (opts.options.$buttons) {
var create_btn = $(opts.options.$buttons.find('.oe_list_add'));
self.view.do_bounce(create_btn);
}
}
});
},
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.focus();
});
var click_column = this.$element.find('.oe_kanban_add');
click_column.addClass('oe_kanban_quick_create_bounce');
this.$records.click(function(e) {
var $target = e.target;
var $currenttarget = e.currentTarget;
if ($target == $currenttarget) {
self.view.do_bounce(click_column);
}
});
var add_btn = this.$element.find('.oe_kanban_add');
this.$records.click(function (ev) {
if (ev.target == ev.currentTarget) {
self.view.do_bounce(add_btn);
}
});
this.$records.find('.oe_kanban_show_more').click(this.do_show_more);
if (this.state.folded) {
this.do_toggle_fold();