Added the ability to choose which room settings are available using env variable (#363)

This commit is contained in:
farhatahmad
2019-02-06 16:13:53 -05:00
committed by Jesus Federico
parent 5a7c3133da
commit d24e8fad14
6 changed files with 51 additions and 71 deletions

View File

@ -20,31 +20,6 @@ $(document).on('turbolinks:load', function(){
if(controller == "rooms" && action == "show" || controller == "rooms" && action == "update"){
// Set a room block rename event
var configure_room_block = function(room_block){
if(!room_block.is('#home_room_block')){
// Register a click event on each room_block rename dropdown
room_block.find('#rename-room-button').on('click', function(e){
room_block.find('#room-name-editable-input').on('focusout', function(){
submit_rename_request(room_block.find('.card'));
$(window).off('mousedown keydown');
});
room_block.click(function(linkEvent) { linkEvent.preventDefault(); });
room_block.find('#room-name').hide();
room_block.find('#room-name-editable').show();
room_block.find('#room-name-editable-input').select()
// Stop automatic refresh
e.preventDefault();
register_window_event(room_block.find('.card'), 'room-name-editable-input', null);
});
}
}
// Set a room header rename event
var configure_room_header = function(room_title){
@ -61,10 +36,10 @@ $(document).on('turbolinks:load', function(){
room_title.find('#user-text').fadeTo('medium', 0.7);
room_title.find('#user-text').attr("contenteditable", true);
room_title.find('#user-text').focus();
// Stop automatic refresh
e.preventDefault();
register_window_event(room_title, 'user-text', '#edit-room', 'edit-room');
}
@ -90,18 +65,18 @@ $(document).on('turbolinks:load', function(){
submit_rename_request(recording_title);
return;
}
recording_title.addClass("dotted_underline");
recording_title.fadeTo('medium', 0.7);
recording_title.find('text').attr("contenteditable", true);
recording_title.find('text').focus();
// Stop automatic refresh
e.preventDefault();
register_window_event(recording_title, 'recording-text', '#edit-record', 'edit-recordid');
}
recording_title.find('a').on('click focusout', function(e){
register_recording_title_event(e);
});
@ -126,12 +101,12 @@ $(document).on('turbolinks:load', function(){
$(clickEvent.target).data(edit_button_data) === element.find(edit_button_id).data(edit_button_data)){
return;
}
// Check if event is keydown and enter key is not pressed
if(clickEvent.type == "keydown" && clickEvent.which !== 13){
return;
}
clickEvent.preventDefault();
submit_rename_request(element);
@ -182,15 +157,9 @@ $(document).on('turbolinks:load', function(){
// Configure renaming for room header
configure_room_header(room_title);
// Configure renaming for room blocks
room_blocks.each(function(){
var room_block = $(this)
configure_room_block(room_block)
});
// Configure renaming for recording rows
recording_rows.each(function(){
var recording_title = $(this).find('#recording-title');
var recording_title = $(this).find('#recording-title');
configure_recording_row(recording_title);
});
}