Fix lock button status sync

When there're several owners
master
Daniel Berteaud 11 years ago
parent d43ec95052
commit d05925722b
  1. 10
      public/js/vroom.js
  2. 1
      public/vroom.pl
  3. 4
      templates/default/join.html.ep

@ -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', {});
}
}

@ -516,7 +516,6 @@ get '/(*room)' => sub {
}
# Now display the room page
$self->render('join',
locked => $data->{locked} ? 'checked':'',
turnPassword => $data->{token}
);
};

@ -97,8 +97,8 @@
<center>
<div class="navbar-form">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default<%= $locked eq 'checked' ? ' btn-danger':'' %> help" id="lockLabel" data-toggle="tooltip" data-placement="bottom" title="<%=l 'PREVENT_TO_JOIN' %>">
<input type="checkbox" id="lockButton" <%= $locked %>>
<label class="btn btn-default help" id="lockLabel" data-toggle="tooltip" data-placement="bottom" title="<%=l 'PREVENT_TO_JOIN' %>">
<input type="checkbox" id="lockButton">
<span class="glyphicon glyphicon-lock">
</span>
</label>

Loading…
Cancel
Save