Skip to content

Commit 62fa169

Browse files
Add config to hide backoffice logo (#11999)
* 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ø <[email protected]>
1 parent 0b0182f commit 62fa169

File tree

6 files changed

+38
-9
lines changed

6 files changed

+38
-9
lines changed

src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ internal class ContentElement : UmbracoConfigurationElement, IContentSection
4646
[ConfigurationProperty("loginLogoImage")]
4747
internal InnerTextConfigurationElement<string> LoginLogoImage => GetOptionalTextElement("loginLogoImage", "assets/img/application/umbraco_logo_white.svg");
4848

49+
[ConfigurationProperty("hideBackofficeLogo")]
50+
internal InnerTextConfigurationElement<bool> HideBackOfficeLogo => GetOptionalTextElement("hideBackofficeLogo", false);
51+
4952
string IContentSection.NotificationEmailAddress => Notifications.NotificationEmailAddress;
5053

5154
bool IContentSection.DisableHtmlEmail => Notifications.DisableHtmlEmail;
@@ -71,5 +74,6 @@ internal class ContentElement : UmbracoConfigurationElement, IContentSection
7174
string IContentSection.LoginBackgroundImage => LoginBackgroundImage;
7275

7376
string IContentSection.LoginLogoImage => LoginLogoImage;
77+
bool IContentSection.HideBackOfficeLogo => HideBackOfficeLogo;
7478
}
7579
}

src/Umbraco.Core/Configuration/UmbracoSettings/IContentSection.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ public interface IContentSection : IUmbracoConfigurationSection
1212
IEnumerable<string> ImageFileTypes { get; }
1313

1414
IEnumerable<IImagingAutoFillUploadField> ImageAutoFillProperties { get; }
15-
15+
1616
bool ResolveUrlsFromTextString { get; }
1717

1818
IEnumerable<IContentErrorPage> Error404Collection { get; }
19-
19+
2020
string PreviewBadge { get; }
2121

2222
MacroErrorBehaviour MacroErrorBehaviour { get; }
@@ -36,5 +36,6 @@ public interface IContentSection : IUmbracoConfigurationSection
3636
string LoginBackgroundImage { get; }
3737

3838
string LoginLogoImage { get; }
39+
bool HideBackOfficeLogo { get; }
3940
}
4041
}

src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbappheader.directive.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
{ value: "assets/img/application/[email protected]" },
1717
{ value: "assets/img/application/[email protected]" }
1818
];
19+
scope.hideBackofficeLogo = Umbraco.Sys.ServerVariables.umbracoSettings.hideBackofficeLogo;
1920

2021
// when a user logs out or timesout
2122
evts.push(eventsService.on("app.notAuthenticated", function () {
@@ -104,15 +105,26 @@
104105
$timeout.cancel(scope.logoModal.timer);
105106
};
106107
scope.hideLogoModal = function() {
107-
$timeout.cancel(scope.logoModal.timer);
108-
scope.logoModal.timer = $timeout(function () {
109-
scope.logoModal.show = false;
110-
}, 100);
108+
if(scope.logoModal.show === true) {
109+
$timeout.cancel(scope.logoModal.timer);
110+
scope.logoModal.timer = $timeout(function () {
111+
scope.logoModal.show = false;
112+
}, 100);
113+
}
111114
};
112115
scope.stopClickEvent = function($event) {
113116
$event.stopPropagation();
114117
};
115118

119+
scope.toggleLogoModal = function() {
120+
if(scope.logoModal.show) {
121+
$timeout.cancel(scope.logoModal.timer);
122+
scope.logoModal.show = false;
123+
} else {
124+
scope.showLogoModal();
125+
}
126+
};
127+
116128
}
117129

118130
var directive = {

src/Umbraco.Web.UI.Client/src/less/components/application/umb-app-header.less

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,18 @@
99

1010
.umb-app-header__logo {
1111
margin-right: 30px;
12+
flex-shrink: 0;
1213
button {
1314
img {
1415
height: 30px;
1516
}
1617
}
18+
19+
}
20+
@media (max-width: 1279px) {
21+
.umb-app-header__logo {
22+
display: none;
23+
}
1724
}
1825

1926
.umb-app-header__logo-modal {

src/Umbraco.Web.UI.Client/src/views/components/application/umb-app-header.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
<div>
22
<div class="umb-app-header">
3-
<div class="umb-app-header__logo">
4-
<button type="button" class="btn-reset" ng-click="showLogoModal()">
3+
<div class="umb-app-header__logo" ng-if="hideBackofficeLogo !== true">
4+
<button
5+
type="button"
6+
class="btn-reset"
7+
ng-click="toggleLogoModal()"
8+
>
59
<img
610
src="assets/img/application/umbraco_logomark_white.svg"
711
alt="Umbraco"

src/Umbraco.Web/Editors/BackOfficeServerVariables.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ internal Dictionary<string, object> BareMinimumServerVariables()
5757
var keepOnlyKeys = new Dictionary<string, string[]>
5858
{
5959
{"umbracoUrls", new[] {"authenticationApiBaseUrl", "serverVarsJs", "externalLoginsUrl", "currentUserApiBaseUrl", "iconApiBaseUrl"}},
60-
{"umbracoSettings", new[] {"allowPasswordReset", "imageFileTypes", "maxFileSize", "loginBackgroundImage", "loginLogoImage", "canSendRequiredEmail", "usernameIsEmail", "minimumPasswordLength", "minimumPasswordNonAlphaNum"}},
60+
{"umbracoSettings", new[] {"allowPasswordReset", "imageFileTypes", "maxFileSize", "loginBackgroundImage", "loginLogoImage", "canSendRequiredEmail", "usernameIsEmail", "minimumPasswordLength", "minimumPasswordNonAlphaNum", "hideBackofficeLogo"}},
6161
{"application", new[] {"applicationPath", "cacheBuster"}},
6262
{"isDebuggingEnabled", new string[] { }},
6363
{"features", new [] {"disabledFeatures"}}
@@ -356,6 +356,7 @@ internal Dictionary<string, object> GetServerVariables()
356356
{"allowPasswordReset", Current.Configs.Settings().Security.AllowPasswordReset},
357357
{"loginBackgroundImage", Current.Configs.Settings().Content.LoginBackgroundImage},
358358
{"loginLogoImage", Current.Configs.Settings().Content.LoginLogoImage },
359+
{"hideBackofficeLogo", Current.Configs.Settings().Content.HideBackOfficeLogo },
359360
{"showUserInvite", EmailSender.CanSendRequiredEmail},
360361
{"canSendRequiredEmail", EmailSender.CanSendRequiredEmail},
361362
{"showAllowSegmentationForDocumentTypes", false},

0 commit comments

Comments
 (0)