wait for moderator with action cable

This commit is contained in:
Zachary Chai
2016-10-26 17:15:44 -04:00
parent 3aeef0a4cf
commit b701f2e9a6
16 changed files with 167 additions and 33 deletions

View File

@ -1,21 +1,35 @@
(function() {
var waitForModerator = function(url) {
$.get(url + "/wait", function(html) {
$(".center-panel-wrapper").html(html);
});
if (!Meeting.getInstance().getWaitingForMod()) {
Meeting.getInstance().setWaitingForMod(true);
if (Meeting.getInstance().getModJoined()) {
loopJoin();
}
}
};
var init = function() {
$('.meeting-join').click (function (event) {
var url = $('.meeting-url').val();
var name = $('.meeting-user-name').val();
$.ajax({
url : url + "/join?name=" + name,
dataType : "json",
type : 'GET',
success : function(data) {
Meeting.getInstance().setURL(url);
Meeting.getInstance().setName(name);
var jqxhr = Meeting.getInstance().getjoinMeetingURL();
jqxhr.done(function(data) {
if (data.messageKey === 'wait_for_moderator') {
waitForModerator(url);
} else {
$(location).attr("href", data.response.join_url);
},
error : function(xhr, status, error) {
},
complete : function(xhr, status) {
}
});
jqxhr.fail(function(xhr, status, error) {
console.info("meeting join failed");
});
});
$('.meeting-url-copy').click (function (e) {