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

Advise with helper/modifier #16055

Closed
rhettl opened this issue Jan 4, 2018 · 2 comments
Closed

Advise with helper/modifier #16055

rhettl opened this issue Jan 4, 2018 · 2 comments

Comments

@rhettl
Copy link

rhettl commented Jan 4, 2018

Hello All,

I'm attempting to add the bootstrap 4 tooltip popovers. bootstrap suggests

$(function () {
  $('[data-toggle="tooltip"]').tooltip()
})

I know I could just make it a live call on the body from app/routes/application.js#beforeModel, but I would rather make something to target specific elements instead of adding another watcher on the whole DOM.

I would like to do something like the below

  • <i class="fa fa-asterisk" {{tooltip}} title='Required'></i>
  • <i class="fa fa-asterisk" {{tooltip 'Required'}}></i>
  • <i class="fa fa-asterisk" {{tooltip direction='right'}} title='Required'></i>
  • <i class="fa fa-asterisk" {{tooltip 'Required' direction='right'}}></i>

At this time, I have no intent of making the content dynamic with <i class="fa fa-asterisk" {{tooltip tooltipString}}></i>

I would like this component/helper/modifier(?) to be like the {{action 'someAction'}} helper/modifier in the sense that it can live inside an element, add the attributes required, and not care what the element is or what else is happening with the element.

I've tracked down some of {{action ...}} in the ember/packages/... code and it led me to believe that {{action ...}} is not a helper but is an modifier and has a helper (if that even makes sense)

  1. It seems like action is a helper AND a modifier but I don't know what a modifier is or how to make one. Is there a place I can read more on this topic?
  2. If it's possible, how do I go about making this?
  3. is there a better way to do this? I'm likely overthinking this whole thing...
  4. are there any addons on EmberObserver which have code I may read to better understand how to do this?

To be honest, I'm still only a 4-6 months into Ember so any help in this would be amazing.
Also, I asked the slack channel, but I got no response. thus I turned here.

Thank you greatly 😄

@Serabe
Copy link
Member

Serabe commented Jan 5, 2018

Hello, @thettl. I am closing this since it is not an Emberjs bug. Please, go to #-help channel on Slack. If you are not registered, use the Slackin app.

It is not possible to create custom element modifiers, but there is an RFC for it emberjs/rfcs#112.

Thank you!

@Serabe Serabe closed this as completed Jan 5, 2018
@rhettl
Copy link
Author

rhettl commented Jan 5, 2018

Thank you for your information @Serabe, I will find alternate methods.

Though as mentioned

Also, I asked the slack channel, but I got no response. thus I turned here.

Have a wonderful day, 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants