You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ombi/RequestPlex.UI/Views/Admin/Settings.cshtml

100 lines
3.6 KiB

9 years ago
@Html.Partial("/Admin/_Sidebar")
@{
9 years ago
int port;
if (Model.Port == null)
{
port = 3579;
}
else
{
port = Model.Port;
}
//if (string.IsNullOrEmpty(Model.PlexAuthToken))
//{
// Model.PlexAuthToken = string.Empty;
//}
9 years ago
}
<div class="col-sm-8">
9 years ago
<form class="form-horizontal" method="POST" id="mainForm">
9 years ago
<fieldset>
<legend>Request Plex Settings</legend>
<div class="form-group">
<label for="portNumber" class="col-lg-2 control-label">Port</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="portNumber" name="portNumber" placeholder="Port Number" value="@port">
</div>
</div>
9 years ago
<div class="form-group">
<label for="authToken" class="col-lg-2 control-label">Plex Authorization Token</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="authToken" name="authToken" placeholder="Plex Auth Token" value="@*@Model.PlexAuthToken*@">
</div>
</div>
<div class="form-group">
<label for="userpass" class="col-lg-2 control-label">Username and Password</label>
<div class="col-lg-4">
<input type="text" class="form-control" id="username" name="username" placeholder="Username">
</div>
<div class="col-lg-4 col-lg-push-1">
<input type="text" class="form-control" id="password" name="password" placeholder="Password">
</div>
</div>
<div class="form-group">
<div class="col-lg-10 col-lg-offset-2">
<button id="requestToken" class="btn btn-primary">Request Token</button>
</div>
</div>
<div>
<small>Please note, you will have to restart after changing these settings.</small>
</div>
9 years ago
<div class="form-group">
<div class="col-lg-10 col-lg-offset-2">
<button type="reset" class="btn btn-default">Cancel</button>
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</div>
</fieldset>
</form>
</div>
@if (Model.Errored)
{
<div class="alert alert-dismissible alert-danger">
<button type="button" class="close" data-dismiss="alert"><i class="fa fa-times"></i></button>
Please enter in a correct port number
</div>
9 years ago
}
<script>
$(function () {
$('#requestToken').click(function (e) {
var $form = $("#mainForm");
$.ajax({
type: $form.prop("method"),
url: "admin/requestauth",
data: $form.serialize(),
dataType: "json",
success: function (response) {
console.log(response);
if (response.Result === true) {
generateNotify("Success!", "success");
$('#authToken').val(response.authToken);
} else {
generateNotify(response.Message, "warning");
}
},
error: function (e) {
console.log(e);
generateNotify("Something went wrong!", "danger");
}
});
});
});
</script>