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/Shared/Partial/_Navbar.cshtml

150 lines
7.5 KiB

8 years ago
@using Nancy.Security
@using Nancy.Session
@using Nancy;
8 years ago
@using Ombi.Helpers
@using Ombi.UI.Helpers
8 years ago
@using Ombi.UI.Resources
8 years ago
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase
@{
var baseUrl = Html.GetBaseUrl();
var url = string.Empty;
if (!string.IsNullOrEmpty(baseUrl.ToHtmlString()))
{
url = "/" + baseUrl.ToHtmlString();
}
8 years ago
var title = UI.Layout_Title;
var customName = Html.GetApplicationName().ToHtmlString();
if (!string.IsNullOrEmpty(customName))
{
title = customName;
}
8 years ago
}
8 years ago
<nav class="navbar navbar-default navbar-fixed-top">
8 years ago
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
8 years ago
<a class="navbar-brand" href="@url/search">@title</a>
8 years ago
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
@Html.GetNavbarUrl(Context, "/search", UI.Layout_Search, "search")
@Html.GetNavbarUrl(Context, "/requests", UI.Layout_Requests, "plus-circle")
@Html.GetNavbarUrl(Context, "/issues", UI.Layout_Issues, "exclamation", "<span id=\"issueCount\"></span>")
@if (Html.IsAdmin())
{
@Html.GetNavbarUrl(Context, "/usermanagement", UI.Layout_Usermanagement, "users")
}
@if (Html.IsAdmin())
8 years ago
{
<li><a id="donate" href="https://www.paypal.me/PlexRequestsNet" target="_blank"><i class="fa fa-heart" style="color: red"></i> @UI.Layout_Donate</a></li>
8 years ago
}
<li id="customDonate" style="display: none"><a id="customDonateHref" href="https://www.paypal.me/PlexRequestsNet" target="_blank"><i class="fa fa-heart" style="color: yellow;"></i> <span id="donationText">@UI.Custom_Donation_Default</span></a></li>
8 years ago
</ul>
<ul class="nav navbar-nav navbar-right">
@if (!Html.IsLoggedIn(Context))
8 years ago
{
<li><a href="@url/login?redirect=@Context.Request.Path"><i class="fa fa-user"></i> @UI.Layout_Admin</a></li>
}
@if (Html.IsAdmin())
8 years ago
{
<li><a>@UI.Layout_Welcome @Context.CurrentUser.UserName</a></li>
8 years ago
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-user"></i> @UI.Layout_Admin <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="@url/admin"><i class="fa fa-cog"></i> @UI.Layout_Settings</a></li>
<li><a href="@url/changepassword"><i class="fa fa-key"></i> @UI.Layout_ChangePassword</a></li>
<li class="divider"></li>
<li><a href="@url/logout"><i class="fa fa-sign-out"></i> @UI.Layout_Logout</a></li>
</ul>
</li>
}
else if (Html.IsNormalUser()) // Logged in but not admin
8 years ago
{
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-user"></i> @UI.Layout_Welcome @Context.CurrentUser.UserName <span class="caret"></span></a>
8 years ago
<ul class="dropdown-menu" role="menu">
<li><a href="@url/changepassword"><i class="fa fa-key"></i> @UI.Layout_ChangePassword</a></li>
8 years ago
<li><a href="@url/logout"><i class="fa fa-sign-out"></i> @UI.Layout_Logout</a></li>
8 years ago
</ul>
</li>
}
else if (Html.IsPlexUser()) // Logged in but not admin
{
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-user"></i> @UI.Layout_Welcome @Context.CurrentUser.UserName <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="@url/logout"><i class="fa fa-sign-out"></i> @UI.Layout_Logout</a></li>
</ul>
</li>
8 years ago
}
else if (Html.IsLoggedIn(Context)) // Logged in but not admin
{
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-user"></i> @UI.Layout_Welcome @Context.Request.Session[SessionKeys.UsernameKey] <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="@url/logout"><i class="fa fa-sign-out"></i> @UI.Layout_Logout</a></li>
</ul>
</li>
}
8 years ago
8 years ago
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-language" aria-hidden="true"><span class="caret"></span></i></a>
<ul class="dropdown-menu" role="menu">
<li><a href="@url/culture?l=en&u=@Context.Request.Path">@UI.Layout_English</a></li>
<li><a href="@url/culture?l=fr&u=@Context.Request.Path">@UI.Layout_French</a></li>
<li><a href="@url/culture?l=nl&u=@Context.Request.Path">@UI.Layout_Dutch</a></li>
<li><a href="@url/culture?l=es&u=@Context.Request.Path">@UI.Layout_Spanish</a></li>
<li><a href="@url/culture?l=de&u=@Context.Request.Path">@UI.Layout_German</a></li>
<li><a href="@url/culture?l=da&u=@Context.Request.Path">@UI.Layout_Danish</a></li>
<li><a href="@url/culture?l=pt&u=@Context.Request.Path">@UI.Layout_Portuguese</a></li>
<li><a href="@url/culture?l=sv&u=@Context.Request.Path">@UI.Layout_Swedish</a></li>
<li><a href="@url/culture?l=it&u=@Context.Request.Path">@UI.Layout_Italian</a></li>
</ul>
<li />
8 years ago
</ul>
</div>
</div>
<script>
var base = '@Html.GetBaseUrl()';
var url = createBaseUrl(base, '/customDonation');
$.ajax({
url: url,
success: function (result) {
if (result.url && result.url != "donationLinkError") {
$("#customDonate").show();
var donateLink = $("#customDonateHref");
var donationText = $("#donationText");
donateLink.attr("href", result.url);
if (result.message) {
8 years ago
donationText.text(result.message);
}
}
},
error: function (xhr, status, error) {
console.log("error " + error);
$("#customDonate").hide();
}
});
</script>
8 years ago
<div id="updateAvailable" hidden="hidden"></div>
<div id="cacherRunning" hidden="hidden"></div>
</nav>