forked from opencrvs/opencrvs-countryconfig
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #763 from opencrvs/configurable-handlebars
OCRVS 6085: Configurable handlebars
- Loading branch information
Showing
5 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/form/common/custom-validation-conditionals/custom-handlebars.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import * as Handlebars from 'handlebars' | ||
|
||
export const loud: Handlebars.HelperDelegate = function ( | ||
this: any, | ||
value: string | ||
) { | ||
return value.toUpperCase() | ||
} | ||
|
||
export const quiet: Handlebars.HelperDelegate = function ( | ||
this: any, | ||
value: string | ||
) { | ||
return value.toLowerCase() | ||
} |
14 changes: 14 additions & 0 deletions
14
src/form/common/custom-validation-conditionals/handlebars-handler.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { buildTypeScriptToJavaScript } from '@countryconfig/utils' | ||
import * as Hapi from '@hapi/hapi' | ||
import { join } from 'path' | ||
|
||
export async function handlebarsHandler( | ||
request: Hapi.Request, | ||
h: Hapi.ResponseToolkit | ||
) { | ||
return h | ||
.response( | ||
await buildTypeScriptToJavaScript(join(__dirname, 'custom-handlebars.ts')) | ||
) | ||
.type('text/javascript') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters