Sha256: 7cf4832bb7ff58c8a238b66ee491c745f072954dc76fc7f39bb16bfc3bf29910

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 KB

Contents

<h1>Listing users</h1>

<%= magic_grid(@basic_users, [:name, :email, :posts, 'Actions'],
               :per_page => 10, :remote => true,
               :top_pager => false, :bottom_pager => true) do |user| %>
  <tr>
    <td><%= user.name %></td>
    <td><%= mail_to user.email %></td>
    <td><%= link_to user.posts.count, "/posts/by-user/#{user.id}" %></td>
    <td>
      <%= link_to 'Show', user %>
      <%= link_to 'Edit', edit_user_path(user) %>
      <%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %>
    </td>
  </tr>
<% end %>

<%= magic_grid( Array(1..1000), ["Number", "Word"], :per_page => 5) do |n| %>
  <tr>
    <td><%= n %></td>
    <td><%= n.ordinalize %></td>
  </tr>
<% end %>

<%= magic_grid(@optimized_users,
               [{:sql => 'users.name', :label => 'Name'}, :email, :posts, 'Actions'],
               :per_page => false,
               :searchable => [0, 1]) do |user| %>
  <tr>
    <td><%= user.name %></td>
    <td><%= mail_to user.email %></td>
    <td><%= link_to user.post_count, "/posts/by-user/#{user.id}" %></td>
    <td>
      <%= link_to 'Show', user %>
      <%= link_to 'Edit', edit_user_path(user) %>
      <%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %>
    </td>
  </tr>
<% end %>
<br />

<%= link_to 'New User', new_user_path %>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
magic_grid-0.12.6 test/dummy/app/views/users/index.html.erb
magic_grid-0.12.5 test/dummy/app/views/users/index.html.erb
magic_grid-0.12.4 test/dummy/app/views/users/index.html.erb