diff --git a/app/helpers/posts_helper.rb b/app/helpers/posts_helper.rb
index 8ae733097..f104fbfa6 100644
--- a/app/helpers/posts_helper.rb
+++ b/app/helpers/posts_helper.rb
@@ -19,13 +19,6 @@ module PostsHelper
render "posts/partials/index/search_count", sig: sig
end
- def post_view_count_js
- return unless reportbooru_enabled?
-
- msg = generate_reportbooru_signature(params[:id])
- render "posts/partials/show/view_count", msg: msg
- end
-
def generate_reportbooru_signature(value)
verifier = ActiveSupport::MessageVerifier.new(Danbooru.config.reportbooru_key, serializer: JSON, digest: "SHA256")
verifier.generate("#{value},#{session[:session_id]}")
diff --git a/app/views/posts/partials/show/_embedded.html.erb b/app/views/posts/partials/show/_embedded.html.erb
deleted file mode 100644
index 1f87bad1d..000000000
--- a/app/views/posts/partials/show/_embedded.html.erb
+++ /dev/null
@@ -1,17 +0,0 @@
-<% if post.banblocked? -%>
-
The artist requested removal of this image.
-<% elsif post.levelblocked? -%>
- <%= link_to("You need a gold account to see this image", new_user_upgrade_path) %>.
-<% elsif post.safeblocked? -%>
- This image is unavailable on <%= Danbooru.config.app_name %>. Go to <%= link_to("Danbooru", "https://danbooru.donmai.us") %> or disable safe mode to view (<%= link_to_wiki "learn more", "help:safe_mode" %>).
-<% elsif post.is_flash? -%>
- <%= render("posts/partials/show/flash", post: post) -%>
-<% elsif post.is_video? -%>
- <%= render("posts/partials/show/video", post: post) -%>
-<% elsif post.is_ugoira? -%>
- <%= render("posts/partials/show/ugoira", post: post) -%>
-<% elsif !post.is_image? -%>
- <%= render("posts/partials/show/download", post: post) -%>
-<% elsif post.is_image? -%>
- <%= render("posts/partials/show/image", post: post) -%>
-<% end %>
diff --git a/app/views/posts/partials/show/_information.html.erb b/app/views/posts/partials/show/_information.html.erb
deleted file mode 100644
index c8aeacac4..000000000
--- a/app/views/posts/partials/show/_information.html.erb
+++ /dev/null
@@ -1,50 +0,0 @@
-
- - ID: <%= post.id %>
- -
- Uploader: <%= link_to_user(post.uploader) %>
- <%= link_to "»", posts_path(tags: "user:#{post.uploader.name}") %>
-
- -
- Date: <%= link_to time_ago_in_words_tagged(post.created_at), posts_path(tags: "date:#{post.created_at.to_date}") %>
-
- <% if post.approver %>
- -
- Approver: <%= link_to_user(post.approver) %>
- <%= link_to "»", posts_path(tags: "approver:#{post.approver.name}") %>
-
- <% end %>
- -
- Size: <%= link_to_if policy(post).visible?, "#{number_to_human_size(post.file_size)} .#{post.file_ext}", post.tagged_file_url %>
- (<%= post.image_width %>x<%= post.image_height %>)
- <%= link_to "»", @post.media_asset %>
-
- - Source: <%= post_source_tag(post.source, post.normalized_source) %>
- - Rating: <%= post.pretty_rating %>
- -
- Score: <%= render_post_votes post, current_user: CurrentUser.user %>
-
- -
- Favorites:
- <%= tag.span class: "post-favcount", "data-id": post.id do %>
- <%= link_to post.fav_count, post_favorites_path(post), rel: "nofollow" %>
- <% end %>
-
- -
- Status:
- <% if post.is_pending? %>
- Pending
- <% elsif post.is_flagged? %>
- Flagged
- <% elsif post.is_appealed? %>
- Appealed
- <% elsif post.is_deleted? %>
- Deleted
- <% else %>
- Active
- <% end %>
-
- <% if post.is_banned? %>
- Banned
- <% end %>
-
-
diff --git a/app/views/posts/partials/show/_notices.html.erb b/app/views/posts/partials/show/_notices.html.erb
deleted file mode 100644
index 21d664722..000000000
--- a/app/views/posts/partials/show/_notices.html.erb
+++ /dev/null
@@ -1,60 +0,0 @@
-<% if post.is_banned? %>
-
- The artist requested removal of this page
-
-<% end %>
-
-<% if post.in_modqueue? %>
-
- <% if post.is_pending? %>
- This post is pending approval. (<%= link_to_wiki "learn more", "about:mod_queue" %>)
- <% elsif post.is_flagged? %>
- This post was flagged and is pending approval (<%= link_to_wiki "learn more", "howto:flag" %>)
- <%= render "post_flags/reasons", flag: post.flags.select(&:pending?).last %>
- <% elsif post.is_appealed? %>
- This post was appealed and is pending approval (<%= link_to_wiki "learn more", "about:mod_queue" %>)
- <%= render "post_appeals/reasons", appeal: post.appeals.select(&:pending?).last %>
- <% end %>
-
- <%= render "post_disapprovals/counts", disapprovals: post.disapprovals.order(id: :asc), post: post %>
-
- <% if CurrentUser.user.is_approver? %>
- <%= render "modqueue/quick_mod", post: post %>
- <%= render "post_disapprovals/detailed_rejection_dialog" %>
- <% end %>
-
-<% elsif post.is_deleted? %>
-
- <% if post.flags.succeeded.last.present? %>
-
This post was deleted for the following reason:
- <%= render "post_flags/reasons", flag: post.flags.succeeded.last %>
- <% else %>
-
This post was deleted
- <% end %>
-
- <%= render "post_disapprovals/counts", disapprovals: post.disapprovals.order(id: :asc), post: post %>
-
- <% if CurrentUser.id == post.uploader_id %>
-
If you don't understand why your upload was deleted, you can ask for
- advice in the Upload Feedback Thread on the forum.
- <% end %>
-
-<% end %>
-
-<% if post.parent.present? %>
-
- <%= render "posts/partials/show/parent_notice", parent: post.parent, children: @sibling_posts.to_a %>
-
-<% end %>
-
-<% if post.has_visible_children? %>
-
- <%= render "posts/partials/show/child_notice", parent: post, children: @child_posts.to_a %>
-
-<% end %>
-
-<% if policy(post).visible? && post.has_large? && !post.is_ugoira? && post.resize_percentage.floor < 100 %>
-
- Resized to <%= number_to_percentage post.resize_percentage.floor, precision: 0 %> of original (<%= link_to "view original", post.tagged_file_url, class: "image-view-original-link" %>)
-
-<% end %>
diff --git a/app/views/posts/partials/show/_options.html.erb b/app/views/posts/partials/show/_options.html.erb
deleted file mode 100644
index cc066e73d..000000000
--- a/app/views/posts/partials/show/_options.html.erb
+++ /dev/null
@@ -1,80 +0,0 @@
-
- <% if policy(post).visible? %>
- -
- <%= link_to "Resize to window", "#", class: "image-resize-to-window-link", "data-shortcut": "z" %>
-
- <% end %>
- <% if policy(post).visible? && post.has_large? && !post.is_ugoira? %>
- -
- <%= link_to "View smaller", post.tagged_large_file_url, class: "image-view-large-link" %>
-
- -
- <%= link_to "View original", post.tagged_file_url, class: "image-view-original-link" %>
-
- <% end %>
- -
- <%= link_to "Find similar", iqdb_queries_path(post_id: post.id), ref: "nofollow" %>
-
- <% if policy(post).visible? %>
- -
- <%= link_to "Download", post.tagged_file_url + "?download=1", download: post.presenter.filename_for_download(CurrentUser.user) %>
-
- <% end %>
-
- <% if policy(Favorite).create? %>
- -
- <%= link_to "Favorite", favorites_path(post_id: post.id), remote: true, method: :post, id: "add-to-favorites", "data-shortcut": "f", style: ("display: none;" if @post.favorited_by?(CurrentUser.user)) %>
-
- -
- <%= link_to "Unfavorite", favorite_path(post), remote: true, method: :delete, id: "remove-from-favorites", "data-shortcut": "shift+f", "data-shortcut-when": ":visible", style: ("display: none;" if !@post.favorited_by?(CurrentUser.user)) %>
-
- <% end %>
- <% if policy(post).update? %>
- - <%= link_to "Edit", "#edit", id: "side-edit-link" %>
- - <%= link_to "Add to pool", "#", id: "pool" %>
- -
- <%= link_to "Add note", "#", id: "translate", "data-shortcut": "n" %>
-
- <% if post.has_notes? %>
- - <%= link_to "Copy notes", "#", id: "copy-notes" %>
- <% end %>
-
- <% end %>
- <% if policy(FavoriteGroup).create? %>
- - <%= link_to "Add to fav group", "#", id: "open-favgroup-dialog-link", "data-shortcut": "g" %>
- <% end %>
-
- <% if post.is_active? && policy(PostFlag).create? %>
- - <%= link_to "Flag", new_post_flag_path(post_flag: { post_id: post.id }), remote: true %>
- <% elsif post.is_appealable? && policy(PostAppeal).create? %>
- - <%= link_to "Appeal", new_post_appeal_path(post_appeal: { post_id: post.id }), remote: true %>
- <% end %>
-
- <% if policy(PostApproval).create? %>
- <% if post.is_deleted? && policy(post).move_favorites? %>
- - <%= link_to "Move favorites", confirm_move_favorites_moderator_post_post_path(post_id: post.id) %>
- <% end %>
-
- <% if !post.is_deleted? && policy(post).delete? %>
- - <%= link_to "Delete", post, method: :delete, remote: true %>
- <% end %>
-
- <% if policy(post).unban? %>
- - <%= link_to "Unban", unban_moderator_post_post_path(post), method: :post, "data-confirm": "Are you sure you want to unban this post?" %>
- <% elsif policy(post).ban? %>
- - <%= link_to "Ban", ban_moderator_post_post_path(post), method: :post, "data-confirm": "Are you sure you want to ban this post?" %>
- <% end %>
-
- <% if policy(post).expunge? %>
- - <%= link_to "Expunge", expunge_moderator_post_post_path(post_id: post.id), remote: true, method: :post, "data-confirm": "This will permanently delete this post (meaning the file will be deleted). Are you sure you want to delete this post?" %>
- <% end %>
- <% end %>
-
- <% if policy(PostReplacement).create? %>
- - <%= link_to "Replace image", new_post_replacement_path(post_id: post.id), remote: true %>
- <% end %>
-
- <% if policy(post).regenerate? %>
- - <%= link_to "Regenerate image", post_regenerations_path(post_id: post.id, category: "resizes"), method: :post, "data-confirm": "This will regenerate the posts's thumbnail images. Are you sure?" %>
- <% end %>
-
diff --git a/app/views/posts/partials/show/_view_count.html.erb b/app/views/posts/partials/show/_view_count.html.erb
deleted file mode 100644
index 94473cd59..000000000
--- a/app/views/posts/partials/show/_view_count.html.erb
+++ /dev/null
@@ -1,7 +0,0 @@
-
diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb
index 810489a31..4a7e9aa1d 100644
--- a/app/views/posts/show.html.erb
+++ b/app/views/posts/show.html.erb
@@ -16,12 +16,160 @@
Information
- <%= render "posts/partials/show/information", :post => @post %>
+
+
+ - ID: <%= @post.id %>
+
+ -
+ Uploader: <%= link_to_user(@post.uploader) %>
+ <%= link_to "»", posts_path(tags: "user:#{@post.uploader.name}") %>
+
+
+ -
+ Date: <%= link_to time_ago_in_words_tagged(@post.created_at), posts_path(tags: "date:#{@post.created_at.to_date}") %>
+
+
+ <% if @post.approver %>
+ -
+ Approver: <%= link_to_user(@post.approver) %>
+ <%= link_to "»", posts_path(tags: "approver:#{@post.approver.name}") %>
+
+ <% end %>
+
+ -
+ Size: <%= link_to_if policy(@post).visible?, "#{number_to_human_size(@post.file_size)} .#{@post.file_ext}", @post.tagged_file_url %>
+ (<%= @post.image_width %>x<%= @post.image_height %>)
+ <%= link_to "»", @post.media_asset %>
+
+
+ - Source: <%= post_source_tag(@post.source, @post.normalized_source) %>
+ - Rating: <%= @post.pretty_rating %>
+
+ -
+ Score: <%= render_post_votes @post, current_user: CurrentUser.user %>
+
+
+ -
+ Favorites:
+ <%= tag.span class: "post-favcount", "data-id": @post.id do %>
+ <%= link_to @post.fav_count, post_favorites_path(@post), rel: "nofollow" %>
+ <% end %>
+
+
+ -
+ Status:
+ <% if @post.is_pending? %>
+ Pending
+ <% elsif @post.is_flagged? %>
+ Flagged
+ <% elsif @post.is_appealed? %>
+ Appealed
+ <% elsif @post.is_deleted? %>
+ Deleted
+ <% else %>
+ Active
+ <% end %>
+
+ <% if @post.is_banned? %>
+ Banned
+ <% end %>
+
+
Options
- <%= render "posts/partials/show/options", :post => @post %>
+
+
+ <% if policy(@post).visible? %>
+ -
+ <%= link_to "Resize to window", "#", class: "image-resize-to-window-link", "data-shortcut": "z" %>
+
+ <% end %>
+
+ <% if policy(@post).visible? && @post.has_large? && !@post.is_ugoira? %>
+ -
+ <%= link_to "View smaller", @post.tagged_large_file_url, class: "image-view-large-link" %>
+
+
+ -
+ <%= link_to "View original", @post.tagged_file_url, class: "image-view-original-link" %>
+
+ <% end %>
+
+ -
+ <%= link_to "Find similar", iqdb_queries_path(post_id: @post.id), ref: "nofollow" %>
+
+
+ <% if policy(@post).visible? %>
+ -
+ <%= link_to "Download", @post.tagged_file_url + "?download=1", download: @post.presenter.filename_for_download(CurrentUser.user) %>
+
+ <% end %>
+
+ <% if policy(Favorite).create? %>
+ -
+ <%= link_to "Favorite", favorites_path(post_id: @post.id), remote: true, method: :post, id: "add-to-favorites", "data-shortcut": "f", style: ("display: none;" if @post.favorited_by?(CurrentUser.user)) %>
+
+
+ -
+ <%= link_to "Unfavorite", favorite_path(@post), remote: true, method: :delete, id: "remove-from-favorites", "data-shortcut": "shift+f", "data-shortcut-when": ":visible", style: ("display: none;" if !@post.favorited_by?(CurrentUser.user)) %>
+
+ <% end %>
+
+ <% if policy(@post).update? %>
+ - <%= link_to "Edit", "#edit", id: "side-edit-link" %>
+ - <%= link_to "Add to pool", "#", id: "pool" %>
+
+ -
+ <%= link_to "Add note", "#", id: "translate", "data-shortcut": "n" %>
+
+
+ <% if @post.has_notes? %>
+ - <%= link_to "Copy notes", "#", id: "copy-notes" %>
+ <% end %>
+
+
+ <% end %>
+
+ <% if policy(FavoriteGroup).create? %>
+ - <%= link_to "Add to fav group", "#", id: "open-favgroup-dialog-link", "data-shortcut": "g" %>
+ <% end %>
+
+ <% if @post.is_active? && policy(PostFlag).create? %>
+ - <%= link_to "Flag", new_post_flag_path(post_flag: { post_id: @post.id }), remote: true %>
+ <% elsif @post.is_appealable? && policy(PostAppeal).create? %>
+ - <%= link_to "Appeal", new_post_appeal_path(post_appeal: { post_id: @post.id }), remote: true %>
+ <% end %>
+
+ <% if policy(PostApproval).create? %>
+ <% if @post.is_deleted? && policy(@post).move_favorites? %>
+ - <%= link_to "Move favorites", confirm_move_favorites_moderator_post_post_path(post_id: @post.id) %>
+ <% end %>
+
+ <% if !@post.is_deleted? && policy(@post).delete? %>
+ - <%= link_to "Delete", @post, method: :delete, remote: true %>
+ <% end %>
+
+ <% if policy(@post).unban? %>
+ - <%= link_to "Unban", unban_moderator_post_post_path(@post), method: :post, "data-confirm": "Are you sure you want to unban this post?" %>
+ <% elsif policy(@post).ban? %>
+ - <%= link_to "Ban", ban_moderator_post_post_path(@post), method: :post, "data-confirm": "Are you sure you want to ban this post?" %>
+ <% end %>
+
+ <% if policy(@post).expunge? %>
+ - <%= link_to "Expunge", expunge_moderator_post_post_path(post_id: @post.id), remote: true, method: :post, "data-confirm": "This will permanently delete this post (meaning the file will be deleted). Are you sure you want to delete this post?" %>
+ <% end %>
+ <% end %>
+
+ <% if policy(PostReplacement).create? %>
+ - <%= link_to "Replace image", new_post_replacement_path(post_id: @post.id), remote: true %>
+ <% end %>
+
+ <% if policy(@post).regenerate? %>
+ - <%= link_to "Regenerate image", post_regenerations_path(post_id: @post.id, category: "resizes"), method: :post, "data-confirm": "This will regenerate the posts's thumbnail images. Are you sure?" %>
+ <% end %>
+
@@ -42,10 +190,89 @@
<%= render_post_navbar(@post, current_user: CurrentUser.user, search: params[:q]) %>
<% end %>
- <%= render "posts/partials/show/notices", :post => @post %>
+ <% if @post.is_banned? %>
+
+ The artist requested removal of this page
+
+ <% end %>
+
+ <% if @post.in_modqueue? %>
+
+ <% if @post.is_pending? %>
+ This post is pending approval. (<%= link_to_wiki "learn more", "about:mod_queue" %>)
+ <% elsif @post.is_flagged? %>
+ This post was flagged and is pending approval (<%= link_to_wiki "learn more", "howto:flag" %>)
+ <%= render "post_flags/reasons", flag: @post.flags.select(&:pending?).last %>
+ <% elsif @post.is_appealed? %>
+ This post was appealed and is pending approval (<%= link_to_wiki "learn more", "about:mod_queue" %>)
+ <%= render "post_appeals/reasons", appeal: @post.appeals.select(&:pending?).last %>
+ <% end %>
+
+ <%= render "post_disapprovals/counts", disapprovals: @post.disapprovals.order(id: :asc), post: @post %>
+
+ <% if CurrentUser.user.is_approver? %>
+ <%= render "modqueue/quick_mod", post: @post %>
+ <%= render "post_disapprovals/detailed_rejection_dialog" %>
+ <% end %>
+
+ <% elsif @post.is_deleted? %>
+
+ <% if @post.flags.succeeded.last.present? %>
+
This post was deleted for the following reason:
+ <%= render "post_flags/reasons", flag: @post.flags.succeeded.last %>
+ <% else %>
+
This post was deleted
+ <% end %>
+
+ <%= render "post_disapprovals/counts", disapprovals: @post.disapprovals.order(id: :asc), post: @post %>
+
+ <% if CurrentUser.id == @post.uploader_id %>
+
If you don't understand why your upload was deleted, you can ask for
+ advice in the Upload Feedback Thread on the forum.
+ <% end %>
+
+ <% end %>
+
+ <% if @post.parent.present? %>
+
+ <%= render "posts/partials/show/parent_notice", parent: @post.parent, children: @sibling_posts.to_a %>
+
+ <% end %>
+
+ <% if @post.has_visible_children? %>
+
+ <%= render "posts/partials/show/child_notice", parent: @post, children: @child_posts.to_a %>
+
+ <% end %>
+
+ <% if policy(@post).visible? && @post.has_large? && !@post.is_ugoira? && @post.resize_percentage.floor < 100 %>
+
+ Resized to <%= number_to_percentage @post.resize_percentage.floor, precision: 0 %> of original (<%= link_to "view original", @post.tagged_file_url, class: "image-view-original-link" %>)
+
+ <% end %>
<%= tag.section class: ["image-container", "note-container", ("danbirthday" if is_danbirthday?(@post))], **image_container_data_attributes(@post, CurrentUser.user) do -%>
- <%= render "posts/partials/show/embedded", post: @post %>
+ <% if @post.banblocked? -%>
+ The artist requested removal of this image.
+ <% elsif @post.levelblocked? -%>
+ <%= link_to "You need a gold account to see this image", new_user_upgrade_path %>.
+ <% elsif @post.safeblocked? -%>
+ This image is unavailable on <%= Danbooru.config.app_name %>. Go to <%= link_to "Danbooru", "https://danbooru.donmai.us" %> or disable safe mode to view (<%= link_to_wiki "learn more", "help:safe_mode" %>).
+ <% elsif @post.is_flash? -%>
+ <%= render("posts/partials/show/flash", post: @post) -%>
+ <% elsif @post.is_video? -%>
+ <%= render("posts/partials/show/video", post: @post) -%>
+ <% elsif @post.is_ugoira? -%>
+ <%= render("posts/partials/show/ugoira", post: @post) -%>
+ <% elsif !@post.is_image? -%>
+ <%= render("posts/partials/show/download", post: @post) -%>
+ <% elsif @post.is_image? -%>
+
+ <%= tag.source media: "(max-width: 660px)", srcset: @post.tagged_large_file_url %>
+ <%= tag.img width: @post.image_width_for(CurrentUser.user), height: @post.image_height_for(CurrentUser.user), id: "image", class: "fit-width", alt: @post.presenter.humanized_essential_tag_string, src: @post.file_url_for(CurrentUser.user) %>
+
+ <% end %>
+
<% end -%>
@@ -139,7 +366,15 @@
<% end %>
-<%= post_view_count_js %>
+<% if reportbooru_enabled? %>
+
+<% end %>
<% content_for(:html_header) do %>