RSSchermer / ember-rl-dropdown

Dropdown components and mixin for Ember.
MIT License
15 stars 12 forks source link

Inline if Helper doesn't work with classes #11

Closed OlaviSau closed 8 years ago

OlaviSau commented 9 years ago

class="{{ if isGradeNotSelected 'disabled' }}" will render class="{{ if isGradeNotSelected 'disabled' }}

RSSchermer commented 9 years ago

Hey, sorry for the slow reply.

Could you perhaps share your complete dropdown template so I could use that for testing? E.g. something like:

{{#rl-dropdown-container class="dropdown"}}
  {{#rl-dropdown-toggle class="btn btn-default"}}
    Toggle <span class="caret"></span>
  {{/rl-dropdown-toggle}}

  {{#rl-dropdown tagName="ul" class="dropdown-menu" closeOnChildClick="a:link"}}
    <li><a href="#">Link 1</a></li>
    <li><a href="#">Link 2</a></li>
    <li><a href="#">Link 3</a></li>
  {{/rl-dropdown}}
{{/rl-dropdown-container}}

But with your inline if-helper added where you are trying to use it.

OlaviSau commented 9 years ago

The issue is probably not having an attr for class, but sadly I don't have my work pc atm. i'll try to get back on you asap :) I worked around it by using an disabled attr.

offirgolan commented 8 years ago

For anyone stuck with this, I found a quick working solution:

{{#rl-dropdown-toggle class=(concat "btn btn-primary" (if fooBar " disabled"))}}
     Select <span class="caret"></span>
{{/rl-dropdown-toggle}}
RSSchermer commented 8 years ago

Thanks @offirgolan, I finally understand the problem now.

I think that's probably the proper solution and I don't think there's anything the addon can do to help with that; it seems like a general Ember problem, rather than something specific to this addon.

Closing this for now, but if anyone has any further thoughts, feel free to reopen.

offirgolan commented 8 years ago

@RSSchermer I suggest adding a disabled option on the container. I know thats def. something we need in our app.

All disabled would do is set disabled="disabled" on the trigger, and prevent the dropdown from opening.

Just a thought 😸

RSSchermer commented 8 years ago

:+1: I like that and will look into it.

RSSchermer commented 8 years ago

A disabled attribute has been added to the rl-dropdown-toggle component as of version 0.10.0.