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,74 +10,58 @@
<%= f.submit "Search" %>
<% end %>
<table width="100%" class="striped autofit">
<thead>
<tr>
<th width="1%">Post</th>
<th>Source</th>
<th>MD5</th>
<th>Size</th>
<th>Replacer</th>
</tr>
</thead>
<tbody>
<% @post_replacements.each do |post_replacement| %>
<tr>
<td><%= PostPresenter.preview(post_replacement.post, show_deleted: true) %></td>
<td>
<dl>
<dt>Original Source</dt>
<dd><%= external_link_to post_replacement.original_url, truncate: 64 %></dd>
<dt>Replacement Source</dt>
<dd>
<% if post_replacement.replacement_url.present? %>
<%= external_link_to post_replacement.replacement_url, truncate: 64 %>
<% else %>
<em>file</em>
<% end %>
</dd>
</dl>
</td>
<%= table_for @post_replacements, {class: "striped autofit", width: "100%"} do |t| %>
<% t.column "Post", {width: "1%"} do |post_replacement| %>
<%= PostPresenter.preview(post_replacement.post, show_deleted: true) %>
<% end %>
<% t.column "Source" do |post_replacement| %>
<dl>
<dt>Original Source</dt>
<dd><%= external_link_to post_replacement.original_url, truncate: 64 %></dd>
<dt>Replacement Source</dt>
<dd>
<% if post_replacement.replacement_url.present? %>
<%= external_link_to post_replacement.replacement_url, truncate: 64 %>
<% else %>
<em>file</em>
<% end %>
</dd>
</dl>
<% end %>
<% t.column "MD5" do |post_replacement| %>
<% if post_replacement.md5_was.present? && post_replacement.md5.present? %>
<dl>
<dt>Original MD5</dt>
<dd><%= post_replacement.md5_was %></dd>
<td>
<% if post_replacement.md5_was.present? && post_replacement.md5.present? %>
<dl>
<dt>Original MD5</dt>
<dd><%= post_replacement.md5_was %></dd>
<dt>Replacement MD5</dt>
<dd><%= post_replacement.md5 %></dd>
</dl>
<% end %>
</td>
<td>
<% if %i[image_width_was image_height_was file_size_was file_ext_was image_width image_height file_size file_ext].all? { |k| post_replacement[k].present? } %>
<dl>
<dt>Original Size</dt>
<dd>
<%= post_replacement.image_width_was %>x<%= post_replacement.image_height_was %>
(<%= post_replacement.file_size_was.to_s(:human_size, precision: 4) %>, <%= post_replacement.file_ext_was %>)
</dd>
<dt>Replacement Size</dt>
<dd>
<%= post_replacement.image_width %>x<%= post_replacement.image_height %>
(<%= post_replacement.file_size.to_s(:human_size, precision: 4) %>, <%= post_replacement.file_ext %>)
</dd>
</dl>
<% end %>
</td>
<td>
<%= compact_time post_replacement.created_at %>
<br> by <%= link_to_user post_replacement.creator %>
<%= link_to "»", post_replacements_path(search: params[:search].merge(creator_name: post_replacement.creator.name)) %>
</td>
</tr>
<dt>Replacement MD5</dt>
<dd><%= post_replacement.md5 %></dd>
</dl>
<% end %>
</tbody>
</table>
<% end %>
<% t.column "Size" do |post_replacement| %>
<% if %i[image_width_was image_height_was file_size_was file_ext_was image_width image_height file_size file_ext].all? { |k| post_replacement[k].present? } %>
<dl>
<dt>Original Size</dt>
<dd>
<%= post_replacement.image_width_was %>x<%= post_replacement.image_height_was %>
(<%= post_replacement.file_size_was.to_s(:human_size, precision: 4) %>, <%= post_replacement.file_ext_was %>)
</dd>
<dt>Replacement Size</dt>
<dd>
<%= post_replacement.image_width %>x<%= post_replacement.image_height %>
(<%= post_replacement.file_size.to_s(:human_size, precision: 4) %>, <%= post_replacement.file_ext %>)
</dd>
</dl>
<% end %>
<% end %>
<% t.column "Replacer" do |post_replacement| %>
<%= compact_time post_replacement.created_at %>
<br> by <%= link_to_user post_replacement.creator %>
<%= link_to "»", post_replacements_path(search: params[:search].merge(creator_name: post_replacement.creator.name)) %>
<% end %>
<% end %>
<%= numbered_paginator(@post_replacements) %>
</div>