From d9eeca2c90662b9390a5df1285f60960f0e5955e Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 22 Jan 2015 17:09:30 +0100 Subject: [PATCH] Correctly update switches when updating config --- public/js/vroom.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/public/js/vroom.js b/public/js/vroom.js index a05f19e..41cc4e6 100644 --- a/public/js/vroom.js +++ b/public/js/vroom.js @@ -508,18 +508,11 @@ function initVroom(room) { $('.unauthEl').hide(500); } } - if (data.locked == 'yes'){ - $('#lockedSet').bootstrapSwitch('state', true); - } - if (data.ask_for_name == 'yes'){ - $('#askForNameSet').bootstrapSwitch('state', true); - } - if (data.join_auth == 'yes'){ - $('#joinPassSet').bootstrapSwitch('state', true); - } - if (data.owner_auth == 'yes'){ - $('#ownerPassSet').bootstrapSwitch('state', true); - } + // Update config switches + $('#lockedSet').bootstrapSwitch('state', data.locked == 'yes'); + $('#askForNameSet').bootstrapSwitch('state', data.ask_for_name == 'yes'); + $('#joinPassSet').bootstrapSwitch('state', data.join_auth == 'yes'); + $('#ownerPassSet').bootstrapSwitch('state', data.owner_auth == 'yes'); } }); }