From 8fa6fad617c539057bfb4f11039348e46cd6f52e Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 23 Jan 2015 16:34:37 +0100 Subject: [PATCH] Move passwords hide/unhide code to the global scope So it's also available from the admin interface --- public/js/vroom.js | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/public/js/vroom.js b/public/js/vroom.js index aa87f3d..c2572d4 100644 --- a/public/js/vroom.js +++ b/public/js/vroom.js @@ -209,6 +209,27 @@ $('#joinPassConfirm').on('input', function() { $('#joinPassConfirm').parent().addClass('has-error'); } }); + +// Hide or show password fields +$('#joinPassSet').on('switchChange.bootstrapSwitch', function(event, state) { + if (state){ + $('#joinPassFields').show(200); + } + else{ + $('#joinPassFields').hide(200); + } +}); +$('#ownerPassSet').on('switchChange.bootstrapSwitch', function(event, state) { + if (state){ + $('#ownerPassFields').show(200); + } + else{ + $('#ownerPassFields').hide(200); + } +}); + + + // Used on the index page function initIndex(){ var room; @@ -1633,24 +1654,6 @@ function initVroom(room) { }); }); - // Hide or show password fields - $('#joinPassSet').on('switchChange.bootstrapSwitch', function(event, state) { - if (state){ - $('#joinPassFields').show(200); - } - else{ - $('#joinPassFields').hide(200); - } - }); - $('#ownerPassSet').on('switchChange.bootstrapSwitch', function(event, state) { - if (state){ - $('#ownerPassFields').show(200); - } - else{ - $('#ownerPassFields').hide(200); - } - }); - // Submit the configuration form $('#configureRoomForm').submit(function(e){ e.preventDefault();