forked from External/greenlight
Added javascript needed to rename from all recordings (#390)
This commit is contained in:
parent
ef8fc2c0e4
commit
ab6655554c
|
@ -18,7 +18,7 @@ $(document).on('turbolinks:load', function(){
|
|||
var controller = $("body").data('controller');
|
||||
var action = $("body").data('action');
|
||||
|
||||
if(controller == "rooms" && action == "show" || controller == "rooms" && action == "update"){
|
||||
if(controller == "rooms" && action == "show" || controller == "rooms" && action == "update" || controller == "users" && action == "recordings"){
|
||||
|
||||
// Set a room header rename event
|
||||
var configure_room_header = function(room_title){
|
||||
|
@ -117,14 +117,7 @@ $(document).on('turbolinks:load', function(){
|
|||
|
||||
// Apply ajax request depending on the element that triggered the event
|
||||
var submit_rename_request = function(element){
|
||||
if(element.data('room-uid')){
|
||||
submit_update_request({
|
||||
setting: "rename_block",
|
||||
room_block_uid: element.data('room-uid'),
|
||||
room_name: element.find('#room-name-editable-input').val(),
|
||||
});
|
||||
}
|
||||
else if(element.is('#room-title')){
|
||||
if(element.is('#room-title')){
|
||||
submit_update_request({
|
||||
setting: "rename_header",
|
||||
room_name: element.find('#user-text').text(),
|
||||
|
@ -135,15 +128,28 @@ $(document).on('turbolinks:load', function(){
|
|||
setting: "rename_recording",
|
||||
record_id: element.data('recordid'),
|
||||
record_name: element.find('text').text(),
|
||||
room_uid: element.data('room-uid'),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Helper for submitting ajax requests
|
||||
var submit_update_request = function(data){
|
||||
var update_path = window.location.pathname
|
||||
|
||||
if ('room_uid' in data) {
|
||||
update_path = $("body").data('relative-root')
|
||||
|
||||
if (!update_path.endsWith("/")) {
|
||||
update_path += "/"
|
||||
}
|
||||
|
||||
update_path += data.room_uid
|
||||
}
|
||||
|
||||
// Send ajax request for update
|
||||
$.ajax({
|
||||
url: window.location.pathname,
|
||||
url: update_path,
|
||||
type: "PATCH",
|
||||
data: data,
|
||||
});
|
||||
|
|
|
@ -55,10 +55,7 @@ $(document).on('turbolinks:load', function(){
|
|||
// Display and update all fields related to creating a room in the createRoomModal
|
||||
$("#create-room").click(function(){
|
||||
$("#create-room-name").val("")
|
||||
|
||||
var relative_url_root = window.location.pathname.split("/")[1];
|
||||
|
||||
$("#createRoomModal form").attr("action", "/" + relative_url_root)
|
||||
$("#createRoomModal form").attr("action", $("body").data('relative-root'))
|
||||
updateDropdown($(".dropdown-item[value='default']"))
|
||||
$("#room_mute_on_join").prop("checked", false)
|
||||
|
||||
|
|
|
@ -73,7 +73,12 @@ class RoomsController < ApplicationController
|
|||
elsif params[:setting] == "rename_recording"
|
||||
@room.update_recording(params[:record_id], "meta_name" => params[:record_name])
|
||||
end
|
||||
redirect_to room_path
|
||||
|
||||
if request.referrer
|
||||
redirect_to request.referrer
|
||||
else
|
||||
redirect_to room_path
|
||||
end
|
||||
end
|
||||
|
||||
# POST /:room_uid
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||
</head>
|
||||
|
||||
<body class="app-background" data-controller="<%= params[:controller] %>" data-action="<%= params[:action] %>">
|
||||
<body class="app-background" data-controller="<%= params[:controller] %>" data-action="<%= params[:action] %>" data-relative-root="<%= Rails.configuration.relative_url_root || "/" %>">
|
||||
<%= render "shared/header" %>
|
||||
|
||||
<div class="wrapper">
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
<tr>
|
||||
<td>
|
||||
<div id="recording-title" class="form-inline edit_hover_class" data-recordid="<%= recording[:recordID] %>">
|
||||
<div id="recording-title" class="form-inline edit_hover_class" data-recordid="<%= recording[:recordID] %>" data-room-uid="<%= recording[:room_uid] %>">
|
||||
<text id='recording-text'>
|
||||
<% if recording[:metadata][:name] %>
|
||||
<%= recording[:metadata][:name] %>
|
||||
|
|
Loading…
Reference in New Issue