From d05925722bfce54ddaf674c0280228b0fbaa2c5a Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 15 May 2014 17:18:13 +0200 Subject: [PATCH] Fix lock button status sync When there're several owners --- public/js/vroom.js | 10 ++++++++-- public/vroom.pl | 1 - templates/default/join.html.ep | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/public/js/vroom.js b/public/js/vroom.js index d416e7c..dfc5fc9 100644 --- a/public/js/vroom.js +++ b/public/js/vroom.js @@ -136,6 +136,10 @@ function initVroom(room) { $('.unauthEl').show(500); } } + if (data.locked == 'yes'){ + $('#lockLabel').addClass('btn-danger active'); + $('#lockButton').prop('checked', true); + } } }); } @@ -456,10 +460,12 @@ function initVroom(room) { // A few notif on password set/unset or lock/unlock webrtc.on('room_locked', function(data){ $('#lockLabel').addClass('btn-danger active'); + $('#lockButton').prop('checked', true); $.notify(sprintf(locale.ROOM_LOCKED_BY_s, stringEscape(peers[data.id].displayName)), 'info'); }); webrtc.on('room_unlocked', function(data){ $('#lockLabel').removeClass('btn-danger active'); + $('#lockButton').prop('checked', false); $.notify(sprintf(locale.ROOM_UNLOCKED_BY_s, stringEscape(peers[data.id].displayName)), 'info'); }); webrtc.on('password_protect_on', function(data){ @@ -591,11 +597,11 @@ function initVroom(room) { if (data.status == 'success'){ $.notify(data.msg, 'info'); if (action === 'lock'){ - $("#lockLabel").addClass('btn-danger'); + $("#lockLabel").addClass('btn-danger active'); webrtc.sendToAll('room_locked', {}); } else{ - $("#lockLabel").removeClass('btn-danger'); + $("#lockLabel").removeClass('btn-danger active'); webrtc.sendToAll('room_unlocked', {}); } } diff --git a/public/vroom.pl b/public/vroom.pl index e2b4e90..c31e20f 100755 --- a/public/vroom.pl +++ b/public/vroom.pl @@ -516,7 +516,6 @@ get '/(*room)' => sub { } # Now display the room page $self->render('join', - locked => $data->{locked} ? 'checked':'', turnPassword => $data->{token} ); }; diff --git a/templates/default/join.html.ep b/templates/default/join.html.ep index 9f85a32..7905a66 100644 --- a/templates/default/join.html.ep +++ b/templates/default/join.html.ep @@ -97,8 +97,8 @@