-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/templating #1142
Feat/templating #1142
Conversation
@@ -90,3 +91,34 @@ export const addClassOptionIfNone = ( | |||
options.classes = className; | |||
} | |||
}; | |||
|
|||
export function getVarsFromContent(content: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should probably just use njks and renderString in this case.
We should also add an environment variable ALLOW_USER_TEMPLATES
.
If true - we'll use njks and render. It looks like it could be pretty easy to inject script tags otherwise
711dabb
to
3d80617
Compare
@@ -90,3 +92,33 @@ export const addClassOptionIfNone = ( | |||
options.classes = className; | |||
} | |||
}; | |||
|
|||
export function getVarsForTemplate( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused?
@@ -420,8 +440,7 @@ export class PageControllerBase { | |||
} | |||
}); | |||
} | |||
|
|||
const viewModel = this.getViewModel(formData, num); | |||
const viewModel = this.getViewModel(formData, num, undefined, state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does state need to be passed in?
@@ -88,14 +88,15 @@ export class ComponentCollection { | |||
getViewModel( | |||
formData: FormData | FormSubmissionState, | |||
errors?: FormSubmissionErrors, | |||
conditions?: FormModel["conditions"] | |||
conditions?: FormModel["conditions"], | |||
state?: FormSubmissionState |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need state, now that formData should have it?
…string.prototype.matchAll
…s "exposeToContext" flag
31dfbf4
to
9ffa258
Compare
Description
Sometimes if there's a lot of variable content in a form, setting conditions for each bit of content can become cumbersome and in serious cases can cause the form runner to crash. Using templating we can allow conditional content to be populated based on previous user input without the need for conditions.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce
the testing if necessary.
Checklist: