adopted-ember-addons/ember-collapsible-panel

disable click option

Luiz-N opened this issue · 5 comments

I have a use case where I want to disable the on-click listener on the panel-toggle component. I can overwrite the on-click property in the dom to equal false but then the console throws an error since the action attempts to treat it as a function.

I'm currently passing in a empty function (instead of a boolean) to avoid the error. Could add a "disableClick" property.

this.attrs.disableClick ? null : this.get("on-click")();

Willing to open up a PR if interested.

If you can pass in on-click=null I think that should suffice, right? We could update the action to check for the existence of the function before trying to invoke it (so we don't need to expand the API).

A PR would be great!

well what if the behavior needs to be dynamic via a computed property? on-click=allowClick Passing in true would not work

Gotcha. Ok let's add a disabled state to the toggle component

{{#p.toggle disabled=true}}

which doesn't fire the on-click handler. Could you PR w/test?

@Luiz-N did this work for you? Ok to close?

@ryanto yeah i'll get to the PR soon