Sha256: 87b53a6d0a30e0f15c9400962d43107f06df78ad0fa474dce79d9693e1e9d702

Contents?: true

Size: 1.99 KB

Versions: 5

Compression:

Stored size: 1.99 KB

Contents

<div class="container">
  <%= ph('Using will_paginate with post method') %>
  <p>In some cases, you may be want to use post method instead of get method when using will_paginate gem. You can try
    it with a search form which uses post method. See example:</p>

  <div class="bs-docs-example">
    <form class="form-search" id="search-form" method="post">
      <input type="text" class="input-medium search-query" name="search" value="<%= params[:search] %>">
      <button type="submit" class="btn">Search</button>
    </form>

    <%= table(obj: @orders,
              pagi_method: 'post',
              pagi_form: 'search-form') do |t| %>
        <% t.column(h: {w: 3, l: 'Order Number'}) { |order| order.order_number } %>
        <% t.column(h: {w: 3, l: 'Customer Name'}) { |order| order.customer_name } %>
        <% t.column(h: {w: 2, l: 'Status'}) { |order| order.status } %>
        <% t.column(h: {w: 3, l: 'Action'}) do %>
            <%= link_to 'show', '#table' %> |
            <%= link_to 'edit', '#table' %> |
            <%= link_to 'destroy', '#table', data: {confirm: 'sure?'} %>
        <% end %>
    <% end %>
  </div>

<pre class="prettyprint linenums lang-erb">
&lt;form class="form-search" id="search-form" method="post"&gt;
    &lt;input type="text" class="input-medium search-query" name="search" value="&lt;%= params[:search] %&gt;"&gt;
    &lt;button type="submit" class="btn"&gt;Search&lt;/button&gt;
&lt;/form&gt;

&lt;%= table(obj: @orders,
        pagi_method: 'post',
        pagi_form: 'search-form') do |t| %&gt;
  &lt;% t.column(h: {w: 3, l: 'Order Number'}) { |order| order.order_number }%&gt;
  &lt;% t.column(h: {w: 3, l: 'Customer Name'}) { |order| order.customer_name } %&gt;
  &lt;% column(h: {w: 2, l: 'Status'}) { |order| order.status } %&gt;
  &lt;% t.column(h: {w: 3, l: 'Action'}) do %&gt;
      &lt;%= link_to 'show', '#' %&gt; |
      &lt;%= link_to 'edit', '#' %&gt; |
      &lt;%= link_to 'destroy', '#', data: {confirm: 'sure?'} %&gt;
  &lt;% end %&gt;
&lt;% end %&gt;
</pre>
</div>

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bs-helper-0.1.4 test/dummy/app/views/paginations/index.html.erb
bs-helper-0.1.3 test/dummy/app/views/paginations/index.html.erb
bs-helper-0.1.2 test/dummy/app/views/paginations/index.html.erb
bs-helper-0.1.1 test/dummy/app/views/paginations/index.html.erb
bs-helper-0.1.0 test/dummy/app/views/paginations/index.html.erb