I have a table with order information and am using the will_paginate
gem to create pagination for the page to show 10 orders a page.
The _head.html.erb
file is rendered in the application.html.erb
and file contains:
<head>
<title>fstool</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
</head>
application.js
contains:
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
Next to every order is a Twitter Bootstrap button (with drop down toggle), this is the code:
<div class="btn-group">
<button type="button" class="btn btn-xs btn-primary dropdown-toggle" data-toggle="dropdown">
Action
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><%= link_to "Show", order %></li>
<li><%= link_to "Edit", edit_order_path(order) %></li>
<li class="divider"></li>
<li><%= link_to "Destroy", order_path(order),
method: :delete, data: { confirm: 'Are you sure?' } %></li>
</ul>
</div>
</div>
The button works on the first page. When I click on page 2, the button does not work. It is clickable, but there is no drop down toggle. I have to reload (CMD-R) the page for the drop down button to work.
Any ideas on how to solve this?
As Nich pointed out, to solve this simply remove
//= require turbolinks
form./app/assets/javascripts/application.js
.All working now.