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

Extend conditional rendering in infoclick to allow if not statements #1128

Closed
jacobwod opened this issue Jun 27, 2022 · 0 comments
Closed

Extend conditional rendering in infoclick to allow if not statements #1128

jacobwod opened this issue Jun 27, 2022 · 0 comments
Assignees
Labels
new feature Request for adding/changing functionality
Milestone

Comments

@jacobwod
Copy link
Member

Current situation

As of #669 we can write something like:

{{if {foo}}}
Value of foo is:
{foo}
{{/if}}

and:

{{if {foo}="bar"}}
Value of foo is "bar", check it out:
{foo}
{{/if}}

We can also compare two attributes if we wish:

{{if {foo}={anotherAttribute}}}
Value of foo equals to anotherAttribute's value
{foo}
{anotherAttribute}
{{/if}}

This is not enough for cases where we want to see if a value does not equal to something.

Proposed solution

Let's introduce another operator, != that will evaluate to true if its left side does not equal to its right side.

All the examples above will work, we can compare to hard-coded text values as well as between two attribute values:

{{if {foo}!="bar"}}
Value of foo is not "bar", check it out:
{foo}
{{/if}}

The quotation marks around bar are optional. This works exactly the same:

{{if {foo}!=bar}}
Value of foo is not "bar", check it out:
{foo}
{{/if}}

We can also compare two attributes if we wish:

{{if {foo}!={anotherAttribute}}}
Value of foo does not equal to anotherAttribute's value:
{foo}
{anotherAttribute}
{{/if}}
@jacobwod jacobwod added the new feature Request for adding/changing functionality label Jun 27, 2022
@jacobwod jacobwod added this to the 3.11 milestone Jun 27, 2022
@jacobwod jacobwod self-assigned this Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Request for adding/changing functionality
Projects
None yet
Development

No branches or pull requests

1 participant