Files
danbooru/app/views/post_versions/_listing.html.erb

63 lines
2.5 KiB
Plaintext

<div id="p-<%= post_version_listing %>-listing">
<table class="striped autofit">
<thead>
<tr>
<% if CurrentUser.user.is_builder? %>
<th class="post-version-select-column">
<label><input type="checkbox" id="post-version-select-all-checkbox" class="post-version-select-checkbox"></label>
</th>
<% end %>
<th width="5%">Post</th>
<th width="15%">Date</th>
<th width="10%">User</th>
<th width="5%">Rating</th>
<th width="5%">Parent</th>
<% if CurrentUser.is_moderator? %>
<th width="10%">IP Address</th>
<% end %>
<th>Tags</th>
<% if CurrentUser.is_member? %>
<th width="7%"></th>
<% end %>
</tr>
</thead>
<tbody>
<% @post_versions.each do |post_version| %>
<tr id="post-version-<%= post_version.id %>" data-post-version-id="<%= post_version.id %>">
<% if CurrentUser.user.is_builder? %>
<td class="post-version-select-column">
<input type="checkbox" class="post-version-select-checkbox" <%= "disabled" unless post_version.can_undo?(CurrentUser.user) %>>
</td>
<% end %>
<td>
<%= link_to("#{post_version.post_id}.#{post_version.id}", post_path(post_version.post_id)) %>
<%= link_to "»", post_versions_path(search: {post_id: post_version.post_id}) %>
</td>
<td><%= compact_time(post_version.updated_at) %></td>
<td>
<% if post_version.updater %>
<%= link_to_user(post_version.updater) %>
<% end %>
</td>
<td><%= post_version.rating %></td>
<td><%= post_version.parent_id %></td>
<% if CurrentUser.is_moderator? %>
<td>
<%= link_to_ip post_version.updater_ip_addr %>
</td>
<% end %>
<td class="col-expand"><%= post_version_diff(post_version) %></td>
<td>
<% if post_version.can_undo?(CurrentUser.user) %>
<%= link_to "Undo", undo_post_version_path(post_version), method: :put, remote: true, class: "post-version-undo-link" %>
<% end %>
<% if post_version_listing == :revert && post_version.can_revert_to?(CurrentUser.user) %>
| <%= link_to "Revert to", revert_post_path(post_version.post_id, version_id: post_version.id), method: :put, remote: true %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>