Convert index tables to using table builder
This commit is contained in:
@@ -10,48 +10,34 @@
|
||||
<%= f.submit "Search" %>
|
||||
<% end %>
|
||||
|
||||
<table class="striped autofit">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Post</th>
|
||||
<th>Comment</th>
|
||||
<th>Score</th>
|
||||
<th>Commenter</th>
|
||||
<th>Voter</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @comment_votes.each do |vote| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= PostPresenter.preview(vote.comment.post, show_deleted: true) %>
|
||||
</td>
|
||||
<td class="col-expand">
|
||||
<div class="prose">
|
||||
<%= format_text(vote.comment.body) %>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= link_to sprintf("%+d", vote.score), comment_votes_path(search: { score: vote.score }) %></td>
|
||||
<td>
|
||||
<%= link_to_user vote.comment.creator %>
|
||||
<%= link_to "»", comment_votes_path(search: { comment: { creator_name: vote.comment.creator_name }}) %>
|
||||
<div><%= time_ago_in_words_tagged(vote.comment.created_at) %></div>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to_user vote.user %>
|
||||
<%= link_to "»", comment_votes_path(search: { user_name: vote.user.name }) %>
|
||||
<div><%= time_ago_in_words_tagged(vote.created_at) %></div>
|
||||
</td>
|
||||
<td>
|
||||
<% if vote.user == CurrentUser.user %>
|
||||
<%= link_to "unvote", comment_comment_votes_path(vote.comment), remote: true, method: :delete %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<%= table_for @comment_votes, {class: "striped autofit"} do |t| %>
|
||||
<% t.column "Post" do |vote| %>
|
||||
<%= PostPresenter.preview(vote.comment.post, show_deleted: true) %>
|
||||
<% end %>
|
||||
<% t.column "Comment", nil, {class: "col-expand"} do |vote| %>
|
||||
<div class="prose">
|
||||
<%= format_text(vote.comment.body) %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% t.column "Score" do |vote| %>
|
||||
<%= link_to sprintf("%+d", vote.score), comment_votes_path(search: { score: vote.score }) %>
|
||||
<% end %>
|
||||
<% t.column "Commenter" do |vote| %>
|
||||
<%= link_to_user vote.comment.creator %>
|
||||
<%= link_to "»", comment_votes_path(search: { comment: { creator_name: vote.comment.creator_name }}) %>
|
||||
<div><%= time_ago_in_words_tagged(vote.comment.created_at) %></div>
|
||||
<% end %>
|
||||
<% t.column "Voter" do |vote| %>
|
||||
<%= link_to_user vote.user %>
|
||||
<%= link_to "»", comment_votes_path(search: { user_name: vote.user.name }) %>
|
||||
<div><%= time_ago_in_words_tagged(vote.created_at) %></div>
|
||||
<% end %>
|
||||
<% t.column "" do |vote| %>
|
||||
<% if vote.user == CurrentUser.user %>
|
||||
<%= link_to "unvote", comment_comment_votes_path(vote.comment), remote: true, method: :delete %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= numbered_paginator(@comment_votes) %>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user