I am trying to clear my code a bit by putting my modal code inside partial, however I am having problems trying to call modal.
I tried the solution provided How to show twitter bootstrap modal via JS request in rails? , but if I understand correctly, I need to add code to a specific controller to display the modal. That would be fine, but I would like to display modal, no matter what controller / view it is located. Is it possible?
What I have (completely from the above question):
current link (views / static_pages)
<%= link_to "ModalTest", 'shared/testmodal', {:remote => true, 'data-toggle' => 'modal', 'data-target' => "testmodal" }%>
show.js.erb
$('.modal-body').html('<%= escape_javascript(render :partial => 'shared/testmodal'%>'); $('.modal-header').remove();
previous attempt:
<%= link_to "ModalTest", render(:partial => 'shared/testmodal') %>
source share