Convert index tables to using table builder

This commit is contained in:
BrokenEagle
2020-01-03 06:19:30 +00:00
parent 917ffa87ed
commit 043944e1dd
47 changed files with 1161 additions and 1628 deletions

View File

@@ -10,49 +10,33 @@
<%= f.submit "Search" %>
<% end %>
<table class="striped autofit">
<thead>
<tr>
<th>Forum Post</th>
<th>Forum Topic</th>
<th>Score</th>
<th>Forum Poster</th>
<th>Voter</th>
<th></th>
</tr>
</thead>
<tbody>
<% @forum_post_votes.each do |forum_post_vote| %>
<tr>
<td>
<%= link_to "Forum ##{forum_post_vote.forum_post_id}", forum_post_vote.forum_post %>
<%= link_to "»", forum_post_votes_path(search: { forum_post_id: forum_post_vote.forum_post_id }) %>
</td>
<td class="col-expand">
<%= link_to forum_post_vote.forum_post.topic.title, forum_post_vote.forum_post.topic %>
</td>
<td>
<%= link_to sprintf("%+d", forum_post_vote.score), forum_post_votes_path(search: { score: forum_post_vote.score }) %>
</td>
<td>
<%= link_to_user forum_post_vote.forum_post.creator %>
<%= link_to "»", forum_post_votes_path(search: { forum_post: { creator_name: forum_post_vote.forum_post.creator.name }}) %>
<div><%= time_ago_in_words_tagged(forum_post_vote.forum_post.created_at) %></div>
</td>
<td>
<%= link_to_user forum_post_vote.creator %>
<%= link_to "»", forum_post_votes_path(search: { creator_name: forum_post_vote.creator.name }) %>
<div><%= time_ago_in_words_tagged(forum_post_vote.created_at) %></div>
</td>
<td>
<% if forum_post_vote.creator == CurrentUser.user %>
<%= link_to "unvote", forum_post_vote_path(forum_post_vote, format: "js"), remote: true, method: :delete %>
<% end %>
</td>
</tr>
<%= table_for @forum_post_votes, {class: "striped autofit"} do |t| %>
<% t.column "Forum Post" do |forum_post_vote| %>
<%= link_to "Forum ##{forum_post_vote.forum_post_id}", forum_post_vote.forum_post %>
<%= link_to "»", forum_post_votes_path(search: { forum_post_id: forum_post_vote.forum_post_id }) %>
<% end %>
<% t.column "Forum Topic", nil, {class: "col-expand"} do |forum_post_vote| %>
<%= link_to forum_post_vote.forum_post.topic.title, forum_post_vote.forum_post.topic %>
<% end %>
<% t.column "Score" do |forum_post_vote| %>
<%= link_to sprintf("%+d", forum_post_vote.score), forum_post_votes_path(search: { score: forum_post_vote.score }) %>
<% end %>
<% t.column "Forum Poster" do |forum_post_vote| %>
<%= link_to_user forum_post_vote.forum_post.creator %>
<%= link_to "»", forum_post_votes_path(search: { forum_post: { creator_name: forum_post_vote.forum_post.creator.name }}) %>
<div><%= time_ago_in_words_tagged(forum_post_vote.forum_post.created_at) %></div>
<% end %>
<% t.column "Voter" do |forum_post_vote| %>
<%= link_to_user forum_post_vote.creator %>
<%= link_to "»", forum_post_votes_path(search: { creator_name: forum_post_vote.creator.name }) %>
<div><%= time_ago_in_words_tagged(forum_post_vote.created_at) %></div>
<% end %>
<% t.column "" do |forum_post_vote| %>
<% if forum_post_vote.creator == CurrentUser.user %>
<%= link_to "unvote", forum_post_vote_path(forum_post_vote, format: "js"), remote: true, method: :delete %>
<% end %>
</tbody>
</table>
<% end %>
<% end %>
<%= numbered_paginator(@forum_post_votes) %>
</div>