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,55 +1,43 @@
<div id="p-<%= artist_versions_listing_type %>-listing">
<table width="100%" class="striped autofit">
<thead>
<tr>
<th>Name</th>
<th>Other Names</th>
<th>URLs</th>
<th>Updated</th>
<% if artist_versions_listing_type == :revert %>
<th></th>
<%= table_for @artist_versions, {class: "striped autofit", width: "100%"} do |t| %>
<% t.column "Name" do |artist_version| %>
<% if artist_version.visible? %>
<%= link_to artist_version.name, artist_path(artist_version.artist_id) %>
<%= link_to "»", artist_versions_path(search: {artist_id: artist_version.artist_id}) %>
<% if !artist_version.is_active? %>
(deleted)
<% end %>
<% if artist_version.group_name.present? %>
<p>(group: <%= artist_version.group_name %>)</p>
<% end %>
<% end %>
</tr>
</thead>
<tbody>
<% @artist_versions.each do |artist_version| %>
<tr>
<% if artist_version.visible? %>
<td>
<%= link_to artist_version.name, artist_path(artist_version.artist_id) %>
<%= link_to "»", artist_versions_path(search: {artist_id: artist_version.artist_id}) %>
<% if !artist_version.is_active? %>
(deleted)
<% end %>
<% if artist_version.group_name.present? %>
<p>(group: <%= artist_version.group_name %>)</p>
<% end %>
</td>
<td><%= artist_version_other_names_diff(artist_version) %></td>
<% else %>
<td></td>
<td></td>
<% end %>
<td class="col-expand">
<%= artist_version_urls_diff(artist_version) if artist_version.visible? %>
</td>
<td>
<%= link_to_user artist_version.updater %>
<%= link_to "»", artist_versions_path(search: { updater_name: artist_version.updater.name }) %>
<p>
<%= compact_time(artist_version.updated_at) %>
<% if CurrentUser.is_moderator? %>
(<%= link_to_ip artist_version.updater_ip_addr %>)
<% end %>
</p>
</td>
<% if artist_versions_listing_type == :revert %>
<td><%= link_to "Revert to", revert_artist_path(artist_version.artist_id, version_id: artist_version.id), method: :put, "data-confirm": "Are you sure you want to revert to this version?" %></td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
<% t.column "Other Names" do |artist_version| %>
<% if artist_version.visible? %>
<%= artist_version_other_names_diff(artist_version) %>
<% end %>
<% end %>
<% t.column "URLs", nil, {class: "col-expand"} do |artist_version| %>
<%= artist_version_urls_diff(artist_version) if artist_version.visible? %>
<% end %>
<% t.column "Updated" do |artist_version| %>
<%= link_to_user artist_version.updater %>
<%= link_to "»", artist_versions_path(search: { updater_name: artist_version.updater.name }) %>
<p>
<%= compact_time(artist_version.updated_at) %>
<% if CurrentUser.is_moderator? %>
(<%= link_to_ip artist_version.updater_ip_addr %>)
<% end %>
</p>
<% end %>
<% if artist_versions_listing_type == :revert %>
<% t.column "" do |artist_version| %>
<td><%= link_to "Revert to", revert_artist_path(artist_version.artist_id, version_id: artist_version.id), method: :put, "data-confirm": "Are you sure you want to revert to this version?" %></td>
<% end %>
<% end %>
<% end %>
</div>