[IMP]Improve code for Bounce effect in listview

bzr revid: ggh@tinyerp.com-20120704055106-r3yuhcvadpel9mhy
This commit is contained in:
ggh-openerp
2012-07-04 11:21:06 +05:30
parent 07575c10f2
commit d26b36480b
3 changed files with 17 additions and 5 deletions
+4
View File
@@ -2215,4 +2215,8 @@
}
.kitten-mode-activated > * {
opacity: 0.7;
}
.openerp .oe_bounce_button_left {
float: left;
margin-right: 4px;
}
+7
View File
@@ -728,6 +728,12 @@ instance.web.Widget = instance.web.Class.extend(instance.web.WidgetMixin, {
}
return false;
},
/*
* In button to bounce effect
*/
do_bounce: function(element) {
element.effect("bounce", { times:3}, 500);
},
do_notify: function() {
if (this.getParent()) {
return this.getParent().do_notify.apply(this,arguments);
@@ -740,6 +746,7 @@ instance.web.Widget = instance.web.Class.extend(instance.web.WidgetMixin, {
}
return false;
},
rpc: function(url, data, success, error) {
var def = $.Deferred().then(success, error);
var self = this;
+6 -5
View File
@@ -285,8 +285,8 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
this.$element.find('.oe_list_buttons').replaceWith(this.$buttons);
}
this.$buttons.find('.oe_list_add')
.wrap("<div></div>")
.css({"float":"left","margin-right":"4px"})
.wrap("<div></div>")
.addClass('oe_bounce_button_left')
.click(this.proxy('do_add_record'))
.prop('disabled', grouped && this.options.editable);
this.$buttons.on('click', '.oe_list_button_import', function() {
@@ -982,9 +982,10 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
}
else{
if (opts.options.$buttons){
$(opts.options.$buttons.find('.oe_list_add')).effect("bounce", { times:5 }, 300);
}
}
var a = $(opts.options.$buttons.find('.oe_list_add'));
self.view.do_bounce(a);
}
}
});
},
row_clicked: function (e, view) {