ruby on rails - how to build a bootstrap popover in helper method for a view that will show a collection -
i create view show collection of objects rendered common partial template. template have helper method supposed return html code show link bootstrap popover containing list of each object addition attributes. going details, helper method
def data_popover(status) title = session[:switch] ? status.order.sim_rev : order_status.order.logo_code content_for :details content_tag :dl, class: 'dl-horizontal' content_tag :dt, 'client' content_tag :dd, status.order.logo.client end end return link_to title, order_path(status), :rel => :popover, :data => { :delay => { show: 100, hide: 300 }, :no_turbolink => true, :trigger => "hover", :placement => "top", :html => true, :original_title => status.order.so, :content => content_for(:details) } end
is not working expected. having trouble content_for :details
block, not rendering correct html. is
<a data-content="<dl class="dl-horizontal"><dd>natixis paiements</dd></dl>" data-delay="{"show":100,"hide":300}" data-html="true" data-no-turbolink="true" data-original-title="so718424.009" data-placement="top" data-trigger="hover" href="/orders/26" rel="popover">v1089297/a</a>
furthermore, each next object in collection displayed sum of client name , previous names. have no idea why. related caching?
i had customised buootstrap popover using js...try this:- have used popover show user profile information..such userimage,date of joining,favorites etc.hope can use modifying html instead of creating helper method,which think not option.
html code===========
<div class="po-markup"> posted on <i class="fa fa-calendar"></i> <%= item.created_at.strftime("%b %d,%y") %> <i class="fa fa-user"> </i> <a href="javascript:void(0);" class="po-link" ><%= user.username%></a> <div class="po-content hidden"> <div class="row"> <div class="col-md-7"> <div class="po-title"> //show image/title/whatever want </div> <!--/po-title --> </div><!--col ends --> <div class="col-lg-5"> <div class="po-body"> //show other details such address/related categories etc </div><!-- ./po-body --> </div> </div> <!-- ./row ends --> </div> </div><!-- po-markup ends -->
js code show customised popover....
$('.po-markup > .po-link').popover({ trigger: 'hover', html: true, // must have if html contained in popover // title , conent title: function() { return $(this).parent().find('.po-title').html(); }, content: function() { return $(this).parent().find('.po-body').html(); }, container: 'body', placement: 'right' });//tooltip showing html content
Comments
Post a Comment