Fixed #398 Fixed issue with recording length and sort (GRN-83) (#426)

* Fixed issue with recording length and sort

* Made js run on any page with a table element on it

* Scrutinizer fix
This commit is contained in:
farhatahmad
2019-04-10 16:32:28 -04:00
committed by Jesus Federico
parent 95a98f6574
commit 4d648534f7
5 changed files with 25 additions and 27 deletions

View File

@ -121,7 +121,7 @@ $(document).on('turbolinks:load', function(){
submit_update_request({
setting: "rename_header",
room_name: element.find('#user-text').text(),
});
}, element.data('path'));
}
else if(element.is('#recording-title')){
submit_update_request({
@ -129,27 +129,15 @@ $(document).on('turbolinks:load', function(){
record_id: element.data('recordid'),
record_name: element.find('text').text(),
room_uid: element.data('room-uid'),
});
}, element.data('path'));
}
}
// 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
}
var submit_update_request = function(data, path){
// Send ajax request for update
$.ajax({
url: update_path,
url: path,
type: "PATCH",
data: data,
});