I have the following image tags in my rails app-
<%= link_to image_tag("../../qn/ads.svg"),{:controller => 'cp_details',:action => 'index', :id => empid, :cp => @cmpny.id }, :title=>"company", :class => 'butn' %>
<%= link_to image_tag("../../qn/users.svg"),{:controller => 'groups',:action => 'index', :id => empid, :cp => @cmpny.id }, :title=>"groups", :class => 'butn' %>
<%= link_to image_tag("../../qn/dp.svg"),{:controller=>'dep',:action => 'index', :id => empid, :cp => @cmpny.id,:type=>'dp' }, :title=>"dept", :class => 'butn' %>`
Now I am trying to implement tooltip popup(when clicked or hoverover) with the above links in it. Can anybody please help me to implement the tooltip containing the three links company,groups,dept in a tooltip popup box? I referred and tried the following-
https://gist.github.com/davidjsevans/5617391
Bootstrap Tooltip in Ruby on Rails
Using Tooltips with link_to (Ruby on Rails 3.2.3)
http://archive.railsforum.com/viewtopic.php?id=28485
But I think I don't know to how to implement these in my app. I was trying the js and jquery inside application.js
and the link_to code in employ/index.html
. I tried implementing it in one of the link_to statement like this:
<%= link_to image_tag("../../qn/ads.svg"),{:controller => 'cp_details',:action => 'index', :id => empid, :cid => @cmpny.id }, :title=>"company", :class => 'butn tag-tooltip', tag, :data => {:toggle=>"tooltip"},'data-original-title' => "Hello",'data-placement' => 'right'%>`
Javascript:
$(document).on("ready page:change", function() {
$('.tag-tooltip').tooltip();
});
Then I tried this too:
<div id="tooltipelement">
<a href="#" onclick="javascript:window.location = '/cp_details/index/<%=empid%>?cp=<%=@cmpny.id%>'">Company</a>
</div>
css:
.tooltipelement{
width: 20px;
height: 20px;
background: red;
}
.tooltipelement a {
display: none;
padding-left: 30px;
}
.tooltipelement:hover a {
display: block;
background: green;
}
But all these did'nt work for me as I don't know to implement them correctly. I want all the three links appear inside the tooltip popup box. Can anyone please help me? Thanks in advance.