From 62fa1695df46c36d13fa8f172efed7dc80e10bd1 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Tue, 15 Feb 2022 10:48:52 +0100 Subject: [PATCH] Add config to hide backoffice logo (#11999) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added config to hide backoffice logo * rename to hideBackofficeLogo * hide on mobile * add hideBackofficeLogo * implement hideBackofficeLogo + toggle on click * Updated c# syntax Co-authored-by: Niels Lyngsø --- .../UmbracoSettings/ContentElement.cs | 4 ++++ .../UmbracoSettings/IContentSection.cs | 5 +++-- .../application/umbappheader.directive.js | 20 +++++++++++++++---- .../application/umb-app-header.less | 7 +++++++ .../application/umb-app-header.html | 8 ++++++-- .../Editors/BackOfficeServerVariables.cs | 3 ++- 6 files changed, 38 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs index fba46c077e..a12aca1db2 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs @@ -46,6 +46,9 @@ namespace Umbraco.Core.Configuration.UmbracoSettings [ConfigurationProperty("loginLogoImage")] internal InnerTextConfigurationElement LoginLogoImage => GetOptionalTextElement("loginLogoImage", "assets/img/application/umbraco_logo_white.svg"); + [ConfigurationProperty("hideBackofficeLogo")] + internal InnerTextConfigurationElement HideBackOfficeLogo => GetOptionalTextElement("hideBackofficeLogo", false); + string IContentSection.NotificationEmailAddress => Notifications.NotificationEmailAddress; bool IContentSection.DisableHtmlEmail => Notifications.DisableHtmlEmail; @@ -71,5 +74,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings string IContentSection.LoginBackgroundImage => LoginBackgroundImage; string IContentSection.LoginLogoImage => LoginLogoImage; + bool IContentSection.HideBackOfficeLogo => HideBackOfficeLogo; } } diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/IContentSection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/IContentSection.cs index d8ef2bb943..fd301ab397 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/IContentSection.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/IContentSection.cs @@ -12,11 +12,11 @@ namespace Umbraco.Core.Configuration.UmbracoSettings IEnumerable ImageFileTypes { get; } IEnumerable ImageAutoFillProperties { get; } - + bool ResolveUrlsFromTextString { get; } IEnumerable Error404Collection { get; } - + string PreviewBadge { get; } MacroErrorBehaviour MacroErrorBehaviour { get; } @@ -36,5 +36,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings string LoginBackgroundImage { get; } string LoginLogoImage { get; } + bool HideBackOfficeLogo { get; } } } diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbappheader.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbappheader.directive.js index 6cf6dd85f3..01e199c572 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbappheader.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbappheader.directive.js @@ -16,6 +16,7 @@ { value: "assets/img/application/logo@2x.png" }, { value: "assets/img/application/logo@3x.png" } ]; + scope.hideBackofficeLogo = Umbraco.Sys.ServerVariables.umbracoSettings.hideBackofficeLogo; // when a user logs out or timesout evts.push(eventsService.on("app.notAuthenticated", function () { @@ -104,15 +105,26 @@ $timeout.cancel(scope.logoModal.timer); }; scope.hideLogoModal = function() { - $timeout.cancel(scope.logoModal.timer); - scope.logoModal.timer = $timeout(function () { - scope.logoModal.show = false; - }, 100); + if(scope.logoModal.show === true) { + $timeout.cancel(scope.logoModal.timer); + scope.logoModal.timer = $timeout(function () { + scope.logoModal.show = false; + }, 100); + } }; scope.stopClickEvent = function($event) { $event.stopPropagation(); }; + scope.toggleLogoModal = function() { + if(scope.logoModal.show) { + $timeout.cancel(scope.logoModal.timer); + scope.logoModal.show = false; + } else { + scope.showLogoModal(); + } + }; + } var directive = { diff --git a/src/Umbraco.Web.UI.Client/src/less/components/application/umb-app-header.less b/src/Umbraco.Web.UI.Client/src/less/components/application/umb-app-header.less index bb346fc402..6e1fa29eab 100644 --- a/src/Umbraco.Web.UI.Client/src/less/components/application/umb-app-header.less +++ b/src/Umbraco.Web.UI.Client/src/less/components/application/umb-app-header.less @@ -9,11 +9,18 @@ .umb-app-header__logo { margin-right: 30px; + flex-shrink: 0; button { img { height: 30px; } } + +} +@media (max-width: 1279px) { + .umb-app-header__logo { + display: none; + } } .umb-app-header__logo-modal { diff --git a/src/Umbraco.Web.UI.Client/src/views/components/application/umb-app-header.html b/src/Umbraco.Web.UI.Client/src/views/components/application/umb-app-header.html index 98b8d88869..ce3bf06853 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/application/umb-app-header.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/application/umb-app-header.html @@ -1,7 +1,11 @@
-