More changes for the urlbase #72

This commit is contained in:
tidusjar 2016-04-15 14:23:32 +01:00
commit 51f8e2a95c
10 changed files with 90 additions and 50 deletions

View file

@ -1,4 +1,5 @@
@Html.Partial("_Sidebar")
@using PlexRequests.UI.Helpers
@Html.Partial("_Sidebar")
@{
int port;
if (Model.EmailPort == 0)
@ -106,6 +107,7 @@
<script>
$(function () {
var base = '@Html.GetBaseUrl()';
$('#save').click(function (e) {
e.preventDefault();
var port = $('#EmailPort').val();
@ -134,6 +136,8 @@
});
$('#testEmail').click(function (e) {
var url = createBaseUrl(base, '/admin/testemailnotification');
e.preventDefault();
var port = $('#EmailPort').val();
if (isNaN(port)) {
@ -144,7 +148,7 @@
$.ajax({
type: $form.prop("method"),
data: $form.serialize(),
url: '/admin/testemailnotification',
url: url,
dataType: "json",
success: function (response) {
if (response.result === true) {

View file

@ -1,4 +1,5 @@
@Html.Partial("_Sidebar")
@using PlexRequests.UI.Helpers
@Html.Partial("_Sidebar")
@{
int port;
if (Model.Port == 0)
@ -93,13 +94,14 @@
<script>
$(function() {
var base = '@Html.GetBaseUrl()';
$('#testHeadphones').click(function (e) {
e.preventDefault();
var $form = $("#mainForm");
var url = createBaseUrl(base, '/test/headphones');
$.ajax({
type: $form.prop("method"),
url: "/test/headphones",
url: url,
data: $form.serialize(),
dataType: "json",
success: function (response) {

View file

@ -1,4 +1,5 @@
@Html.Partial("_Sidebar")
@using PlexRequests.UI.Helpers
@Html.Partial("_Sidebar")
@{
int port;
if (Model.Port == 0)
@ -67,13 +68,14 @@
<script>
$(function () {
var base = '@Html.GetBaseUrl()';
$('#testPlex').click(function (e) {
e.preventDefault();
var url = createBaseUrl(base, '/test/plex');
var $form = $("#mainForm");
$.ajax({
type: $form.prop("method"),
url: "/test/plex",
url: url,
data: $form.serialize(),
dataType: "json",
success: function (response) {

View file

@ -1,4 +1,5 @@
@Html.Partial("_Sidebar")
@using PlexRequests.UI.Helpers
@Html.Partial("_Sidebar")
<div class="col-sm-8 col-sm-push-1">
<form class="form-horizontal" method="POST" id="mainForm">
@ -53,7 +54,7 @@
<script>
$(function () {
var base = '@Html.GetBaseUrl()';
$('#save').click(function (e) {
e.preventDefault();
@ -80,11 +81,12 @@
$('#testPushbullet').click(function (e) {
e.preventDefault();
var url = createBaseUrl(base, '/admin/testpushbulletnotification');
var $form = $("#mainForm");
$.ajax({
type: $form.prop("method"),
data: $form.serialize(),
url: '/admin/testpushbulletnotification',
url: url,
dataType: "json",
success: function (response) {
if (response.result === true) {

View file

@ -1,4 +1,5 @@
@Html.Partial("_Sidebar")
@using PlexRequests.UI.Helpers
@Html.Partial("_Sidebar")
<div class="col-sm-8 col-sm-push-1">
<form class="form-horizontal" method="POST" id="mainForm">
@ -54,6 +55,7 @@
<script>
$(function () {
var base = '@Html.GetBaseUrl()';
$('#save').click(function (e) {
e.preventDefault();
@ -80,11 +82,12 @@
$('#testPushover').click(function (e) {
e.preventDefault();
var url = createBaseUrl(base, '/admin/testpushovernotification');
var $form = $("#mainForm");
$.ajax({
type: $form.prop("method"),
data: $form.serialize(),
url: '/admin/testpushovernotification',
url: url,
dataType: "json",
success: function (response) {
if (response.result === true) {

View file

@ -1,4 +1,5 @@
@Html.Partial("_Sidebar")
@using PlexRequests.UI.Helpers
@Html.Partial("_Sidebar")
@{
int port;
if (Model.Port == 0)
@ -10,9 +11,17 @@
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" action="/admin" id="mainForm">
<form class="form-horizontal" method="POST" action="@formAction" id="mainForm">
<fieldset>
<legend>Request Plex Settings</legend>
<div class="form-group">
@ -72,7 +81,7 @@
else
{
<input type="checkbox" id="SearchForMusic" name="SearchForMusic"><text>Search for Music</text>
}
}
</label>
</div>
</div>
@ -147,13 +156,13 @@
</div>
@*<div class="form-group">
<label for="WeeklyRequestLimit" class="control-label">Weekly Request Limit</label>
<div>
<label>
<input type="number" id="WeeklyRequestLimit" name="WeeklyRequestLimit" class="form-control form-control-custom " value="@Model.WeeklyRequestLimit">
</label>
</div>
</div> //TODO: Need to implement this*@
<label for="WeeklyRequestLimit" class="control-label">Weekly Request Limit</label>
<div>
<label>
<input type="number" id="WeeklyRequestLimit" name="WeeklyRequestLimit" class="form-control form-control-custom " value="@Model.WeeklyRequestLimit">
</label>
</div>
</div> //TODO: Need to implement this*@
<div>
</div>

View file

@ -1,4 +1,5 @@
@Html.Partial("_Sidebar")
@using PlexRequests.UI.Helpers
@Html.Partial("_Sidebar")
@{
int port;
if (Model.Port == 0)
@ -103,7 +104,7 @@
<script>
$(function() {
var base = '@Html.GetBaseUrl()';
@if (!string.IsNullOrEmpty(Model.QualityProfile))
{
<text>
@ -148,9 +149,11 @@
$('#testSickRage').click(function (e) {
e.preventDefault();
var $form = $("#mainForm");
var url = createBaseUrl(base, '/test/sickrage');
$.ajax({
type: $form.prop("method"),
url: "/test/sickrage",
url: url,
data: $form.serialize(),
dataType: "json",
success: function (response) {

View file

@ -1,4 +1,5 @@
@Html.Partial("_Sidebar")
@using PlexRequests.UI.Helpers
@Html.Partial("_Sidebar")
@{
int port;
if (Model.Port == 0)
@ -223,13 +224,15 @@
}
});
});
var base = '@Html.GetBaseUrl()';
$('#testSonarr').click(function (e) {
e.preventDefault();
var $form = $("#mainForm");
var url = createBaseUrl(base, '/test/sonarr');
$.ajax({
type: $form.prop("method"),
url: "/test/sonarr",
url: url,
data: $form.serialize(),
dataType: "json",
success: function (response) {

View file

@ -1,5 +1,13 @@
@using Nancy.Security
@using PlexRequests.UI.Helpers
@{
var baseUrl = Html.GetBaseUrl();
var formAction = string.Empty;
if (!string.IsNullOrEmpty(baseUrl.ToHtmlString()))
{
formAction = "/" + baseUrl.ToHtmlString();
}
}
<div>
<h1>Requests</h1>
<h4>Below you can see yours and all other requests, as well as their download and approval status.</h4>
@ -181,7 +189,7 @@
<div class="col-sm-3 col-sm-push-3">
{{#if_eq admin true}}
{{#if_eq approved false}}
<form method="POST" action="/approval/approve" id="approve{{requestId}}">
<form method="POST" action="@formAction/approval/approve" id="approve{{requestId}}">
<input name="requestId" type="text" value="{{requestId}}" hidden="hidden" />
{{#if_eq hasQualities true}}
<div class="btn-group btn-split">
@ -201,17 +209,17 @@
{{/if_eq}}
</form>
{{/if_eq}}
<form method="POST" action="/requests/delete" id="delete{{requestId}}">
<form method="POST" action="@formAction/requests/delete" id="delete{{requestId}}">
<input name="Id" type="text" value="{{requestId}}" hidden="hidden" />
<button id="{{requestId}}" style="text-align: right" class="btn btn-sm btn-danger-outline delete" type="submit"><i class="fa fa-minus"></i> Remove</button>
</form>
<form method="POST" action="/requests/clearissues" id="clear{{requestId}}">
<form method="POST" action="@formAction/requests/clearissues" id="clear{{requestId}}">
<input name="Id" type="text" value="{{requestId}}" hidden="hidden" />
<button id="{{requestId}}" style="text-align: right" class="btn btn-sm btn-info-outline clear" type="submit"><i class="fa fa-check"></i> Clear Issues</button>
</form>
<form method="POST" action="/requests/changeavailability" id="change{{requestId}}">
<form method="POST" action="@formAction/requests/changeavailability" id="change{{requestId}}">
<input name="Id" type="text" value="{{requestId}}" hidden="hidden" />
{{#if_eq available true}}
<button id="{{requestId}}" custom-availibility="{{requestId}}" style="text-align: right" value="false" class="btn btn-sm btn-info-outline change" type="submit"><i class="fa fa-minus"></i> Mark Unavailable</button>
@ -222,7 +230,7 @@
{{/if_eq}}
<form method="POST" action="/requests/reportissue/" id="report{{requestId}}">
<form method="POST" action="@formAction/requests/reportissue/" id="report{{requestId}}">
<input name="requestId" type="text" value="{{requestId}}" hidden="hidden" />
<div class="dropdown">
<button id="{{requestId}}" class="btn btn-sm btn-primary-outline dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
@ -309,22 +317,22 @@
<div class="col-sm-2 col-sm-push-3">
{{#if_eq admin true}}
{{#if_eq approved false}}
<form method="POST" action="/approval/approve" id="approve{{requestId}}">
<form method="POST" action="@formAction/approval/approve" id="approve{{requestId}}">
<input name="requestId" type="text" value="{{requestId}}" hidden="hidden" />
<button id="{{requestId}}" custom-button="{{requestId}}" style="text-align: right" class="btn btn-sm btn-success-outline approve" type="submit"><i class="fa fa-plus"></i> Approve</button>
</form>
{{/if_eq}}
<form method="POST" action="/requests/delete" id="delete{{requestId}}">
<form method="POST" action="@formAction/requests/delete" id="delete{{requestId}}">
<input name="Id" type="text" value="{{requestId}}" hidden="hidden" />
<button id="{{requestId}}" style="text-align: right" class="btn btn-sm btn-danger-outline delete" type="submit"><i class="fa fa-minus"></i> Remove</button>
</form>
<form method="POST" action="/requests/clearissues" id="clear{{requestId}}">
<form method="POST" action="@formAction/requests/clearissues" id="clear{{requestId}}">
<input name="Id" type="text" value="{{requestId}}" hidden="hidden" />
<button id="{{requestId}}" style="text-align: right" class="btn btn-sm btn-info-outline clear" type="submit"><i class="fa fa-check"></i> Clear Issues</button>
</form>
<form method="POST" action="/requests/changeavailability" id="change{{requestId}}">
<form method="POST" action="@formAction/requests/changeavailability" id="change{{requestId}}">
<input name="Id" type="text" value="{{requestId}}" hidden="hidden" />
{{#if_eq available true}}
<button id="{{requestId}}" custom-availibility="{{requestId}}" style="text-align: right" value="false" class="btn btn-sm btn-info-outline change" type="submit"><i class="fa fa-minus"></i> Mark Unavailable</button>
@ -335,7 +343,7 @@
{{/if_eq}}
<form method="POST" action="/requests/reportissue/" id="report{{requestId}}">
<form method="POST" action="@formAction/requests/reportissue/" id="report{{requestId}}">
<input name="requestId" type="text" value="{{requestId}}" hidden="hidden" />
<div class="dropdown">
<button id="{{requestId}}" class="btn btn-sm btn-primary-outline dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
@ -369,7 +377,7 @@
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></button>
<h4 class="modal-title">Add issue/comment</h4>
</div>
<form method="POST" action="/requests/reportissuecomment" id="commentForm">
<form method="POST" action="@formAction/requests/reportissuecomment" id="commentForm">
<div class="modal-body">
<input name="requestId" class="requestId" type="text" hidden="hidden" value="" />
<textarea class="form-control form-control-custom" rows="3" id="commentArea" name="commentArea"></textarea>
@ -390,9 +398,9 @@
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></button>
<h4 class="modal-title">Add a note</h4>
</div>
<form method="POST" action="/requests/addnote" id="noteForm">
<form method="POST" action="@formAction/requests/addnote" id="noteForm">
<div class="modal-body">
<input name="requestId" class="noteId" type="text" hidden="hidden" value="" />
<input name="requestId" class="noteId" type="text" hidden="hidden" value=""/>
<textarea class="form-control form-control-custom" rows="3" id="noteArea" name="noteArea"></textarea>
</div>
<div class="modal-footer">
@ -403,6 +411,7 @@
</div>
</div>
</div>
<div id="baseUrl" value="@Html.GetBaseUrl()"></div>
@Html.LoadRequestAssets()