Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin link #7851

Merged
merged 14 commits into from
Dec 14, 2020
Merged
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
@inherits OrchardCore.DisplayManagement.Razor.RazorPage<TModel>
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, OrchardCore.DisplayManagement
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
<script at="Foot">
$(function () {
var searchBox = $('#search-box');
$('[data-toggle="tooltip"]').tooltip();
// On each keypress filter the list of roles
searchBox.keyup(function (e) {
var search = $(this).val().toLowerCase();
Expand Down
18 changes: 10 additions & 8 deletions src/OrchardCore.Modules/OrchardCore.Users/Views/UserMenu.cshtml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
@inject IAuthorizationService AuthorizationService
<form asp-route-area="OrchardCore.Users" asp-controller="Account" asp-action="LogOff" method="post" class="form-inline">
<div class="dropdown">
<button class="btn btn-sm btn-light dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span><i class="fa fa-user" aria-hidden="true"></i></span>&nbsp;<span>@User.Identity.Name</span>
</button>
<div class="dropdown-menu dropdown-menu-right w-25">
<div class="dropdown">
<form asp-route-area="OrchardCore.Users" asp-controller="Account" asp-action="LogOff" method="post" class="form-inline">
<a class="nav-link dropdown-toggle" id="navbarDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" role="button">
<span><i class="fa fa-user" aria-hidden="true"></i>
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
<h6 class="dropdown-header">@T["Signed in as"]<span class="ml-1 font-weight-bold">@User.Identity.Name</span></h6>
<div class="dropdown-divider"></div>
@if (await AuthorizationService.AuthorizeAsync(User, Permissions.ManageOwnUserInformation))
{
<a class="dropdown-item" asp-area="OrchardCore.Users" asp-action="Edit" asp-controller="Admin" asp-route-returnUrl="@FullRequestPath"><span><i class="far fa-address-card" aria-hidden="true"></i></span>&nbsp;<span> @T["Profile"]</span></a>
}
<button type="submit" class="dropdown-item"><span><i class="fa fa-sign-out-alt" aria-hidden="true"></i></span>&nbsp;<span> @T["Log off"]</span></button>
</div>
</div>
</form>
</form>
</div>
3 changes: 3 additions & 0 deletions src/OrchardCore.Themes/TheAdmin/Assets/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,6 @@ function isLetter(str) {
function isNumber(str) {
return str.length === 1 && str.match(/[0-9]/i);
}

$('[data-toggle="collapse"]').collapse();
$('[data-toggle="tooltip"]').tooltip();
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
font-size: 14px;
}

.nav-item {
text-align: right;
}

.breadcrumb {
background-color: transparent;
margin-top: 1rem;
Expand All @@ -48,14 +44,8 @@
@extend .navbar-brand;
overflow: hidden;
height: 42px;
margin-left: 11px;
margin-right: 24px;
padding-left: 36px;
margin-left: 5px;
padding-top: 10px;
background-image: url(/TheAdmin/logo.png);
background-repeat: no-repeat;
background-position: left center;
background-size: 28px auto;
white-space: nowrap;
font-size: 14px;
transition: width 0.2s ease-in-out;
Expand All @@ -70,6 +60,12 @@
}
}

.ta-navbar-brand img {
margin-left: 5px;
margin-right: 11px;
width: 25px;
}

// When left-sidebar is compact nav brand is compacted too.
// It displays logo only, not text.
.left-sidebar-compact .ta-navbar-brand {
Expand All @@ -85,6 +81,10 @@
h1 {
left: 63px; // $left-navigation-width-when-compact + 15px
}

.nav-item {
margin-left: 10px;
}
}

.action-bar {
Expand Down
71 changes: 42 additions & 29 deletions src/OrchardCore.Themes/TheAdmin/Views/Layout.cshtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@inject DarkModeService DarkModeService;
@inject IOptions<AdminOptions> AdminOptions;
@{
var adminSettings = Site.As<AdminSettings>();
var darkMode = await DarkModeService.IsDarkModeAsync();
Expand Down Expand Up @@ -30,30 +31,42 @@
<body class="preload">
<div class="ta-wrapper">
<div class="ta-navbar-top navbar-expand-lg bg-primary">
<a class="ta-navbar-brand" href="@Url.Content("~/")" target="_blank">@Site.SiteName</a>
<a class="ta-navbar-brand" href="@Url.Content("~/" + AdminOptions.Value.AdminUrlPrefix)"><img src="/TheAdmin/logo.png" /><span>@Site.SiteName</span></a>
<div class="mr-auto">
@if(adminSettings.DisplayTitlesInTopbar)
@if (adminSettings.DisplayTitlesInTopbar)
{
@await RenderSectionAsync("Title", required: false)
@await RenderSectionAsync("Title", required: false)
}
</div>
<div id="navbar-links">
</div>
@await RenderSectionAsync("NavbarTop", required: false)
<button class="navbar-toggler pull-right" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="@T["Toggle navigation"]">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse flex-grow-0" id="navbarNav">
<ul class="navbar-nav">
@await RenderSectionAsync("NavbarLinks", required: false)
<li class="nav-item">
@if (adminSettings.DisplayDarkMode)
{
<a id="btn-darkmode" class="nav-link" data-toggle="tooltip" title="@(darkMode ? T["Light mode"] : T["Dark mode"])" role="button">
@if (darkMode)
{
<i class="fas fa-sun"></i>
}
else
{
<i class="fas fa-moon"></i>
}
</a>
}
</li>
<li class="nav-item">
<a href="@Url.Content("~/")" class="nav-link" target="_blank" data-toggle="tooltip" title="@T["Visit Site"]"><i class="fa fa-external-link"></i></a>
</li>
<li class="nav-item">@await DisplayAsync(await New.UserMenu())</li>
</ul>
</div>
</div>
@await DisplayAsync(await New.UserMenu())
@if (adminSettings.DisplayDarkMode)
{
<a id="btn-darkmode" class="btn btn-sm btn-light ml-2" title="@T["Dark mode"]">
@if (darkMode)
{
<i class="fas fa-sun"></i>
}
else
{
<i class="fas fa-moon"></i>
}
</a>
}
</div>

<div id="ta-left-sidebar" class="d-flex flex-column justify-content-between align-items-stretch">
Expand All @@ -66,19 +79,19 @@
<div class="ta-content">
@await RenderSectionAsync("Header", required: false)
@await RenderSectionAsync("Messages", required: false)
@await RenderSectionAsync("Breadcrumbs", required: false)
@if(!adminSettings.DisplayTitlesInTopbar)
@await RenderSectionAsync("Breadcrumbs", required: false)
@if (!adminSettings.DisplayTitlesInTopbar)
{
@await RenderSectionAsync("Title", required: false)
@await RenderSectionAsync("Title", required: false)
}
@await RenderBodyAsync()
@await RenderBodyAsync()
</div>
</div>
</div>

@await RenderSectionAsync("Footer", required: false)
@await RenderSectionAsync("Footer", required: false)

<div id="confirmRemoveModalMetadata" data-title="@T["Delete"]" data-message="@T["Are you sure you want to remove this element?"]" data-ok-text="@T["Ok"]" data-cancel-text="@T["Cancel"]" data-ok-class="btn-danger" data-cancel-class="btn-secondary"></div>
<div id="confirmRemoveModalMetadata" data-title="@T["Delete"]" data-message="@T["Are you sure you want to remove this element?"]" data-ok-text="@T["Ok"]" data-cancel-text="@T["Cancel"]" data-ok-class="btn-danger" data-cancel-class="btn-secondary"></div>

<resources type="Footer" />
</body>
</html>
<resources type="Footer" />
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
@if (adminSettings.DisplayMenuFilter)
{
<script at="Foot">
$('[data-toggle="tooltip"]').tooltip();
$(document).bind('keydown', function (e) {
if (e.ctrlKey && e.shiftKey && e.which == 70) {
$('#filter').focus();
Expand Down
5 changes: 4 additions & 1 deletion src/OrchardCore.Themes/TheAdmin/Views/_ViewImports.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, OrchardCore.DisplayManagement
@addTagHelper *, OrchardCore.ResourceManagement
@using OrchardCore.Entities

@using Microsoft.Extensions.Options
@using OrchardCore.Admin
@using OrchardCore.Admin.Models
@using OrchardCore.Entities
@using OrchardCore.Themes.Services
5 changes: 4 additions & 1 deletion src/OrchardCore.Themes/TheAdmin/wwwroot/Scripts/TheAdmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7263,6 +7263,9 @@ function isLetter(str) {
function isNumber(str) {
return str.length === 1 && str.match(/[0-9]/i);
}

$('[data-toggle="collapse"]').collapse();
$('[data-toggle="tooltip"]').tooltip();
$('#btn-darkmode').click(function () {
if ($('html').attr('data-theme') === 'darkmode') {
$('html').attr('data-theme', 'default');
Expand Down Expand Up @@ -8919,4 +8922,4 @@ function persistAdminPreferences() {
expires: 360
});
}, 200);
}
}

Large diffs are not rendered by default.

62 changes: 30 additions & 32 deletions src/OrchardCore.Themes/TheAdmin/wwwroot/Styles/TheAdmin.css
Original file line number Diff line number Diff line change
Expand Up @@ -15666,10 +15666,6 @@
right: 275px; }
:root[data-theme='default'] .ta-navbar-top .nav-link {
font-size: 14px; }
[dir=ltr]:root[data-theme='default'] .ta-navbar-top .nav-item {
text-align: right; }
[dir=rtl]:root[data-theme='default'] .ta-navbar-top .nav-item {
text-align: left; }
[dir]:root[data-theme='default'] .ta-navbar-top .breadcrumb {
background-color: transparent;
margin-top: 1rem; }
Expand All @@ -15687,27 +15683,26 @@
font-size: 14px;
transition: width 0.2s ease-in-out; }
[dir]:root[data-theme='default'] .ta-navbar-brand {
padding-top: 10px;
background-image: url(/TheAdmin/logo.png);
background-repeat: no-repeat;
background-size: 28px auto; }
padding-top: 10px; }
[dir=ltr]:root[data-theme='default'] .ta-navbar-brand {
margin-left: 11px;
margin-right: 24px;
padding-left: 36px;
background-position: left center; }
margin-left: 5px; }
[dir=rtl]:root[data-theme='default'] .ta-navbar-brand {
margin-right: 11px;
margin-left: 24px;
padding-right: 36px;
background-position: right center; }
margin-right: 5px; }
[dir=ltr]:root[data-theme='default'] .ta-navbar-brand span:first-child {
margin-left: 5px; }
[dir=rtl]:root[data-theme='default'] .ta-navbar-brand span:first-child {
margin-right: 5px; }
:root[data-theme='default'] .ta-navbar-brand span:last-child {
font-weight: bold;
color: #0078d4; }
:root[data-theme='default'] .ta-navbar-brand img {
width: 25px; }
[dir=ltr]:root[data-theme='default'] .ta-navbar-brand img {
margin-left: 5px;
margin-right: 11px; }
[dir=rtl]:root[data-theme='default'] .ta-navbar-brand img {
margin-right: 5px;
margin-left: 11px; }
:root[data-theme='default'] .left-sidebar-compact .ta-navbar-brand {
width: 30px;
height: 42px; }
Expand All @@ -15717,6 +15712,10 @@
left: 63px; }
[dir=rtl]:root[data-theme='default'] .left-sidebar-compact .ta-navbar-top h1 {
right: 63px; }
[dir=ltr]:root[data-theme='default'] .left-sidebar-compact .ta-navbar-top .nav-item {
margin-left: 10px; }
[dir=rtl]:root[data-theme='default'] .left-sidebar-compact .ta-navbar-top .nav-item {
margin-right: 10px; }
:root[data-theme='default'] .action-bar {
top: 3.3rem;
z-index: 1050; }
Expand Down Expand Up @@ -32298,10 +32297,6 @@
right: 275px; }
:root[data-theme='darkmode'] .ta-navbar-top .nav-link {
font-size: 14px; }
[dir=ltr]:root[data-theme='darkmode'] .ta-navbar-top .nav-item {
text-align: right; }
[dir=rtl]:root[data-theme='darkmode'] .ta-navbar-top .nav-item {
text-align: left; }
[dir]:root[data-theme='darkmode'] .ta-navbar-top .breadcrumb {
background-color: transparent;
margin-top: 1rem; }
Expand All @@ -32319,27 +32314,26 @@
font-size: 14px;
transition: width 0.2s ease-in-out; }
[dir]:root[data-theme='darkmode'] .ta-navbar-brand {
padding-top: 10px;
background-image: url(/TheAdmin/logo.png);
background-repeat: no-repeat;
background-size: 28px auto; }
padding-top: 10px; }
[dir=ltr]:root[data-theme='darkmode'] .ta-navbar-brand {
margin-left: 11px;
margin-right: 24px;
padding-left: 36px;
background-position: left center; }
margin-left: 5px; }
[dir=rtl]:root[data-theme='darkmode'] .ta-navbar-brand {
margin-right: 11px;
margin-left: 24px;
padding-right: 36px;
background-position: right center; }
margin-right: 5px; }
[dir=ltr]:root[data-theme='darkmode'] .ta-navbar-brand span:first-child {
margin-left: 5px; }
[dir=rtl]:root[data-theme='darkmode'] .ta-navbar-brand span:first-child {
margin-right: 5px; }
:root[data-theme='darkmode'] .ta-navbar-brand span:last-child {
font-weight: bold;
color: #0078d4; }
:root[data-theme='darkmode'] .ta-navbar-brand img {
width: 25px; }
[dir=ltr]:root[data-theme='darkmode'] .ta-navbar-brand img {
margin-left: 5px;
margin-right: 11px; }
[dir=rtl]:root[data-theme='darkmode'] .ta-navbar-brand img {
margin-right: 5px;
margin-left: 11px; }
:root[data-theme='darkmode'] .left-sidebar-compact .ta-navbar-brand {
width: 30px;
height: 42px; }
Expand All @@ -32349,6 +32343,10 @@
left: 63px; }
[dir=rtl]:root[data-theme='darkmode'] .left-sidebar-compact .ta-navbar-top h1 {
right: 63px; }
[dir=ltr]:root[data-theme='darkmode'] .left-sidebar-compact .ta-navbar-top .nav-item {
margin-left: 10px; }
[dir=rtl]:root[data-theme='darkmode'] .left-sidebar-compact .ta-navbar-top .nav-item {
margin-right: 10px; }
:root[data-theme='darkmode'] .action-bar {
top: 3.3rem;
z-index: 1050; }
Expand Down

Large diffs are not rendered by default.