fixes #3824: render tag requests dynamically in the forum post

refactoring
This commit is contained in:
Albert Yi
2019-01-02 17:27:01 -08:00
parent 5c54c61d65
commit 8b0af19f7f
18 changed files with 171 additions and 25 deletions

View File

@@ -7,16 +7,16 @@
<div class="input">
<label class="text optional" for="bulk_update_request_script">Script</label>
<pre class="hint">
Use the following format:
unalias aaa -> bbb
unimply aaa -> bbb
alias aaa -> bbb
imply aaa -> bbb
update aaa -> bbb
category tag_name -> category_name
</pre>
<%= text_area :bulk_update_request, :script, :size => "50x10" %>
<p><a href="#" id="script-help-link">Help</a></p>
<ul class="hint" id="script-help" title="Bulk Update Request Help">
<li>unalias aaa -> bbb</li>
<li>unimply aaa -> bbb</li>
<li>alias aaa -> bbb</li>
<li>imply aaa -> bbb</li>
<li>update aaa -> bbb</li>
<li>category tag_name -> category_name</li>
</ul>
</div>
<% if @bulk_update_request.new_record? %>
@@ -45,3 +45,15 @@ category tag_name -> category_name
<%= f.button :submit, :value => "Submit" %>
<%= dtext_preview_button "bulk_update_request", "reason" %>
<% end %>
<%= content_for(:html_header) do %>
<script>
$(function() {
$("#script-help").hide();
$("#script-help-link").click(function() {
$("#script-help").dialog({width: "30em"});
return false;
});
});
</script>
<% end %>

View File

@@ -24,6 +24,7 @@
<td><%= script_with_line_breaks(request.script) %></td>
<td id="request-status-for-<%= request.id %>"><%= request.status %></td>
<td>
<%= link_to "Show", bulk_update_request_path(request) %> |
<% if CurrentUser.is_admin? && request.status == "pending" %>
<%= link_to "Approve", approve_bulk_update_request_path(request), :remote => true, :method => :post %> |
<% end %>

View File

@@ -0,0 +1,29 @@
<div id="c-bulk-update-requests">
<div id="a-show">
<h1>Bulk Update Request: <%= @bulk_update_request.title %></h1>
<ul>
<% if @bulk_update_request.forum_topic_id %>
<li><strong>Reference</strong> <%= link_to "topic ##{@bulk_update_request.forum_topic_id}", forum_topic_path(@bulk_update_request.forum_topic_id) %></li>
<% end %>
<li><strong>Creator</strong> <%= link_to_user @bulk_update_request.user %></li>
<li><strong>Date</strong> <%= @bulk_update_request.created_at %></li>
<li><strong>Status</strong>: <%= @bulk_update_request.status %></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>
<div style="margin: 1em 0;">
<h2>Script</h2>
<pre><%= format_text @bulk_update_request.script_with_links %></pre>
</div>
</div>
</div>
<%= render "secondary_links" %>
<% content_for(:page_title) do %>
Bulk Update Request - <%= Danbooru.config.app_name %>
<% end %>