0

In my Rails 4 app, inside my views, I use a lot of link_to helpers.

When I need to add a Bootstrap tooltip to a link, I do:

<%= link_to "Link text", model_path(@model), "data-toggle" => "tooltip", "data-placement" => "bottom", "title" => "Model View" %>

And, when I need to add a Bootstrap modal to a link, I do:

<%= link_to  "Link text", model_path(@model), :remote => true, 'data-toggle' =>  "modal", 'data-target' => '#modal-window' %>

Now, in one particular place in my app, I need to add BOTH a tooltip AND a modal on the same link.

I have found two Stack Overflow questions, here and there, which explain how to add several data-toggle attributes in Rails, but none of them offers a solution to implement this INSIDE a link_to helper.

Is that actually possible?

Community
  • 1
  • 1
Thibaud Clement
  • 6,607
  • 10
  • 50
  • 103

1 Answers1

1

I don't think you can, but could you just wrap your link in a <div> or a <span> and put the tool tip on that.

mahi-man
  • 4,326
  • 2
  • 25
  • 36