Skip to content

Commit

Permalink
Improved the status page with the suggestion from #29
Browse files Browse the repository at this point in the history
  • Loading branch information
tidusjar committed Mar 22, 2016
1 parent 8f7098d commit c4f5716
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 3 deletions.
4 changes: 3 additions & 1 deletion PlexRequests.Core/Models/StatusModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ public class StatusModel
{
public string Version { get; set; }
public bool UpdateAvailable { get; set; }
public int ReleasesBehind { get; set; }
public string UpdateUri { get; set; }
public string DownloadUri { get; set; }
public string ReleaseNotes { get; set; }
public string ReleaseTitle { get; set; }
}
}
6 changes: 5 additions & 1 deletion PlexRequests.Core/StatusChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ public StatusModel GetStatus()
{
model.UpdateAvailable = true;
model.UpdateUri = latestRelease.Result.HtmlUrl;
}
}

model.ReleaseNotes = latestRelease.Result.Body;
model.DownloadUri = latestRelease.Result.Assets[0].BrowserDownloadUrl;
model.ReleaseTitle = latestRelease.Result.Name;

return model;
}
Expand Down
4 changes: 4 additions & 0 deletions PlexRequests.UI/Modules/AdminModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
using System.Dynamic;
using System.Linq;

using MarkdownSharp;

using Nancy;
using Nancy.Extensions;
using Nancy.ModelBinding;
Expand Down Expand Up @@ -376,6 +378,8 @@ private Negotiator Status()
{
var checker = new StatusChecker();
var status = checker.GetStatus();
var md = new Markdown();
status.ReleaseNotes = md.Transform(status.ReleaseNotes);
return View["Status", status];
}

Expand Down
4 changes: 4 additions & 0 deletions PlexRequests.UI/PlexRequests.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@
<HintPath>..\packages\Humanizer.Core.2.0.1\lib\dotnet\Humanizer.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MarkdownSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MarkdownSharp.1.13.0.0\lib\35\MarkdownSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Owin, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
<Private>True</Private>
Expand Down
12 changes: 11 additions & 1 deletion PlexRequests.UI/Views/Admin/Status.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<label class="control-label">Update Available: </label>
@if (Model.UpdateAvailable)
{
<label class="control-label"><a href="@Model.UpdateUri" target="_blank"><i class="fa fa-check"></i> Click Here!</a></label>
<label class="control-label"><a href="@Model.UpdateUri" target="_blank"><i class="fa fa-check"></i></a></label>
}
else
{
Expand All @@ -23,6 +23,16 @@

</div>

@if (Model.UpdateAvailable)
{
<h2>
<a href="@Model.DownloadUri">@Model.ReleaseTitle</a>
</h2>
<hr/>
<label>Release Notes:</label>
@Html.Raw(Model.ReleaseNotes)
}


</fieldset>
</div>
1 change: 1 addition & 0 deletions PlexRequests.UI/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<package id="FluentScheduler" version="3.1.46" targetFramework="net46" />
<package id="FluentValidation" version="6.2.1.0" targetFramework="net46" />
<package id="Humanizer.Core" version="2.0.1" targetFramework="net452" />
<package id="MarkdownSharp" version="1.13.0.0" targetFramework="net46" />
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net452" />
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net452" />
<package id="Microsoft.Owin.Host.HttpListener" version="3.0.1" targetFramework="net452" />
Expand Down

0 comments on commit c4f5716

Please sign in to comment.