You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Announcement templates allow you to add an optional form field. Currently you have two outcomes with such a setup.
Form field {{potato}} is filled in with SOMETEXT:
Bacon ipsum dolor amet salami bresaola: SOMETEXT
Form field {{potato}} is left blank (it leaves the variable reference in when the field is empty):
Bacon ipsum dolor amet salami bresaola: {{potato}}
Suggest adding in capability to parse if blocks like mustache templating supports:
{{#potato}}
Optional field filled in: {{potato}}
{{/potato}}
{{^potato}}
End of announcement.
{{/potato}}
The text was updated successfully, but these errors were encountered:
KashifSaadat
changed the title
[phub] Having optional announcement form fields currently doesn't add much value
[phub] Support if statements for optional form fields in announcement templates
Jul 28, 2017
Yeah, this is a good spot @KashifSaadat – something that I considered when initially building this. We have two options:
Make form fields set to required by default (for announcements in particular), or
Support conditional blocks, as you suggest
I wanted to avoid adding in a templating engine just for this (currently we just do a string find and replace). So option (2) is a bit more heavyweight, and we should only add it if there's a clear need / use case for it. Personally I'd like to avoid adding this :)
For now, option (1) seems to be a good stepping stone. The reason I didn't initially add this is because I DRYed up the fields-editor component from the support request templates and reused it for announcement templates. So we'd need to add a config option to this component to lock the required field or make it configurable (not difficult to do, just something that needs to be introduced with a bit of care).
Yup that makes sense, option 1 will be easiest and cleanest to implement. Supporting if blocks would only really be for some edge case scenarios, but I can't see a strong argument for it at the moment and people can just work around it by making a new template.
Announcement templates allow you to add an optional form field. Currently you have two outcomes with such a setup.
{{potato}}
is filled in withSOMETEXT
:{{potato}}
is left blank (it leaves the variable reference in when the field is empty):Suggest adding in capability to parse if blocks like mustache templating supports:
The text was updated successfully, but these errors were encountered: