This commit is contained in:
2020-09-15 23:21:44 +00:00
parent 7bb9d775f1
commit 76ba6efbab
2 changed files with 33 additions and 30 deletions

View File

@@ -138,7 +138,7 @@ namespace AyaNova.Biz
System.IO.DirectoryInfo di = new DirectoryInfo(ReportFilesPath);
foreach (FileInfo file in di.EnumerateFiles())
{
if (file.Extension.ToLowerInvariant() == "ayrt")
if (file.Extension.ToLowerInvariant() == ".ayrt")
await r.ImportAsync(JObject.Parse(await File.ReadAllTextAsync(file.FullName)));
}
}

View File

@@ -13,33 +13,36 @@ async function ayPreRender(ayAllData) {
// Set our stock handlebars helpers
//
function ayRegisterHelpers() {
Handlebars.registerHelper("ayCaps", function (aString) {
return aString.toUpperCase();
Handlebars.registerHelper("ayCaps", function (ayValue) {
return ayValue.toUpperCase();
});
Handlebars.registerHelper("ayDateTime", function (timestamp) {
return utcDateToShortDateAndTimeLocalized(timestamp);
Handlebars.registerHelper("ayDateTime", function (ayValue) {
return utcDateToShortDateAndTimeLocalized(ayValue);
});
Handlebars.registerHelper("ayDate", function (timestamp) {
return utcDateToShortDateLocalized(timestamp);
Handlebars.registerHelper("ayDate", function (ayValue) {
return utcDateToShortDateLocalized(ayValue);
});
Handlebars.registerHelper("ayTime", function (timestamp) {
return utcDateToShortTimeLocalized(timestamp);
Handlebars.registerHelper("ayTime", function (ayValue) {
return utcDateToShortTimeLocalized(ayValue);
});
Handlebars.registerHelper("ayDecimal", function (value) {
return decimalLocalized(value);
Handlebars.registerHelper("ayDecimal", function (ayValue) {
return decimalLocalized(ayValue);
});
Handlebars.registerHelper("ayCurrency", function (value) {
return currencyLocalized(value);
Handlebars.registerHelper("ayCurrency", function (ayValue) {
return currencyLocalized(ayValue);
});
Handlebars.registerHelper("ayWiki", function (astring) {
Handlebars.registerHelper("ayWiki", function (ayValue) {
if(ayValue==null){
return "";
}
return new Handlebars.SafeString(
DOMPurify.sanitize(marked(astring, { breaks: true }))
DOMPurify.sanitize(marked(ayValue, { breaks: true }))
);
});
@@ -122,13 +125,13 @@ function ayRegisterHelpers() {
// short date and time
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString
//
function utcDateToShortDateAndTimeLocalized(value) {
if (!value) {
function utcDateToShortDateAndTimeLocalized(ayValue) {
if (!ayValue) {
return "";
}
//parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z")
let parsedDate = new Date(value);
let parsedDate = new Date(ayValue);
//is it a valid date?
if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {
@@ -149,13 +152,13 @@ function utcDateToShortDateAndTimeLocalized(value) {
// Turn a utc date into a displayable
// short date
//
function utcDateToShortDateLocalized(value) {
if (!value) {
function utcDateToShortDateLocalized(ayValue) {
if (!ayValue) {
return "";
}
//parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z")
let parsedDate = new Date(value);
let parsedDate = new Date(ayValue);
//is it a valid date?
if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {
@@ -174,13 +177,13 @@ function utcDateToShortDateLocalized(value) {
// Turn a utc date into a displayable
// short time
//
function utcDateToShortTimeLocalized(value) {
if (!value) {
function utcDateToShortTimeLocalized(ayValue) {
if (!ayValue) {
return "";
}
//parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z")
let parsedDate = new Date(value);
let parsedDate = new Date(ayValue);
//is it a valid date?
if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {
@@ -201,8 +204,8 @@ function utcDateToShortTimeLocalized(value) {
// CURRENCY LOCALIZATION
//
//
function currencyLocalized(value) {
if (!value) {
function currencyLocalized(ayValue) {
if (!ayValue) {
return "";
}
return new Intl.NumberFormat(
@@ -211,20 +214,20 @@ function currencyLocalized(value) {
style: "currency",
currency: AYMETA.ayClientMetaData.CurrencyName || "USD"
}
).format(value);
).format(ayValue);
}
///////////////////////////////////////////
// DECIMAL LOCALIZATION
//
//
function decimalLocalized(value) {
if (!value) {
function decimalLocalized(ayValue) {
if (!ayValue) {
return "";
}
return new Intl.NumberFormat(
AYMETA.ayClientMetaData.LanguageName || "en-US"
).format(value);
).format(ayValue);
}
//////////////////////////////////