mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 21:33:15 -07:00
angular
This commit is contained in:
parent
a19e81d1f8
commit
c764d6557a
17 changed files with 765 additions and 513 deletions
44
PlexRequests.UI/Helpers/AngularViewBase.cs
Normal file
44
PlexRequests.UI/Helpers/AngularViewBase.cs
Normal file
|
@ -0,0 +1,44 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: EmptyViewBase.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using Nancy.ViewEngines.Razor;
|
||||
|
||||
namespace PlexRequests.UI.Helpers
|
||||
{
|
||||
public class AngularViewBase : NancyRazorViewBase
|
||||
{
|
||||
|
||||
public AngularViewBase()
|
||||
{
|
||||
Layout = "Shared/_AngularLayout.cshtml";
|
||||
}
|
||||
|
||||
public override void Execute()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -58,17 +58,18 @@ namespace PlexRequests.UI.Helpers
|
|||
settings.ThemeName = Themes.PlexTheme;
|
||||
}
|
||||
if (settings.ThemeName == "PlexBootstrap.css") settings.ThemeName = Themes.PlexTheme;
|
||||
if (settings.ThemeName == "OriginalBootstrap.css") settings.ThemeName = Themes.OriginalTheme;
|
||||
|
||||
sb.AppendLine($"<link rel=\"stylesheet\" href=\"{content}/Content/bootstrap.css\" type=\"text/css\"/>");
|
||||
if (settings.ThemeName == "OriginalBootstrap.css") settings.ThemeName = Themes.OriginalTheme;
|
||||
|
||||
sb.AppendLine($"<link rel=\"stylesheet\" href=\"{content}/Content/bootstrap.css\" type=\"text/css\"/>");
|
||||
sb.AppendLine($"<link rel=\"stylesheet\" href=\"{content}/Content/font-awesome.css\" type=\"text/css\"/>");
|
||||
sb.AppendLine($"<link rel=\"stylesheet\" href=\"{content}/Content/pace.min.css\" type=\"text/css\"/>");
|
||||
sb.AppendLine($"<link rel=\"stylesheet\" href=\"{content}/Content/awesome-bootstrap-checkbox.css\" type=\"text/css\"/>");
|
||||
sb.AppendLine($"<link rel=\"stylesheet\" href=\"{content}/Content/base.css\" type=\"text/css\"/>");
|
||||
sb.AppendLine($"<link rel=\"stylesheet\" href=\"{content}/Content/base.css\" type=\"text/css\"/>");
|
||||
sb.AppendLine($"<link rel=\"stylesheet\" href=\"{content}/Content/Themes/{settings.ThemeName}\" type=\"text/css\"/>");
|
||||
sb.AppendLine($"<link rel=\"stylesheet\" href=\"{content}/Content/datepicker.min.css\" type=\"text/css\"/>");
|
||||
|
||||
sb.AppendLine($"<script src=\"{content}/Content/jquery-2.2.1.min.js\"></script>");
|
||||
sb.AppendLine($"<script src=\"{content}/Content/app/app.js\"></script>");
|
||||
sb.AppendLine($"<script src=\"{content}/Content/handlebars.min.js\"></script>");
|
||||
sb.AppendLine($"<script src=\"{content}/Content/bootstrap.min.js\"></script>");
|
||||
sb.AppendLine($"<script src=\"{content}/Content/bootstrap-notify.min.js\"></script>");
|
||||
|
@ -104,8 +105,8 @@ namespace PlexRequests.UI.Helpers
|
|||
sb.AppendLine($"<script src=\"{content}/Content/requests-1.7.js\" type=\"text/javascript\"></script>");
|
||||
|
||||
return helper.Raw(sb.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static IHtmlString LoadIssueAssets(this HtmlHelpers helper)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
@ -116,8 +117,8 @@ namespace PlexRequests.UI.Helpers
|
|||
sb.AppendLine($"<script src=\"{content}/Content/issues.js\" type=\"text/javascript\"></script>");
|
||||
|
||||
return helper.Raw(sb.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static IHtmlString LoadIssueDetailsAssets(this HtmlHelpers helper)
|
||||
{
|
||||
var assetLocation = GetBaseUrl();
|
||||
|
@ -147,8 +148,8 @@ namespace PlexRequests.UI.Helpers
|
|||
if (!settings.CollectAnalyticData)
|
||||
{
|
||||
return helper.Raw(string.Empty);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var assetLocation = GetBaseUrl();
|
||||
var content = GetContentUrl(assetLocation);
|
||||
|
||||
|
@ -164,19 +165,19 @@ namespace PlexRequests.UI.Helpers
|
|||
if (!string.IsNullOrEmpty(content))
|
||||
{
|
||||
url = $"/{content}{url}";
|
||||
}
|
||||
}
|
||||
if (context.Request.Path == url)
|
||||
{
|
||||
returnString = $"<a class=\"list-group-item active\" href=\"{url}\">{title}</a>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnString = $"<a class=\"list-group-item\" href=\"{url}\">{title}</a>";
|
||||
}
|
||||
|
||||
return helper.Raw(returnString);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static IHtmlString GetNavbarUrl(this HtmlHelpers helper, NancyContext context, string url, string title, string fontIcon)
|
||||
{
|
||||
var returnString = string.Empty;
|
||||
|
@ -184,19 +185,19 @@ namespace PlexRequests.UI.Helpers
|
|||
if (!string.IsNullOrEmpty(content))
|
||||
{
|
||||
url = $"/{content}{url}";
|
||||
}
|
||||
}
|
||||
if (context.Request.Path == url)
|
||||
{
|
||||
returnString = $"<li class=\"active\"><a href=\"{url}\"><i class=\"fa fa-{fontIcon}\"></i> {title}</a></li>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnString = $"<li><a href=\"{url}\"><i class=\"fa fa-{fontIcon}\"></i> {title}</a></li>";
|
||||
}
|
||||
|
||||
return helper.Raw(returnString);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static IHtmlString GetNavbarUrl(this HtmlHelpers helper, NancyContext context, string url, string title, string fontIcon, string extraHtml)
|
||||
{
|
||||
var returnString = string.Empty;
|
||||
|
@ -204,12 +205,12 @@ namespace PlexRequests.UI.Helpers
|
|||
if (!string.IsNullOrEmpty(content))
|
||||
{
|
||||
url = $"/{content}{url}";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (context.Request.Path == url)
|
||||
{
|
||||
returnString = $"<li class=\"active\"><a href=\"{url}\"><i class=\"fa fa-{fontIcon}\"></i> {title} {extraHtml}</a></li>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnString = $"<li><a href=\"{url}\"><i class=\"fa fa-{fontIcon}\"></i> {title} {extraHtml}</a></li>";
|
||||
|
@ -218,33 +219,33 @@ namespace PlexRequests.UI.Helpers
|
|||
return helper.Raw(returnString);
|
||||
}
|
||||
|
||||
public static IHtmlString GetBaseUrl(this HtmlHelpers helper)
|
||||
{
|
||||
return helper.Raw(GetBaseUrl());
|
||||
}
|
||||
|
||||
public static IHtmlString GetBaseUrl(this HtmlHelpers helper)
|
||||
{
|
||||
return helper.Raw(GetBaseUrl());
|
||||
}
|
||||
|
||||
private static string GetBaseUrl()
|
||||
{
|
||||
return GetSettings().BaseUrl;
|
||||
}
|
||||
|
||||
private static PlexRequestSettings GetSettings()
|
||||
{
|
||||
{
|
||||
var returnValue = Cache.GetOrSet(CacheKeys.GetPlexRequestSettings, () =>
|
||||
{
|
||||
{
|
||||
var settings = Locator.Resolve<ISettingsService<PlexRequestSettings>>().GetSettings();
|
||||
return settings;
|
||||
});
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
private static string GetLinkUrl(string assetLocation)
|
||||
{
|
||||
return string.IsNullOrEmpty(assetLocation) ? string.Empty : $"{assetLocation}";
|
||||
}
|
||||
private static string GetContentUrl(string assetLocation)
|
||||
{
|
||||
return string.IsNullOrEmpty(assetLocation) ? string.Empty : $"/{assetLocation}";
|
||||
}
|
||||
|
||||
private static string GetLinkUrl(string assetLocation)
|
||||
{
|
||||
return string.IsNullOrEmpty(assetLocation) ? string.Empty : $"{assetLocation}";
|
||||
}
|
||||
private static string GetContentUrl(string assetLocation)
|
||||
{
|
||||
return string.IsNullOrEmpty(assetLocation) ? string.Empty : $"/{assetLocation}";
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue