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

Options

- <%= render "posts/partials/show/options", :post => @post %> + +
@@ -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 %>