Skip to content
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

ENH: Conditional rendering #486

Closed
Timo-Breumelhof opened this issue Sep 20, 2023 · 4 comments · Fixed by #1094
Closed

ENH: Conditional rendering #486

Timo-Breumelhof opened this issue Sep 20, 2023 · 4 comments · Fixed by #1094
Labels
enhancement New feature or request
Milestone

Comments

@Timo-Breumelhof
Copy link
Contributor

Is your feature request related to a problem?

Please describe.
In some cases it's difficult to style items that might be visible or not

Describe the solution you'd like

In this example, but it would apply to most [TOKENS] that conditionally render content

image

There might be a signature but sometimes there is not.

In this case when the signature is absent or empty, the padding of the signature div is still shown.
It would be nice if we could somehow prevent that.
I see two options:

  • Wrap the rendered HTML inside a div with a defined class. If nothing is rendered, the styling does not apply
  • Add support for conditional tokens like [HASSIGNATURE] [/HASSIGNATURE]

Suggestions?

@Timo-Breumelhof Timo-Breumelhof added enhancement New feature or request requires more information More information is required to duplicate or understand the issue. labels Sep 20, 2023
@Timo-Breumelhof Timo-Breumelhof added this to the 09.00.00 milestone Sep 20, 2023
@johnhenley
Copy link
Collaborator

@Timo-Breumelhof does this solve it?

.dcf-post-signature:empty {display:none;}

@WillStrohl
Copy link
Member

Do we want a more global token that can be used across other tokens as well? 🤔

@Timo-Breumelhof
Copy link
Contributor Author

@Timo-Breumelhof does this solve it?

.dcf-post-signature:empty {display:none;}

I think it does, but I think some conditions can still be useful

@johnhenley
Copy link
Collaborator

This should now be accomplished by using the "format" portion of the token. If the token value is empty (e.g. signature), the rest of the markup in the format isn't rendered.
Image

@johnhenley johnhenley removed the requires more information More information is required to duplicate or understand the issue. label Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants