Add config parameter customization->customer>logoDark for dark interface theme

This commit is contained in:
Julia Radzhabova 2021-10-06 00:29:27 +03:00
parent 4538b6dcb1
commit d985c18326
3 changed files with 16 additions and 3 deletions

View file

@ -115,7 +115,8 @@
mail: 'support@gmail.com',
www: 'www.superpuper.com',
info: 'Some info',
logo: ''
logo: '',
logoDark: '', // logo for dark theme
},
about: true,
feedback: {

View file

@ -196,6 +196,7 @@ define([
this.licData = data || true;
} else {
if (data && typeof data == 'object' && typeof(data.customer)=='object') {
this.licData = data;
var customer = data.customer;
$('#id-about-licensor-logo').addClass('hidden');
@ -229,9 +230,11 @@ define([
this.lblCompanyLic.text(value) :
this.lblCompanyLic.parents('tr').addClass('hidden');
(value = customer.logo) && value.length ?
value = Common.UI.Themes.isDarkTheme() ? (customer.logoDark || customer.logo) : (customer.logo || customer.logoDark);
value.length ?
this.divCompanyLogo.html('<img src="'+value+'" style="max-width:216px; max-height: 35px;" />') :
this.divCompanyLogo.parents('tr').addClass('hidden');
value.length && Common.NotificationCenter.on('uitheme:changed', this.changeLogo.bind(this));
} else {
this.cntLicenseeInfo.addClass('hidden');
this.cntLicensorInfo.addClass('margin-bottom');
@ -239,6 +242,15 @@ define([
}
},
changeLogo: function () {
if (!this.licData) return;
var customer = this.licData.customer;
if ( customer.logo && customer.logoDark && customer.logo !== customer.logoDark) {
this.divCompanyLogo.find('img').attr('src', Common.UI.Themes.isDarkTheme() ? (customer.logoDark || customer.logo) : (customer.logo || customer.logoDark));
}
},
show: function () {
if ( !this.rendered ) this.render();

View file

@ -631,7 +631,7 @@ define([
changeLogo: function () {
var value = this.branding;
if ( value && value.logo && (value.logo.image || value.logo.imageDark) && (value.logo.image !== value.logo.imageDark)) {
if ( value && value.logo && value.logo.image && value.logo.imageDark && (value.logo.image !== value.logo.imageDark)) { // change logo when image and imageDark are different
var image = Common.UI.Themes.isDarkTheme() ? (value.logo.imageDark || value.logo.image) : (value.logo.image || value.logo.imageDark);
$('#header-logo img').attr('src', image);
}