recording async update

This commit is contained in:
Zachary Chai
2016-10-31 17:39:22 -04:00
parent db9d06b72f
commit e400bf41e8
11 changed files with 100 additions and 13 deletions

View File

@ -0,0 +1,26 @@
(function() {
var initRooms = function() {
App.messages = App.cable.subscriptions.create({
channel: 'RecordingUpdatesChannel',
username: window.location.pathname.split('/').pop()
},
{
received: function(data) {
var btn = $("#recordings").find(".recording-update:disabled");
btn.data('published', data.published);
btn.find('i').removeClass(getPublishClass(!data.published));
btn.find('i').addClass(getPublishClass(data.published));
btn.prop("disabled", false);
}
});
};
$(document).on("turbolinks:load", function() {
if ($("body[data-controller=landing]").get(0)) {
if ($("body[data-action=rooms]").get(0)) {
initRooms();
}
}
});
}).call(this);