mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 18:47:15 -07:00
parent
9121af0042
commit
7fc26df599
19 changed files with 262 additions and 128 deletions
|
@ -559,6 +559,25 @@ $(document).on("click", ".approve-with-quality", function (e) {
|
|||
|
||||
});
|
||||
|
||||
// Change root folder
|
||||
$(document).on("click", ".change-root-folder", function (e) {
|
||||
e.preventDefault();
|
||||
var $this = $(this);
|
||||
var $button = $this.parents('.btn-split').children('.change').first();
|
||||
var rootFolderId = e.target.id
|
||||
var $form = $this.parents('form').first();
|
||||
|
||||
if ($button.text() === " Loading...") {
|
||||
return;
|
||||
}
|
||||
|
||||
loadingButton($button.attr('id'), "success");
|
||||
|
||||
changeRootFolder($form, rootFolderId, function () {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
// Change Availability
|
||||
$(document).on("click", ".change", function (e) {
|
||||
|
@ -638,6 +657,37 @@ function approveRequest($form, qualityId, successCallback) {
|
|||
});
|
||||
}
|
||||
|
||||
function changeRootFolder($form, rootFolderId, successCallback) {
|
||||
|
||||
var formData = $form.serialize();
|
||||
if (rootFolderId) formData += ("&rootFolderId=" + rootFolderId);
|
||||
|
||||
$.ajax({
|
||||
type: $form.prop('method'),
|
||||
url: $form.prop('action'),
|
||||
data: formData,
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
|
||||
if (checkJsonResponse(response)) {
|
||||
if (response.message) {
|
||||
generateNotify(response.message, "success");
|
||||
} else {
|
||||
generateNotify("Success! Changed Root Path.", "success");
|
||||
}
|
||||
|
||||
if (successCallback) {
|
||||
successCallback();
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
generateNotify("Something went wrong!", "danger");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function denyRequest($form, successCallback) {
|
||||
|
||||
var formData = $form.serialize();
|
||||
|
@ -808,6 +858,9 @@ function buildRequestContext(result, type) {
|
|||
musicBrainzId: result.musicBrainzId,
|
||||
denied: result.denied,
|
||||
deniedReason: result.deniedReason,
|
||||
hasRootFolders: result.hasRootFolders,
|
||||
rootFolders: result.rootFolders,
|
||||
currentRootPath : result.currentRootPath
|
||||
};
|
||||
|
||||
return context;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue