posts/show: load flag/appeal/replacement dialogs via ajax (#3922).
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<label>Copy from</label>
|
||||
<%= select_tag :commentary_source_type, options_for_select(%w[Source Post]) %>
|
||||
<%= text_field_tag :commentary_source, post.source %>
|
||||
<%= text_field_tag :commentary_post_id, (post.parent.try(&:id) || post.children.first.try(&:id)), :style => "display: none;" %>
|
||||
<%= text_field_tag :commentary_post_id, post.parent_id, :style => "display: none;" %>
|
||||
<%= button_tag "Fetch" %>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
<%= format_text(WikiPage.titled(Danbooru.config.appeal_notice_wiki_page).first.try(&:body)) %>
|
||||
<div class="appeal-dialog-body">
|
||||
<div class="prose">
|
||||
<%= format_text(WikiPage.titled(Danbooru.config.appeal_notice_wiki_page).first.try(&:body)) %>
|
||||
</div>
|
||||
|
||||
<%# XXX dtext_field expects there to be a `post_appeal` instance variable. %>
|
||||
<% @post_appeal = post_appeal %>
|
||||
<%= simple_form_for(@post_appeal, format: :js, remote: true) do |f| %>
|
||||
<%= f.hidden_field :post_id %>
|
||||
<%= dtext_field "post_appeal", "reason", preview_id: "dtext-preview-for-post-appeal" %>
|
||||
<%= dtext_preview_button "post_appeal", "reason", preview_id: "dtext-preview-for-post-appeal" %>
|
||||
<% end %>
|
||||
<%# XXX dtext_field expects there to be a `post_appeal` instance variable. %>
|
||||
<% @post_appeal = post_appeal %>
|
||||
<%= simple_form_for(@post_appeal, format: :js, remote: true) do |f| %>
|
||||
<%= f.hidden_field :post_id %>
|
||||
<%= dtext_field "post_appeal", "reason", preview_id: "dtext-preview-for-post-appeal", type: "string" %>
|
||||
<%= dtext_preview_button "post_appeal", "reason", preview_id: "dtext-preview-for-post-appeal" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
1
app/views/post_appeals/new.js.erb
Normal file
1
app/views/post_appeals/new.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
Danbooru.Utility.dialog("Appeal post", "<%= j render "post_appeals/new", post_appeal: @post_appeal %>");
|
||||
@@ -1,9 +1,13 @@
|
||||
<%= format_text(WikiPage.titled(Danbooru.config.flag_notice_wiki_page).first.try(&:body)) %>
|
||||
<div class="flag-dialog-body">
|
||||
<div class="prose">
|
||||
<%= format_text(WikiPage.titled(Danbooru.config.flag_notice_wiki_page).first.try(&:body)) %>
|
||||
</div>
|
||||
|
||||
<%# XXX dtext_field expects there to be a `post_flag` instance variable. %>
|
||||
<% @post_flag = post_flag %>
|
||||
<%= simple_form_for(@post_flag, format: :js, remote: true) do |f| %>
|
||||
<%= f.hidden_field :post_id %>
|
||||
<%= dtext_field "post_flag", "reason", preview_id: "dtext-preview-for-post-flag", type: "string" %>
|
||||
<%= dtext_preview_button "post_flag", "reason", preview_id: "dtext-preview-for-post-flag" %>
|
||||
<% end %>
|
||||
<%# XXX dtext_field expects there to be a `post_flag` instance variable. %>
|
||||
<% @post_flag = post_flag %>
|
||||
<%= simple_form_for(@post_flag, format: :js, remote: true) do |f| %>
|
||||
<%= f.hidden_field :post_id %>
|
||||
<%= dtext_field "post_flag", "reason", preview_id: "dtext-preview-for-post-flag", type: "string" %>
|
||||
<%= dtext_preview_button "post_flag", "reason", preview_id: "dtext-preview-for-post-flag" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
1
app/views/post_flags/new.js.erb
Normal file
1
app/views/post_flags/new.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
Danbooru.Utility.dialog("Flag post", "<%= j render "post_flags/new", post_flag: @post_flag %>");
|
||||
@@ -1,8 +1,12 @@
|
||||
<%= format_text(WikiPage.titled(Danbooru.config.replacement_notice_wiki_page).first.try(&:body)) %>
|
||||
<div class="replace-image-dialog-body">
|
||||
<div class="prose">
|
||||
<%= format_text(WikiPage.titled(Danbooru.config.replacement_notice_wiki_page).first.try(&:body)) %>
|
||||
</div>
|
||||
|
||||
<%= simple_form_for(post_replacement, url: post_replacements_path(post_id: post_replacement.post_id), method: :post) do |f| %>
|
||||
<%= f.input :replacement_file, label: "File", as: :file %>
|
||||
<%= f.input :replacement_url, label: "Replacement URL", hint: "The source URL to download the replacement from.", as: :string, input_html: { value: post_replacement.post.normalized_source } %>
|
||||
<%= f.input :final_source, label: "Final Source", hint: "If present, the source field will be changed to this after replacement.", as: :string, input_html: { value: post_replacement.post.source } %>
|
||||
<%= f.input :tags, label: "Tags", as: :text, input_html: { value: post_replacement.suggested_tags_for_removal, data: { autocomplete: "tag-edit" } } %>
|
||||
<% end %>
|
||||
<%= simple_form_for(post_replacement, url: post_replacements_path(post_id: post_replacement.post_id), method: :post) do |f| %>
|
||||
<%= f.input :replacement_file, label: "File", as: :file %>
|
||||
<%= f.input :replacement_url, label: "Replacement URL", hint: "The source URL to download the replacement from.", as: :string, input_html: { value: post_replacement.post.normalized_source } %>
|
||||
<%= f.input :final_source, label: "Final Source", hint: "If present, the source field will be changed to this after replacement.", as: :string, input_html: { value: post_replacement.post.source } %>
|
||||
<%= f.input :tags, label: "Tags", as: :string, input_html: { value: post_replacement.suggested_tags_for_removal, data: { autocomplete: "tag-edit" } } %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div id="c-post-replacements">
|
||||
<div id="a-new">
|
||||
<%= render "new", post_replacement: @post.replacements.new %>
|
||||
<%= render "new", post_replacement: @post_replacement %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
1
app/views/post_replacements/new.js.erb
Normal file
1
app/views/post_replacements/new.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
Danbooru.Utility.dialog("Replace image", "<%= j render "post_replacements/new", post_replacement: @post_replacement %>");
|
||||
@@ -22,9 +22,9 @@
|
||||
<li><span id="status-locked-notice">Status locked</span></li>
|
||||
<% else %>
|
||||
<% if !post.is_deleted? && !post.is_pending? && !post.is_flagged? %>
|
||||
<li><%= link_to "Flag", new_post_flag_path(:post_id => post.id), :id => "flag" %></li>
|
||||
<li><%= link_to "Flag", new_post_flag_path(post_flag: { post_id: post.id }), id: "flag", remote: true %></li>
|
||||
<% elsif post.is_flagged? || post.is_deleted? %>
|
||||
<li><%= link_to "Appeal", new_post_appeal_path(:post_id => post.id), :id => "appeal" %></li>
|
||||
<li><%= link_to "Appeal", new_post_appeal_path(post_appeal: { post_id: post.id }), id: "appeal", remote: true %></li>
|
||||
<% end %>
|
||||
|
||||
<% if CurrentUser.can_approve_posts? %>
|
||||
@@ -53,7 +53,7 @@
|
||||
<% end %>
|
||||
|
||||
<% if CurrentUser.is_moderator? %>
|
||||
<li><%= link_to "Replace Image", new_post_replacement_path(:post_id => post.id), :id => "replace-image" %></li>
|
||||
<li><%= link_to "Replace Image", new_post_replacement_path(post_id: post.id), id: "replace-image", remote: true %></li>
|
||||
<li><%= link_to "Down vote report", reports_down_voting_post_path(post_id: post.id) %></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -135,18 +135,6 @@
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div id="flag-dialog" class="prose" title="Flag post" style="display: none;">
|
||||
<%= render "post_flags/new", post_flag: @post.flags.new %>
|
||||
</div>
|
||||
|
||||
<div id="appeal-dialog" class="prose" title="Appeal post" style="display: none;">
|
||||
<%= render "post_appeals/new", post_appeal: @post.appeals.new %>
|
||||
</div>
|
||||
|
||||
<div id="replace-image-dialog" class="prose" title="Replace image" style="display: none;">
|
||||
<%= render "post_replacements/new", post_replacement: @post.replacements.new %>
|
||||
</div>
|
||||
|
||||
<div id="add-to-pool-dialog" title="Add to pool" style="display: none;">
|
||||
<%= render "pool_elements/new" %>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user