Fix #4178: add ability to mass undo tag edits.
Adds checkboxes to the /post_versions index allowing you to select and undo multiple versions at once.
This commit is contained in:
@@ -2,6 +2,11 @@
|
||||
<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>
|
||||
@@ -18,7 +23,12 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @post_versions.each do |post_version| %>
|
||||
<tr id="post-version-<%= post_version.id %>">
|
||||
<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)) %></td>
|
||||
<td><%= compact_time(post_version.updated_at) %></td>
|
||||
<td>
|
||||
@@ -34,16 +44,14 @@
|
||||
</td>
|
||||
<% end %>
|
||||
<td class="col-expand"><%= post_version_diff(post_version) %></td>
|
||||
<% if CurrentUser.is_member? %>
|
||||
<td>
|
||||
<% if post_version.visible? %>
|
||||
<% if post_version.version != 1 %>
|
||||
<%= link_to "Undo", undo_post_version_path(post_version), :method => :put, :remote => true %> |
|
||||
<% end %>
|
||||
<%= link_to "Revert to", revert_post_path(post_version.post_id, :version_id => post_version.id), :method => :put, :remote => true %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% end %>
|
||||
<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.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>
|
||||
|
||||
@@ -4,4 +4,7 @@
|
||||
<%= subnav_link_to "Search", search_post_versions_path %>
|
||||
<%= subnav_link_to "Changes", post_versions_path %>
|
||||
<%= subnav_link_to "Help", wiki_pages_path(:title => "help:posts") %>
|
||||
<% if params[:action] == "index" %>
|
||||
| <%= subnav_link_to "Undo selected", "" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
<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>
|
||||
@@ -18,7 +23,12 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @post_versions.each do |post_version| %>
|
||||
<tr id="post-version-<%= post_version.id %>">
|
||||
<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}) %>
|
||||
@@ -37,18 +47,13 @@
|
||||
</td>
|
||||
<% end %>
|
||||
<td class="col-expand"><%= post_version_diff(post_version) %></td>
|
||||
<% if CurrentUser.is_member? %>
|
||||
<td>
|
||||
<% if post_version.visible? %>
|
||||
<% if post_version.version != 1 %>
|
||||
<%= link_to "Undo", undo_post_version_path(post_version), :method => :put, :remote => true %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% end %>
|
||||
<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 %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
location.reload();
|
||||
Danbooru.Utility.notice("1 change undone.");
|
||||
|
||||
Reference in New Issue
Block a user