I’m writing some theme component that would do something arbitrary to a specific category. The only variable I have access in the component is the list of categories, and I’d like to extract the correct one.
c for c in category_list if c.slug == 'foobar'
With ember limited logic, I would need to do something like that:
{{#if category.slug == 'foobar'}}
which is not possible with vanilla version. We need to add a helper for something as low level as a comparison.
There are two main options:
- Add a method/property in the object that would return
True
only for the correct category in the list. - Register an
eq
helper, and is appears to me that this one is quite the standard.
{{#if (eq person "John")}} hello {{/if}}
So far, I don’t know how to do any of that for a theme component.
I’ve seen a post explaining how to do 2. it in a plugin but it seems irrelevant for a theme.
Can someone explain to me how to proceed?
And can the core team consider adding quite-standard logic helpers in discourse-commons? I’m sure the would be useful for a lot of low skill theme dev like me.