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

@@ -1,46 +1,33 @@
<div id="p-revert-listing">
<table width="100%" class="striped autofit">
<thead>
<tr>
<th width="5%">Post</th>
<th>Original</th>
<th>Translated</th>
<% if CurrentUser.is_moderator? %>
<th width="10%">IP Address</th>
<% end %>
<th width="10%">Edited By</th>
<th width="10%">Date</th>
<% if CurrentUser.is_member? %>
<th width="7%"></th>
<% end %>
</tr>
</thead>
<tbody>
<% @commentary_versions.each do |commentary_version| %>
<tr>
<td><%= link_to commentary_version.post_id, post_path(commentary_version.post_id) %></td>
<td>
<%= format_commentary_title(commentary_version.original_title) %>
<%= format_commentary_description(commentary_version.original_description) %>
</td>
<td>
<%= format_commentary_title(commentary_version.translated_title) %>
<%= format_commentary_description(commentary_version.translated_description) %>
</td>
<% if CurrentUser.is_moderator? %>
<td>
<%= link_to_ip commentary_version.updater_ip_addr %>
</td>
<% end %>
<td><%= link_to_user commentary_version.updater %></td>
<td><%= compact_time commentary_version.updated_at %></td>
<% if CurrentUser.is_member? %>
<td>
<%= link_to "Revert to", revert_artist_commentary_path(commentary_version.post_id, :version_id => commentary_version.id), :remote => true, :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %>
</td>
<% end %>
</tr>
<%= table_for @commentary_versions, {class: "striped autofit", width: "100%"} do |t| %>
<% t.column "Post", {width: "5%"} do |commentary_version| %>
<%= link_to commentary_version.post_id, post_path(commentary_version.post_id) %>
<% end %>
<% t.column "Original" do |commentary_version| %>
<%= format_commentary_title(commentary_version.original_title) %>
<%= format_commentary_description(commentary_version.original_description) %>
<% end %>
<% t.column "Translated" do |commentary_version| %>
<%= format_commentary_title(commentary_version.translated_title) %>
<%= format_commentary_description(commentary_version.translated_description) %>
<% end %>
<% if CurrentUser.is_moderator? %>
<% t.column "IP Address", {width: "10%"} do |commentary_version| %>
<%= link_to_ip commentary_version.updater_ip_addr %>
<% end %>
</tbody>
</table>
<% end %>
<% t.column "Edited by", {width: "10%"} do |commentary_version| %>
<%= link_to_user commentary_version.updater %>
<% end %>
<% t.column "Date", {width: "10%"} do |commentary_version| %>
<%= compact_time commentary_version.updated_at %>
<% end %>
<% if CurrentUser.is_member? %>
<% t.column "", {width: "7%"} do |commentary_version| %>
<%= link_to "Revert to", revert_artist_commentary_path(commentary_version.post_id, :version_id => commentary_version.id), :remote => true, :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %>
<% end %>
<% end %>
<% end %>
</div>

View File

@@ -1,40 +1,31 @@
<div id="p-standard-listing">
<table width="100%" class="striped autofit">
<thead>
<tr>
<th width="5%">Post</th>
<th>Version</th>
<th>Original</th>
<th>Translated</th>
<% if CurrentUser.is_moderator? %>
<th width="10%">IP Address</th>
<% end %>
<th width="10%">Edited By</th>
<th width="10%">Date</th>
</tr>
</thead>
<tbody>
<% @commentary_versions.each do |commentary_version| %>
<tr>
<td><%= PostPresenter.preview(commentary_version.post, :tags => "status:any") %></td>
<td><%= link_to "#{commentary_version.post_id}.#{commentary_version.id}»", artist_commentary_versions_path(search: {post_id: commentary_version.post_id}) %></td>
<td>
<%= format_commentary_title(commentary_version.original_title) %>
<%= format_commentary_description(commentary_version.original_description) %>
</td>
<td>
<%= format_commentary_title(commentary_version.translated_title) %>
<%= format_commentary_description(commentary_version.translated_description) %>
</td>
<% if CurrentUser.is_moderator? %>
<td>
<%= link_to_ip commentary_version.updater_ip_addr %>
</td>
<% end %>
<td><%= link_to_user commentary_version.updater %></td>
<td><%= compact_time commentary_version.updated_at %></td>
</tr>
<%= table_for @commentary_versions, {class: "striped autofit", width: "100%"} do |t| %>
<% t.column "Post", {width: "5%"} do |commentary_version| %>
<%= PostPresenter.preview(commentary_version.post, :tags => "status:any") %>
<% end %>
<% t.column "Version" do |commentary_version| %>
<%= link_to "#{commentary_version.post_id}.#{commentary_version.id}»", artist_commentary_versions_path(search: {post_id: commentary_version.post_id}) %>
<% end %>
<% t.column "Original" do |commentary_version| %>
<%= format_commentary_title(commentary_version.original_title) %>
<%= format_commentary_description(commentary_version.original_description) %>
<% end %>
<% t.column "Translated" do |commentary_version| %>
<%= format_commentary_title(commentary_version.translated_title) %>
<%= format_commentary_description(commentary_version.translated_description) %>
<% end %>
<% if CurrentUser.is_moderator? %>
<% t.column "IP Address", {width: "10%"} do |commentary_version| %>
<%= link_to_ip commentary_version.updater_ip_addr %>
<% end %>
</tbody>
</table>
<% end %>
<% t.column "Edited by", {width: "10%"} do |commentary_version| %>
<%= link_to_user commentary_version.updater %>
<% end %>
<% t.column "Date", {width: "10%"} do |commentary_version| %>
<%= compact_time commentary_version.updated_at %>
<% end %>
<% end %>
</div>