summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/coresetup.js
diff options
context:
space:
mode:
authorniv-openerp <nicolas.vanhoren@openerp.com>2012-08-16 18:11:19 +0200
committerniv-openerp <nicolas.vanhoren@openerp.com>2012-08-16 18:11:19 +0200
commita9ad90fa6795e329eeb3d752653b8861525518cf (patch)
treef9779598ef61208e082b166e752ea1a84f53c2e0 /addons/web/static/src/js/coresetup.js
parent8921c6e439b62465b8899e3ef6bb9046e5a20fff (diff)
[IMP] Added critical improvement to enable users to understand when the application is actually loading, by adding a "Loading..." label under the loading spinner. This was added after we realized that most people (I mean, al's father) don't understand that.
bzr revid: nicolas.vanhoren@openerp.com-20120816161119-qap032jpv2dzjlf1
Diffstat (limited to 'addons/web/static/src/js/coresetup.js')
-rw-r--r--addons/web/static/src/js/coresetup.js59
1 files changed, 36 insertions, 23 deletions
diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js
index d5b87d8a81d..229a82a1784 100644
--- a/addons/web/static/src/js/coresetup.js
+++ b/addons/web/static/src/js/coresetup.js
@@ -523,37 +523,50 @@ $.async_when = function() {
/** Setup blockui */
if ($.blockUI) {
$.blockUI.defaults.baseZ = 1100;
- $.blockUI.defaults.message = '<div class="oe_blockui_spin" style="height: 50px">';
+ $.blockUI.defaults.message = '<div class="oe_blockui_spin_container">';
$.blockUI.defaults.css.border = '0';
$.blockUI.defaults.css["background-color"] = '';
- $.blockUI.spinners = [];
}
+
+instance.web.Throbber = instance.web.Widget.extend({
+ template: "Throbber",
+ start: function() {
+ var opts = {
+ lines: 13, // The number of lines to draw
+ length: 7, // The length of each line
+ width: 4, // The line thickness
+ radius: 10, // The radius of the inner circle
+ rotate: 0, // The rotation offset
+ color: '#FFF', // #rgb or #rrggbb
+ speed: 1, // Rounds per second
+ trail: 60, // Afterglow percentage
+ shadow: false, // Whether to render a shadow
+ hwaccel: false, // Whether to use hardware acceleration
+ className: 'spinner', // The CSS class to assign to the spinner
+ zIndex: 2e9, // The z-index (defaults to 2000000000)
+ top: 'auto', // Top position relative to parent in px
+ left: 'auto' // Left position relative to parent in px
+ };
+ this.spin = new Spinner(opts).spin(this.$element[0]);
+ },
+ destroy: function() {
+ if (this.spin)
+ this.spin.stop();
+ this._super();
+ },
+});
+instance.web.Throbber.throbbers = [];
+
instance.web.blockUI = function() {
var tmp = $.blockUI.apply($, arguments);
- var target = $(".oe_blockui_spin")[0];
- var opts = {
- lines: 13, // The number of lines to draw
- length: 7, // The length of each line
- width: 4, // The line thickness
- radius: 10, // The radius of the inner circle
- rotate: 0, // The rotation offset
- color: '#FFF', // #rgb or #rrggbb
- speed: 1, // Rounds per second
- trail: 60, // Afterglow percentage
- shadow: false, // Whether to render a shadow
- hwaccel: false, // Whether to use hardware acceleration
- className: 'spinner', // The CSS class to assign to the spinner
- zIndex: 2e9, // The z-index (defaults to 2000000000)
- top: 'auto', // Top position relative to parent in px
- left: 'auto' // Left position relative to parent in px
- };
- var spinner = new Spinner(opts).spin(target);
- $.blockUI.spinners.push(spinner);
+ var throbber = new instance.web.Throbber();
+ instance.web.Throbber.throbbers.push(throbber);
+ throbber.appendTo($(".oe_blockui_spin_container"));
return tmp;
}
instance.web.unblockUI = function() {
- _.each($.blockUI.spinners, function(el) {
- el.stop();
+ _.each(instance.web.Throbber.throbbers, function(el) {
+ el.destroy();
});
return $.unblockUI.apply($, arguments);
}