BURs: add edit and reject links to the BUR show page (#3824).

This commit is contained in:
evazion
2019-01-15 21:18:00 -06:00
parent a284d3fb4a
commit 6b167d6055
5 changed files with 26 additions and 15 deletions

View File

@@ -0,0 +1,11 @@
<%# bur %>
<% if bur.approvable?(CurrentUser.user) %>
<%= link_to "Approve", approve_bulk_update_request_path(bur), remote: true, method: :post, "data-confirm": "Are you sure you want to approve this bulk update request?" %> |
<% end %>
<% if bur.rejectable?(CurrentUser.user) %>
<%= link_to "Reject", bur, remote: true, method: :delete, "data-confirm": "Are you sure you want to reject this bulk update request?" %> |
<% end %>
<% if bur.editable?(CurrentUser.user) %>
<%= link_to "Edit", edit_bulk_update_request_path(bur), :"data-shortcut" => "e" %>
<% end %>

View File

@@ -25,15 +25,9 @@
<td id="request-status-for-<%= request.id %>"><%= request.status %></td> <td id="request-status-for-<%= request.id %>"><%= request.status %></td>
<td> <td>
<%= link_to "Show", bulk_update_request_path(request) %> | <%= link_to "Show", bulk_update_request_path(request) %> |
<% if CurrentUser.is_admin? && request.status == "pending" %> <%= render "bur_edit_links", bur: request %>
<%= link_to "Approve", approve_bulk_update_request_path(request), :remote => true, :method => :post %> |
<% end %>
<% if request.editable?(CurrentUser.user) %>
<%= link_to "Reject", bulk_update_request_path(request), :method => :delete, :remote => true, :data => {:confirm => "Are you sure you want to reject this bulk update request?"} %> |
<%= link_to "Edit", edit_bulk_update_request_path(request) %>
<% end %>
</td> </td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>

View File

@@ -1,5 +1,9 @@
<% if @bulk_update_request.errors.any? %> <% if @bulk_update_request.errors.any? %>
$(window).trigger("danbooru:error", <%= j @bulk_update_request.errors.full_messages.join(',') %>); $(window).trigger("danbooru:error", <%= j @bulk_update_request.errors.full_messages.join(',') %>);
<% else %> <% else %>
$("#request-status-for-<%= @bulk_update_request.id %>").html("queued"); if ($("#a-index").length) {
$("#request-status-for-<%= @bulk_update_request.id %>").html("queued");
} else {
location.reload();
}
<% end %> <% end %>

View File

@@ -1 +1,5 @@
$("#request-status-for-<%= @bulk_update_request.id %>").html("rejected"); if ($("#a-index").length) {
$("#request-status-for-<%= @bulk_update_request.id %>").html("rejected");
} else {
location.reload();
}

View File

@@ -10,15 +10,13 @@
<li><strong>Date</strong> <%= @bulk_update_request.created_at %></li> <li><strong>Date</strong> <%= @bulk_update_request.created_at %></li>
<li><strong>Status</strong>: <%= @bulk_update_request.status %></li> <li><strong>Status</strong>: <%= @bulk_update_request.status %></li>
<li><strong title="How many posts will be affected">Estimate</strong>: <%= @bulk_update_request.estimate_update_count %></li> <li><strong title="How many posts will be affected">Estimate</strong>: <%= @bulk_update_request.estimate_update_count %></li>
<% if CurrentUser.is_admin? && @bulk_update_request.is_pending? %>
<li><strong>Commands</strong> <%= link_to "Approve", approve_bulk_update_request_path(@bulk_update_request), :method => :post %></li>
<% end %>
</ul> </ul>
<div style="margin: 1em 0;"> <div style="margin: 1em 0;">
<h2>Script</h2> <h2>Script</h2>
<pre><%= format_text @bulk_update_request.script_with_links %></pre> <pre><%= format_text @bulk_update_request.script_with_links %></pre>
<%= render "bur_edit_links", bur: @bulk_update_request %>
</div> </div>
</div> </div>
</div> </div>
@@ -27,4 +25,4 @@
<% content_for(:page_title) do %> <% content_for(:page_title) do %>
Bulk Update Request - <%= Danbooru.config.app_name %> Bulk Update Request - <%= Danbooru.config.app_name %>
<% end %> <% end %>