如何让 will_paginate 与 Rails 项目上的搜索框对齐,该项目主要取自 michael hartl 的 rails 教程。我在rails中拥有的是:
<div class="row">
<div class= "pull-left">
<%= will_paginate %>
</div>
<div class="span4 offset4 pull-right">
<%= form_tag users_path, :method => 'get', class: "navbar-search" do %>
<%= text_field_tag :search, params[:search], class: "search-query span3" %>
<%= submit_tag "Search", :name => nil, class: "btn btn-primary" %>
<% end %>
</div>
</div>
这导致了这个 html(请参阅此处以获取 jsfiddle 中的 html):
<div class="row">
<div class="pull-left">
<div class="pagination">
<ul>
<li class="prev previous_page disabled">
<a href="#">← Previous</a>
</li>
<li class="active">
<a href="/users?page=1&search=&utf8=%E2%9C%93" rel="start">1</a>
</li>
<li>
<a href="/users?page=2&search=&utf8=%E2%9C%93" rel="next">2</a>
</li>
<li>
<a href="/users?page=3&search=&utf8=%E2%9C%93">3</a>
</li>
<li>
<a href="/users?page=4&search=&utf8=%E2%9C%93">4</a>
</li>
<li class="next next_page ">
<a href="/users?page=2&search=&utf8=%E2%9C%93" rel="next">Next →</a>
</li>
</ul>
</div>
</div>
<div class="span4 offset4 pull-right">
<form class="navbar-search" method="get" action="/users" accept-charset="UTF-8">
<div style="margin:0;padding:0;display:inline">
<input type="hidden" value="✓" name="utf8">
</div>
<input id="search" class="search-query span3" type="text" value="" name="search">
<input class="btn btn-primary" type="submit" value="Search">
</form>
</div>
</div>
现在您可以看到:
搜索框在 will_paginate 链接上方,我如何使它们彼此内联?
(另外在jsfiddle中,搜索按钮没有与搜索栏内联,如果你能告诉我为什么会这样,那在我的网站上不会发生,我复制了html,加分)