Have client refetch settings on reconfig
authorJack Allnutt <jack@allnutt.eu>
Tue, 13 Aug 2013 21:58:11 +0000 (22:58 +0100)
committerJack Allnutt <jack@allnutt.eu>
Tue, 13 Aug 2013 21:58:11 +0000 (22:58 +0100)
client/assets/src/models/application.js
server/kiwi.js

index db5e6963d5eb0ada279b652dfd8002428baecece..b8832abdbaba9a47f7342bbbcd3ca556f4ef042a 100644 (file)
@@ -341,6 +341,8 @@ _kiwi.model.Application = function () {
 \r
 \r
         this.bindGatewayCommands = function (gw) {\r
+            var that = this;\r
+\r
             gw.on('onconnect', function (event) {\r
                 that.view.barsShow();\r
             });\r
@@ -407,6 +409,17 @@ _kiwi.model.Application = function () {
                 });\r
             })();\r
 \r
+            gw.on('kiwi:reconfig', function () {\r
+                $.getJSON(that.get('base_path') + '/assets/settings.json', function (data) {\r
+                    console.log(data);\r
+                    if (typeof data.kiwi_server !== 'undefined') {\r
+                        _kiwi.app.kiwi_server = data.kiwi_server;\r
+                    }\r
+\r
+                    that.server_settings = data.server_settings || {};\r
+                    that.translations = data.translations || {};\r
+                });\r
+            });\r
         };\r
 \r
 \r
index 42ef9bc5a41c5d672efaf1e554eed874f97c25d7..26d5b9c14b06d7c8c43b2636ac61f97f87a91bd6 100755 (executable)
@@ -146,6 +146,13 @@ global.servers = {
 
 
 
+config.on('loaded', function () {
+    for (var client in global.clients.clients) {
+        global.clients.clients[client].sendKiwiCommand('reconfig');
+    }
+});
+
+
 
 /*
  * Identd server