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 %>

View File

@@ -15,7 +15,7 @@
</div>
<div class="content">
<div class="prose">
<%= format_text(forum_post.body) %>
<%= format_text(parse_embedded_tag_request_text(forum_post.body)) %>
</div>
<%= render "update_notice", record: forum_post %>
<menu>

View File

@@ -7,6 +7,7 @@
<%= subnav_link_to "New", new_forum_topic_path %>
<%= subnav_link_to "Request alias", new_tag_alias_request_path %>
<%= subnav_link_to "Request implication", new_tag_implication_request_path %>
<%= subnav_link_to "Request BUR", new_bulk_update_request_path %>
<%= subnav_link_to "Mark all as read", mark_all_as_read_forum_topics_path, :method => :post, :"data-shortcut" => "shift+r" %>
<% end %>

View File

@@ -13,6 +13,11 @@
<% if @tag_alias.respond_to?(:reason) && @tag_alias.reason.present? %>
<li><strong>Reason</strong> <%= format_text @tag_alias.reason %></li>
<% end %>
<li><strong>Status</strong>: <%= @tag_alias.status %></li>
<% if CurrentUser.is_admin? && @tag_alias.is_pending? %>
<li><strong>Commands</strong> <%= link_to "Approve", approve_tag_alias_path(@tag_alias), :method => :post %></li>
<% end %>
</ul>
</div>
</div>

View File

@@ -13,6 +13,11 @@
<% if @tag_implication.respond_to?(:reason) && @tag_implication.reason.present? %>
<li><strong>Reason</strong> <%= format_text @tag_implication.reason %></li>
<% end %>
<li><strong>Status</strong>: <%= @tag_implication.status %></li>
<% if CurrentUser.is_admin? && @tag_implication.is_pending? %>
<li><strong>Commands</strong> <%= link_to "Approve", approve_tag_implication_path(@tag_implication), :method => :post %></li>
<% end %>
</ul>
</div>
</div>