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/Ombi.UI/Views/Admin/Settings.cshtml

275 lines
11 KiB

@using Ombi.UI.Helpers
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<Ombi.Core.SettingModels.PlexRequestSettings>
@Html.Partial("Shared/Partial/_Sidebar")
@{
int port;
if (Model.Port == 0)
{
port = 3579;
}
else
{
port = Model.Port;
}
var baseUrl = Html.GetBaseUrl();
var formAction = "/admin";
if (!string.IsNullOrEmpty(baseUrl.ToHtmlString()))
{
formAction = "/" + baseUrl.ToHtmlString() + formAction;
}
}
<div class="col-sm-8 col-sm-push-1">
<form class="form-horizontal" method="POST" id="mainForm">
<fieldset>
<legend>Ombi Configuration</legend>
<div class="form-group">
<label for="portNumber" class="control-label">Port</label>
<div>
<input type="text" class="form-control form-control-custom " id="portNumber" name="Port" placeholder="Port Number" value="@port">
</div>
</div>
<small class="control-label">You will have to restart after changing the port.</small>
<div class="form-group">
<label for="BaseUrl" class="control-label">Base Url</label>
<div>
<input type="text" class="form-control form-control-custom " id="BaseUrl" name="BaseUrl" placeholder="Base Url" value="@Model.BaseUrl">
</div>
</div>
<small class="control-label">You will have to restart after changing the url base.</small>
<div class="form-group">
<label for="ApiKey" class="control-label">Api Key</label>
<div class="input-group">
<input type="text" readonly="readonly" class="form-control form-control-custom" id="ApiKey" name="ApiKey" value="@Model.ApiKey">
<div class="input-group-addon">
<div id="refreshKey" class="fa fa-refresh" title="Reset API Key"></div>
</div>
<div class="input-group-addon">
<div class="fa fa-clipboard" data-clipboard-action="copy" data-clipboard-target="#ApiKey"></div>
</div>
</div>
</div>
@Html.Checkbox(Model.SearchForMovies,"SearchForMovies","Search for Movies")
<div class="form-group">
<div class="checkbox">
@if (Model.SearchForTvShows)
{
<input type="checkbox" id="SearchForTvShows" name="SearchForTvShows" checked="checked"><label for="SearchForTvShows">Search for TV Shows</label>
}
else
{
<input type="checkbox" id="SearchForTvShows" name="SearchForTvShows"><label for="SearchForTvShows">Search for TV Shows</label>
}
</div>
</div>
<div class="form-group">
<div class="checkbox">
@if (Model.SearchForMusic)
{
<input type="checkbox" id="SearchForMusic" name="SearchForMusic" checked="checked"><label for="SearchForMusic">Search for Music</label>
}
else
{
<input type="checkbox" id="SearchForMusic" name="SearchForMusic"><label for="SearchForMusic">Search for Music</label>
}
</div>
</div>
<div class="form-group">
<div class="checkbox">
@if (Model.DisableTvRequestsByEpisode)
{
<input type="checkbox" id="DisableTvRequestsByEpisode" name="DisableTvRequestsByEpisode" checked="checked">
<label for="DisableTvRequestsByEpisode">Disable TV requests by episode</label>
}
else
{
<input type="checkbox" id="DisableTvRequestsByEpisode" name="DisableTvRequestsByEpisode"><label for="DisableTvRequestsByEpisode">Disable TV requests by episode</label>
}
</div>
</div>
<div class="form-group">
<div class="checkbox">
@if (Model.DisableTvRequestsBySeason)
{
<input type="checkbox" id="DisableTvRequestsBySeason" name="DisableTvRequestsBySeason" checked="checked">
<label for="DisableTvRequestsBySeason">Disable TV requests by season</label>
}
else
{
<input type="checkbox" id="DisableTvRequestsBySeason" name="DisableTvRequestsBySeason"><label for="DisableTvRequestsBySeason">Disable TV requests by season</label>
}
</div>
</div>
<div class="form-group">
<div class="checkbox">
@if (Model.IgnoreNotifyForAutoApprovedRequests)
{
<input type="checkbox" id="IgnoreNotifyForAutoApprovedRequests" name="IgnoreNotifyForAutoApprovedRequests" checked="checked">
<label for="IgnoreNotifyForAutoApprovedRequests">Do not send notifications for requests that don't require approval</label>
}
else
{
<input type="checkbox" id="IgnoreNotifyForAutoApprovedRequests" name="IgnoreNotifyForAutoApprovedRequests"><label for="IgnoreNotifyForAutoApprovedRequests">Do not send notifications for requests that don't require approval</label>
}
</div>
</div>
<div class="form-group">
<div class="checkbox">
@if (Model.CollectAnalyticData)
{
<input type="checkbox" id="CollectAnalyticData" name="CollectAnalyticData" checked="checked">
<label for="CollectAnalyticData">Allow us to collect anonymous analytical data e.g. browser used</label>
}
else
{
<input type="checkbox" id="CollectAnalyticData" name="CollectAnalyticData"><label for="CollectAnalyticData">Allow us to collect anonymous analytical data e.g. browser</label>
}
</div>
</div>
<div class="form-group">
<div class="checkbox">
@if (Model.EnableCustomDonationUrl)
{
<input type="checkbox" id="EnableCustomDonationUrl" name="EnableCustomDonationUrl" checked="checked">
<label for="EnableCustomDonationUrl">Enable custom donation link</label>
}
else
{
<input type="checkbox" id="EnableCustomDonationUrl" name="EnableCustomDonationUrl"><label for="EnableCustomDonationUrl">Enable custom donation link</label>
}
</div>
</div>
<div class="form-group">
<label for="CustomDonationUrl" class="control-label">Custom Donation URL</label>
<div>
<input type="text" class="form-control-custom form-control " id="CustomDonationUrl" name="CustomDonationUrl" placeholder="http://example.com" value="@Model.CustomDonationUrl">
</div>
</div>
<div class="form-group">
<label for="CustomDonationMessage" class="control-label">Donation Button Message</label>
<div>
<input type="text" class="form-control-custom form-control " id="CustomDonationMessage" name="CustomDonationMessage" placeholder="Donation button message" value="@Model.CustomDonationMessage">
</div>
</div>
<p class="form-group">If the request limits are set to 0 then no request limit is applied.</p>
<div class="form-group">
<label for="MovieWeeklyRequestLimit" class="control-label">Movie Weekly Request Limit</label>
<div>
<label>
<input type="number" id="MovieWeeklyRequestLimit" name="MovieWeeklyRequestLimit" class="form-control form-control-custom " value="@Model.MovieWeeklyRequestLimit">
</label>
</div>
</div>
<div class="form-group">
<label for="TvWeeklyRequestLimit" class="control-label">TV Show Weekly Request Limit</label>
<div>
<label>
<input type="number" id="TvWeeklyRequestLimit" name="TvWeeklyRequestLimit" class="form-control form-control-custom " value="@Model.TvWeeklyRequestLimit">
</label>
</div>
</div>
<div class="form-group">
<label for="AlbumWeeklyRequestLimit" class="control-label">Album Weekly Request Limit</label>
<div>
<label>
<input type="number" id="AlbumWeeklyRequestLimit" name="AlbumWeeklyRequestLimit" class="form-control form-control-custom " value="@Model.AlbumWeeklyRequestLimit">
</label>
</div>
</div>
<div>
</div>
<div class="form-group">
<div>
<button type="submit" id="save" class="btn btn-primary-outline">Submit</button>
</div>
</div>
</fieldset>
</form>
</div>
<script>
$(function () {
new Clipboard('.fa-clipboard');
$('#save').click(function (e) {
e.preventDefault();
var theme = $("#themes option:selected").val();
var $form = $("#mainForm");
var data = $form.serialize();
data = data + "&themeName=" + theme;
$.ajax({
type: $form.prop("method"),
data: data,
url: $form.prop("action"),
dataType: "json",
success: function (response) {
if (response.result === true) {
generateNotify("Success!", "success");
} else {
generateNotify(response.message, "warning");
}
},
error: function (e) {
console.log(e);
generateNotify("Something went wrong!", "danger");
}
});
});
$('#refreshKey').click(function(e) {
e.preventDefault();
var base = '@Html.GetBaseUrl()';
var url = createBaseUrl(base, '/admin/createapikey');
$.ajax({
type: "post",
url: url,
dataType: "json",
success: function(response) {
if (response) {
generateNotify("Success!", "success");
$('#ApiKey').val(response);
}
},
error: function(e) {
console.log(e);
generateNotify("Something went wrong!", "danger");
}
});
});
});
</script>