mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
#459 is almost done
This commit is contained in:
parent
0a97d9e256
commit
d843ab0ebb
11 changed files with 605 additions and 45 deletions
140
PlexRequests.UI/Content/wizard.js
vendored
Normal file
140
PlexRequests.UI/Content/wizard.js
vendored
Normal file
|
@ -0,0 +1,140 @@
|
|||
$(function () {
|
||||
|
||||
// Step 1
|
||||
$('#firstNext')
|
||||
.click(function () {
|
||||
loadArea("plexAuthArea");
|
||||
});
|
||||
|
||||
// Step 2 - Get the auth token
|
||||
$('#contentBody').on('click', '#requestToken', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var $form = $("#plexAuthForm");
|
||||
$.post($form.prop("action"), $form.serialize(), function (response) {
|
||||
if (response.result === true) {
|
||||
loadArea("plexArea");
|
||||
|
||||
if (response.port) {
|
||||
$('#portNumber').val(response.port);
|
||||
}
|
||||
if (response.ip) {
|
||||
$('#Ip').val(response.ip);
|
||||
}
|
||||
if (response.scheme) {
|
||||
response.scheme === "http" ? $('#Ssl').prop('checked', false) : $('#Ssl').prop('checked', true);
|
||||
}
|
||||
} else {
|
||||
generateNotify(response.message, "warning");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Step 3 - Submit the Plex Details
|
||||
$('#contentBody').on('click', '#submitPlex', function (e) {
|
||||
e.preventDefault();
|
||||
var $form = $("#plexForm");
|
||||
$.ajax({
|
||||
type: $form.prop("method"),
|
||||
url: $form.prop("action"),
|
||||
data: $form.serialize(),
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
if (response.result === true) {
|
||||
//Next
|
||||
loadArea("plexRequestArea");
|
||||
} else {
|
||||
generateNotify(response.message, "warning");
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Step 4 - Submit the Plex Request Settings
|
||||
$('#contentBody').on('click', '#submitPlexRequest', function (e) {
|
||||
e.preventDefault();
|
||||
var $form = $("#plexRequestForm");
|
||||
$.ajax({
|
||||
type: $form.prop("method"),
|
||||
url: $form.prop("action"),
|
||||
data: $form.serialize(),
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
if (response.result === true) {
|
||||
//Next
|
||||
loadArea("authArea");
|
||||
$('.userAuthTooltip').tooltipster({
|
||||
theme: 'borderless'
|
||||
});
|
||||
$('.passwordAuthTooltip').tooltipster({
|
||||
theme: 'borderless'
|
||||
});
|
||||
} else {
|
||||
generateNotify(response.message, "warning");
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Step 5 - Plex Requests Authentication Settings
|
||||
$('#contentBody').on('click', '#submitAuth', function (e) {
|
||||
e.preventDefault();
|
||||
var $form = $("#authForm");
|
||||
$.ajax({
|
||||
type: $form.prop("method"),
|
||||
url: $form.prop("action"),
|
||||
data: $form.serialize(),
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
if (response.result === true) {
|
||||
//Next
|
||||
loadArea("createAdminArea");
|
||||
} else {
|
||||
generateNotify(response.message, "warning");
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#contentBody').on('click', '#SearchForMovies', function () {
|
||||
var checked = this.checked;
|
||||
changeDisabledStatus($('#RequireMovieApproval'), checked, $('#RequireMovieApprovalLabel'));
|
||||
});
|
||||
|
||||
$('#contentBody').on('click', '#SearchForTvShows', function () {
|
||||
var checked = this.checked;
|
||||
changeDisabledStatus($('#RequireTvShowApproval'), checked, $('#RequireTvShowApprovalLabel'));
|
||||
});
|
||||
|
||||
$('#contentBody').on('click', '#SearchForMusic', function () {
|
||||
var checked = this.checked;
|
||||
changeDisabledStatus($('#RequireMusicApproval'), checked, $('#RequireMusicApprovalLabel'));
|
||||
});
|
||||
|
||||
function changeDisabledStatus($element, checked, $label) {
|
||||
if (checked) {
|
||||
$element.removeAttr("disabled");
|
||||
$label.css("color","");
|
||||
} else {
|
||||
$element.attr("disabled","disabled");
|
||||
$label.css("color", "grey");
|
||||
}
|
||||
}
|
||||
|
||||
function loadArea(templateId) {
|
||||
var $body = $('#contentBody');
|
||||
|
||||
var templateSource = $("#" + templateId).html();
|
||||
// Do some sliding?
|
||||
$body.html(templateSource);
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue