ember-addons / bootstrap-for-ember

Bootstrap for Ember.js
http://ember-addons.github.io/bootstrap-for-ember
Apache License 2.0
704 stars 103 forks source link

bug in popover/tooltip #118

Open patricklx opened 10 years ago

patricklx commented 10 years ago

Hi. I compiled the latest version and found a small bug in the popover component. Probably happened when you converted to coffee-script... Problem is that the popover/tooltip always disappears on mouseleave, but should only happen when its sticky. Just a matter of indentation + some code to get the tip_id

I fixed it, BsPopoverComponent:

didInsertElement: ->
        @$tip = @$()
        name = Bootstrap.TooltipBoxManager.attribute
        name = "[" + name + "='" + @get("tip_id") + "']"
        @$element = $(name)
        @set "inserted", true

        tip_id = @get("tip_id")
        if @get("data.trigger") is "hover" and @get("data.sticky")
            @$().on "mouseenter", ->
                clearTimeout Bootstrap.TooltipBoxManager.timeout

            @$().on "mouseleave", ->
                Bootstrap.TooltipBoxManager.removeTip tip_id

        @$().find("img").load =>
            @afterRender()
c-nichols commented 10 years ago

+1. Necessary for the 'manual' trigger setting to work. Instead of adding the tip_id var, I think you could use a fat arrow? More coffeescript-y?