From 8d1836bd30f8d06b2da6e36c8b34d250b73847b0 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Tue, 21 Aug 2012 11:30:00 +0200 Subject: [PATCH] [IMP] improved loading messages bzr revid: nicolas.vanhoren@openerp.com-20120821093000-4jf6lh7a8o124hsd --- addons/web/static/src/js/coresetup.js | 25 +++++++++++++++++++++++++ addons/web/static/src/xml/base.xml | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js index 229a82a1784..a34a7dadd30 100644 --- a/addons/web/static/src/js/coresetup.js +++ b/addons/web/static/src/js/coresetup.js @@ -528,6 +528,14 @@ if ($.blockUI) { $.blockUI.defaults.css["background-color"] = ''; } +var messages_by_seconds = [ + [0, "Loading..."], + [30, "Still Loading..."], + [60, "Still Loading...
Please be patient."], + [120, "Hey, guess what?
It's still loading."], + [300, "You may not believe it,
but the application is actually loading..."], +]; + instance.web.Throbber = instance.web.Widget.extend({ template: "Throbber", start: function() { @@ -548,6 +556,23 @@ instance.web.Throbber = instance.web.Widget.extend({ left: 'auto' // Left position relative to parent in px }; this.spin = new Spinner(opts).spin(this.$element[0]); + this.start_time = new Date().getTime(); + this.act_message(); + }, + act_message: function() { + var self = this; + setTimeout(function() { + if (self.isDestroyed()) + return; + var seconds = (new Date().getTime() - self.start_time) / 1000; + var mes; + _.each(messages_by_seconds, function(el) { + if (seconds >= el[0]) + mes = el[1]; + }); + self.$(".oe_throbber_message").html(mes); + self.act_message(); + }, 1000); }, destroy: function() { if (this.spin) diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index c91c156a2c4..330a5b3928f 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1736,7 +1736,7 @@

-
Loading...
+