Remotely/Server/Pages/Shared/_Layout.cshtml

123 lines
4.9 KiB
Plaintext

@using Microsoft.AspNetCore.Hosting
@using Microsoft.AspNetCore.Mvc.ViewEngines
@using Remotely.Server.Services
@using Remotely.Shared.Models
@inject IApplicationConfig AppConfig
@inject IWebHostEnvironment Environment
@inject ICompositeViewEngine Engine
@inject IDataService DataService
@{
var organizationName = "Remotely";
var user = DataService.GetUserByNameWithOrg(User?.Identity?.Name);
if (user is null)
{
var defaultOrg = await DataService.GetDefaultOrganization();
if (!string.IsNullOrWhiteSpace(defaultOrg?.OrganizationName))
{
organizationName = defaultOrg.OrganizationName;
}
}
else if (!string.IsNullOrWhiteSpace(user.Organization?.OrganizationName))
{
organizationName = user.Organization.OrganizationName;
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=550, user-scalable=no" />
<title>@ViewData["Title"] - Remotely</title>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="description" content="Remote access tools designed to get things done quickly." />
<link href="~/manifest.json" rel="manifest" />
<link rel="stylesheet" href="~/Identity/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/Identity/css/site.css" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
@if (user is RemotelyUser)
{
switch (user.UserOptions.Theme)
{
case Remotely.Shared.Enums.Theme.Light:
<link rel="stylesheet" href="~/css/Themes/yeti.min.css" />
<link rel="stylesheet" href="~/css/Themes/yeti.custom.css" asp-append-version="true" />
break;
case Remotely.Shared.Enums.Theme.Dark:
<link rel="stylesheet" href="~/css/Themes/darkly.min.css" />
<link rel="stylesheet" href="~/css/Themes/darkly.custom.css" asp-append-version="true" />
break;
default:
break;
}
}
else
{
if (AppConfig.Theme == Remotely.Shared.Enums.Theme.Light)
{
<link rel="stylesheet" href="~/css/Themes/yeti.min.css" />
<link rel="stylesheet" href="~/css/Themes/yeti.custom.css" asp-append-version="true" />
}
else
{
<link rel="stylesheet" href="~/css/Themes/darkly.min.css" />
<link rel="stylesheet" href="~/css/Themes/darkly.custom.css" asp-append-version="true" />
}
}
</head>
<body>
<header>
<nav class="navbar navbar-dark bg-primary navbar-expand-sm navbar-toggleable-sm mb-3">
<div class="container">
<a class="navbar-brand text-left" href="~/">
<div>
@organizationName
</div>
<div class="logo-subtitle">Support Portal</div>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
@{
var result = Engine.FindView(ViewContext, "_LoginPartial", isMainPage: false);
}
@if (result.Success)
{
await Html.RenderPartialAsync("_LoginPartial");
}
else
{
throw new InvalidOperationException("The default Identity UI layout requires a partial view '_LoginPartial' " +
"usually located at '/Pages/_LoginPartial' or at '/Views/Shared/_LoginPartial' to work. Based on your configuration " +
$"we have looked at it in the following locations: {System.Environment.NewLine}{string.Join(System.Environment.NewLine, result.SearchedLocations)}.");
}
</div>
</div>
</nav>
</header>
<div class="container">
<main role="main" class="pb-3">
@RenderBody()
</main>
</div>
<footer class="footer border-top text-muted mt-4">
<div class="container">
&copy; @DateTimeOffset.Now.Year - <a href="https://lucency.co">Translucency Software</a>
</div>
</footer>
<script src="~/Identity/lib/jquery/dist/jquery.min.js"></script>
<script src="~/Identity/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/Identity/js/site.js" asp-append-version="true"></script>
@RenderSection("Scripts", required: false)
</body>
</html>