set room name in html

This commit is contained in:
Zachary Chai 2016-11-01 17:18:39 -04:00
parent 7da04d3334
commit 0c4e264d7e
5 changed files with 9 additions and 5 deletions

View File

@ -3,7 +3,7 @@
var initRooms = function() {
App.messages = App.cable.subscriptions.create({
channel: 'ModeratorJoinsChannel',
username: window.location.pathname.split('/').pop()
username: getRoomName()
},
{
received: function(data) {

View File

@ -3,7 +3,7 @@
var initRooms = function() {
App.messages = App.cable.subscriptions.create({
channel: 'RecordingUpdatesChannel',
username: window.location.pathname.split('/').pop()
username: getRoomName()
},
{
received: function(data) {

View File

@ -112,7 +112,7 @@
targets: -1,
render: function(data, type, row) {
if (type === 'display') {
var roomName = window.location.pathname.split('/').pop();
var roomName = getRoomName();
var published = row.published;
var eye = getPublishClass(published);
return '<button type="button" class="btn btn-default recording-update" data-id="'+data+'" data-room="'+roomName+'" data-published="'+published+'">' +
@ -162,7 +162,7 @@
return;
}
table = recordingsTable.api();
$.get("/rooms/"+window.location.pathname.split('/').pop()+"/recordings", function(data) {
$.get("/rooms/"+getRoomName()+"/recordings", function(data) {
if (!data.is_owner) {
table.column(-1).visible( false );
}

View File

@ -4,6 +4,10 @@ $.ajaxSetup({
}
});
var getRoomName = function() {
return $(".page-wrapper.rooms").data('room');
}
var PUBLISHED_CLASSES = ['fa-eye-slash', 'fa-eye']
var getPublishClass = function(published) {

View File

@ -16,7 +16,7 @@
</div>
<% end %>
<div class="page-wrapper rooms">
<div class="page-wrapper rooms" data-room="<%= @user.username %>">
<div class="container-fluid">
<%= render 'shared/title', title: page_title %>