This commit is contained in:
2020-09-11 23:03:52 +00:00
parent b5185793c9
commit 49122a1212

View File

@@ -9,8 +9,6 @@ async function ayPreRender(ayAllData) {
} }
} }
/////////////////////////////////////// ///////////////////////////////////////
// Set our stock handlebars helpers // Set our stock handlebars helpers
// //
@@ -55,6 +53,25 @@ function ayRegisterHelpers() {
}); });
Handlebars.registerHelper("ayLogo", function (size) { Handlebars.registerHelper("ayLogo", function (size) {
if (this.ayServerMetaData) {
switch (size) {
case "small":
if (!this.ayServerMetaData.HasSmallLogo) {
return "";
}
break;
case "medium":
if (!this.ayServerMetaData.HasMediumLogo) {
return "";
}
break;
case "large":
if (!this.ayServerMetaData.HasLargeLogo) {
return "";
}
break;
}
}
var url = `${Handlebars.escapeExpression( var url = `${Handlebars.escapeExpression(
this.ayServerMetaData.ayApiUrl this.ayServerMetaData.ayApiUrl
)}logo/${size}`; )}logo/${size}`;
@@ -63,7 +80,11 @@ function ayRegisterHelpers() {
Handlebars.registerHelper("ayT", function (translationKey) { Handlebars.registerHelper("ayT", function (translationKey) {
if (ayTranslationKeyCache[translationKey] == undefined) { if (ayTranslationKeyCache[translationKey] == undefined) {
throw `ayT reporting helper error: the key "${translationKey}" is not present in the translation cache, did you forget to include it in your call to "await ayGetTranslations([KeyList]);" in ayPrepareData()\nTranslationKeyCache contains: ${JSON.stringify(ayTranslationKeyCache, null, 3)}?`; throw `ayT reporting helper error: the key "${translationKey}" is not present in the translation cache, did you forget to include it in your call to "await ayGetTranslations([KeyList]);" in ayPrepareData()\nTranslationKeyCache contains: ${JSON.stringify(
ayTranslationKeyCache,
null,
3
)}?`;
// return translationKey; // return translationKey;
} }
return ayTranslationKeyCache[translationKey]; return ayTranslationKeyCache[translationKey];