Implement channel registration

This commit is contained in:
calzoneman 2013-03-17 12:14:34 -05:00
parent 8fdf3f7cd7
commit 18d599a7aa
5 changed files with 83 additions and 6 deletions

View file

@ -15,6 +15,19 @@ function initCallbacks() {
.innerHTML = "<h3>Disconnected from server</h3>";
});
socket.on('channelNotRegistered', function() {
showChannelRegistration();
});
socket.on('registerChannel', function(data) {
if(data.success) {
$('#chregnotice').remove();
}
else {
alert(data.error);
}
});
socket.on('rank', function(data) {
if(data.rank >= Rank.Moderator) {
$('#playlist_controls').css("display", "block");

View file

@ -493,3 +493,17 @@ function updatePoll(data) {
i++;
});
}
function showChannelRegistration() {
var div = $('<div/>').addClass('alert alert-info').attr('id', 'chregnotice')
.insertAfter($('.row')[0]);
$('<button/>').addClass('close pull-right').text('×')
.appendTo(div)
.click(function() { div.remove(); });
$('<h3/>').text("This channel isn't registered").appendTo(div);
$('<button/>').addClass('btn btn-primary').text('Register it')
.appendTo(div)
.click(function() {
socket.emit('registerChannel');
});
}