#236 has been modified slightly. Needs testing on Different systems
This commit is contained in:
Jamie.Rees 2016-11-08 13:35:35 +00:00
commit 1c7fb2e93e
9 changed files with 160 additions and 37 deletions

View file

@ -436,3 +436,20 @@ label {
position: relative;
margin-right: 0; } }
#lightbox {
background-color: grey;
filter: alpha(opacity=50);
/* IE */
opacity: 0.5;
/* Safari, Opera */
-moz-opacity: 0.50;
/* FireFox */
top: 0px;
left: 0px;
z-index: 20;
height: 100%;
width: 100%;
background-repeat: no-repeat;
background-position: center;
position: absolute; }

File diff suppressed because one or more lines are too long

View file

@ -6,9 +6,7 @@ $info-colour: #5bc0de;
$warning-colour: #f0ad4e;
$danger-colour: #d9534f;
$success-colour: #5cb85c;
$i:
!important
;
$i:!important;
@media (min-width: 768px ) {
.row {
@ -551,4 +549,20 @@ $border-radius: 10px;
position: relative;
margin-right: 0;
}
}
}
#lightbox {
background-color: grey;
filter:alpha(opacity=50); /* IE */
opacity: 0.5; /* Safari, Opera */
-moz-opacity:0.50; /* FireFox */
top: 0px;
left: 0px;
z-index: 20;
height: 100%;
width: 100%;
background-repeat:no-repeat;
background-position:center;
position:absolute;
}

View file

@ -26,6 +26,7 @@
#endregion
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using MarkdownSharp;
@ -49,8 +50,7 @@ namespace PlexRequests.UI.Modules.Admin
SystemSettings = ss;
Security.HasPermissionsResponse(Permissions.Administrator);
Get["/status", true] = async (x, ct) => await Status();
Post["/save", true] = async (x, ct) => await Save();
@ -70,6 +70,28 @@ namespace PlexRequests.UI.Modules.Admin
settings.Status = status;
settings.BranchDropdown = new List<BranchDropdown>
{
new BranchDropdown
{
Name = EnumHelper<Branches>.GetDisplayValue(Branches.Stable),
Value = Branches.Stable,
Selected = settings.Branch == Branches.Stable
},
new BranchDropdown
{
Name = EnumHelper<Branches>.GetDisplayValue(Branches.EarlyAccessPreview),
Value = Branches.EarlyAccessPreview,
Selected = settings.Branch == Branches.EarlyAccessPreview
},
new BranchDropdown
{
Name = EnumHelper<Branches>.GetDisplayValue(Branches.Dev),
Value = Branches.Dev,
Selected = settings.Branch == Branches.Dev
},
};
return View["Status", settings];
}
@ -79,6 +101,9 @@ namespace PlexRequests.UI.Modules.Admin
await SystemSettings.SaveSettingsAsync(settings);
// Clear the cache
Cache.Remove(CacheKeys.LastestProductVersion);
return Response.AsJson(new JsonResponseModel { Result = true, Message = "Successfully Saved your settings"});
}

View file

@ -1,30 +1,43 @@
@using PlexRequests.UI.Helpers
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<PlexRequests.Core.SettingModels.SystemSettings>
@Html.Partial("_Sidebar")
<div id="lightbox" style="display:none"></div>
<div class="col-sm-8 col-sm-push-1">
<fieldset>
<legend>Status</legend>
<div class="form-group">
<label class="control-label">Version: </label>
<label class="control-label">@Model.Status.Version</label>
<label class="control-label">Current Version: </label>
<label class="control-label">@Model.Status.CurrentVersion</label>
</div>
@if (Model.Status.UpdateAvailable)
{
<div class="form-group">
<label class="control-label">New Version: </label>
<label class="control-label">@Model.Status.NewVersion</label>
</div>
}
<form id="mainForm" method="post" action="save">
<div class="form-group">
<div class="checkbox">
@if (Model.UseEarlyAccessPreviewBuilds)
{
<input type="checkbox" id="UseEarlyAccessPreviewBuilds" name="UseEarlyAccessPreviewBuilds" checked="checked"><label for="UseEarlyAccessPreviewBuilds">Use Early Access Preview Builds</label>
}
else
{
<input type="checkbox" id="UseEarlyAccessPreviewBuilds" name="UseEarlyAccessPreviewBuilds"><label for="UseEarlyAccessPreviewBuilds">Use Early Access Preview Builds</label>
}
<label for="select" class="control-label">Code Branch</label>
<div id="branches">
<select class="form-control form-control-custom" id="select">
@foreach (var b in Model.BranchDropdown)
{
if (b.Selected)
{
<option selected='selected' value='@b.Value'>@b.Name</option>
}
else
{
<option value='@b.Value'>@b.Name</option>
}
}
</select>
</div>
</div>
<button id="saveSettings" class="btn btn-success-outline">Save</button>
@ -68,6 +81,7 @@
e.preventDefault();
$('body').append("<i class=\"fa fa-spinner fa-spin fa-5x fa-fw\" style=\"position: absolute; top: 20%; left: 50%;\"></i>");
$('#autoUpdate').prop("disabled", "disabled");
document.getElementById("lightbox").style.display = "";
var count = 0;
setInterval(function () {
count++;
@ -92,10 +106,15 @@
$('#saveSettings').click(function (e) {
e.preventDefault();
var $form = $("#mainForm");
var branches = $("#branches option:selected").val();
var data = $form.serialize();
data = data + "&branch=" + branches;
$.ajax({
type: $form.prop("method"),
url: $form.prop("action"),
data: $form.serialize(),
data: data,
dataType: "json",
success: function (response) {
if (response.result === true) {