[FIX] potential bug in application initialization
authorniv-openerp <nicolas.vanhoren@openerp.com>
Mon, 2 Sep 2013 17:36:29 +0000 (19:36 +0200)
committerniv-openerp <nicolas.vanhoren@openerp.com>
Mon, 2 Sep 2013 17:36:29 +0000 (19:36 +0200)
bzr revid: nicolas.vanhoren@openerp.com-20130902173629-be1r67o5vtbgb9yp

addons/web/static/src/js/chrome.js

index 82cdf46..55ab5ec 100644 (file)
@@ -1307,13 +1307,8 @@ instance.web.WebClient = instance.web.Client.extend({
         this.on("change:title_part", this, this._title_changed);
         this._title_changed();
         return $.when(this._super()).then(function() {
-            if (jQuery.param !== undefined && jQuery.deparam(jQuery.param.querystring()).kitten !== undefined) {
-                $("body").addClass("kitten-mode-activated");
-                $("body").css("background-image", "url(" + instance.session.origin + "/web/static/src/img/back-enable.jpg" + ")");
-                if ($.blockUI) {
-                    var imgkit = Math.floor(Math.random() * 2 + 1);
-                    $.blockUI.defaults.message = '<img src="http://www.amigrave.com/loading-kitten/' + imgkit + '.gif" class="loading-kitten">';
-                }
+            if (jQuery.deparam !== undefined && jQuery.deparam(jQuery.param.querystring()).kitten !== undefined) {
+                self.to_kitten();
             }
             if (!self.session.session_is_valid()) {
                 self.show_login();
@@ -1322,6 +1317,15 @@ instance.web.WebClient = instance.web.Client.extend({
             }
         });
     },
+    to_kitten: function() {
+        this.kitten = true;
+        $("body").addClass("kitten-mode-activated");
+        $("body").css("background-image", "url(" + instance.session.origin + "/web/static/src/img/back-enable.jpg" + ")");
+        if ($.blockUI) {
+            var imgkit = Math.floor(Math.random() * 2 + 1);
+            $.blockUI.defaults.message = '<img src="http://www.amigrave.com/loading-kitten/' + imgkit + '.gif" class="loading-kitten">';
+        }
+    },
     /**
         Sets the first part of the title of the window, dedicated to the current action.
     */