diff --git a/app/helpers/posts_helper.rb b/app/helpers/posts_helper.rb index 46190d915..9a0bfe151 100644 --- a/app/helpers/posts_helper.rb +++ b/app/helpers/posts_helper.rb @@ -8,15 +8,11 @@ module PostsHelper end def missed_post_search_count_js(tags) - return unless reportbooru_enabled? - sig = generate_reportbooru_signature(tags) render "posts/partials/index/missed_search_count", sig: sig end def post_search_count_js(tags) - return unless reportbooru_enabled? - sig = generate_reportbooru_signature("ps-#{tags}") render "posts/partials/index/search_count", sig: sig end diff --git a/app/views/posts/index.html.erb b/app/views/posts/index.html.erb index 632b0c3c5..5cd071257 100644 --- a/app/views/posts/index.html.erb +++ b/app/views/posts/index.html.erb @@ -1,7 +1,21 @@ <% content_for(:sidebar) do %> <%= render "posts/partials/common/search", :path => posts_path, :tags => params[:tags], :tags_dom_id => "tags" %> - <%= render "posts/partials/index/mode_menu" %> + <% if policy(Post).can_use_mode_menu? %> +
+

Mode

+
+ +
+ +
+ <% end %> <%= render "posts/partials/index/blacklist" %> @@ -10,9 +24,35 @@ <%= render_search_tag_list(@post_set.related_tags, current_query: params[:tags], show_extra_links: policy(Post).show_extra_links?, search_params: { view: params[:view], size: params[:size] }) %> - <%= render "posts/partials/index/options" %> +
+

Options

+ +
- <%= render "posts/partials/index/related", post_set: @post_set %> + <% end %> <% content_for(:content) do %> @@ -103,9 +143,125 @@ <% end %> - <%= render "posts/partials/index/edit" %> - <%= render "posts/partials/index/excerpt", :post_set => @post_set %> - <%= render "posts/partials/index/posts", :post_set => @post_set %> + + + + +
+ <% if @post_set.shown_posts.empty? %> + <%= render "post_sets/blank" %> + <% else %> + <%= render_post_gallery(@post_set.posts, show_deleted: @post_set.show_deleted?, tags: @post_set.tag_string, show_votes: @post_set.show_votes?, size: params[:size]) do |gallery, posts| %> + <% gallery.footer do %> + <% if @post_set.hidden_posts.present? %> +
+ <% if @post_set.banned_posts.present? %> + <%= @post_set.banned_posts.size %> post(s) were removed from this page at the artist's request (<%= link_to_wiki "learn more", "banned_artist" %>).
+ <% end %> + + <% if @post_set.censored_posts.present? %> + <%= @post_set.censored_posts.size %> post(s) on this page require a <%= link_to "Gold account", new_user_upgrade_path %> to view (<%= link_to_wiki "learn more", "help:censored_tags" %>).
+ <% end %> + + <% if @post_set.safe_posts.present? %> + <%= @post_set.safe_posts.size %> post(s) on this page were hidden by safe mode. Go to <%= link_to "Danbooru", "https://danbooru.donmai.us" %> or disable safe mode to view them (<%= link_to_wiki "learn more", "help:user_settings" %>).
+ <% end %> +
+ <% end %> + + <% if !CurrentUser.user.is_anonymous? && @post_set.tag.present? && @post_set.current_page == 1 %> + <% cache("tag-change-notice:#{@post_set.tag.name}", expires_in: 4.hours) do %> + <% if @post_set.pending_bulk_update_requests.present? %> +
+

+ This tag is being discussed in + <%= to_sentence @post_set.pending_bulk_update_requests.map { |bur| link_to "Topic ##{bur.forum_topic_id}: #{bur.forum_topic.title}", bur.forum_post } %>. +

+
+ <% end %> + <% end %> + <% end %> + + <%= numbered_paginator(posts) %> + <% end %> + <% end %> + <% end %> +
<% end %>
@@ -118,7 +274,7 @@ <%= render "posts/partials/common/secondary_links" %> <% end %> -<% if @post_set.query.is_simple_tag? && @post_set.current_page == 1 %> +<% if reportbooru_enabled? && @post_set.query.is_simple_tag? && @post_set.current_page == 1 %> <% if @post_set.post_count == 0 %> <%= missed_post_search_count_js(@post_set.query.to_s) %> <% else %> @@ -127,5 +283,33 @@ <% end %> <% content_for(:html_header) do %> - <%= render "posts/partials/index/seo_meta_tags" %> + <% if @post_set.query.is_empty_search? %> + <% page_title("#{Danbooru.config.app_name}: Anime Image Board", suffix: nil) %> + <% meta_description site_description %> + + <% atom_feed_tag "Posts", posts_url(format: :atom) %> + <% else %> + <% page_title("#{@post_set.humanized_tag_string} Art") %> + <% meta_description("See over #{number_with_delimiter(@post_set.post_count)} #{@post_set.humanized_tag_string} images on #{Danbooru.config.app_name}. #{DText.excerpt(@post_set.wiki_page&.body)}") %> + + <% atom_feed_tag "Posts: #{@post_set.tag_string}", posts_url(tags: @post_set.tag_string, format: :atom) %> + <% end %> + + <% if params[:tags].blank? && @post_set.current_page == 1 %> + <% canonical_url root_url(host: Danbooru.config.hostname) %> + <% else %> + <% canonical_url posts_url(host: Danbooru.config.hostname, tags: params[:tags], page: params[:page], limit: params[:limit]) %> + <% end %> + + <% noindex if @post_set.hide_from_crawler? %> + + <% if @post_set.has_explicit? %> + + <% end %> + + <% if @post_set.best_post.present? %> + <%= tag.meta property: "og:image", content: @post_set.best_post.open_graph_image_url %> + <%= tag.meta name: "twitter:image", content: @post_set.best_post.open_graph_image_url %> + <%= tag.meta name: "twitter:card", content: "summary_large_image" %> + <% end %> <% end %> diff --git a/app/views/posts/partials/index/_edit.html.erb b/app/views/posts/partials/index/_edit.html.erb deleted file mode 100644 index 39c6d806a..000000000 --- a/app/views/posts/partials/index/_edit.html.erb +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/app/views/posts/partials/index/_excerpt.html.erb b/app/views/posts/partials/index/_excerpt.html.erb deleted file mode 100644 index 8933993f6..000000000 --- a/app/views/posts/partials/index/_excerpt.html.erb +++ /dev/null @@ -1,70 +0,0 @@ -<%# post_set %> - - diff --git a/app/views/posts/partials/index/_mode_menu.html.erb b/app/views/posts/partials/index/_mode_menu.html.erb deleted file mode 100644 index 27532d96f..000000000 --- a/app/views/posts/partials/index/_mode_menu.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -<% if policy(Post).can_use_mode_menu? %> -
-

Mode

-
- -
- -
-<% end %> diff --git a/app/views/posts/partials/index/_options.html.erb b/app/views/posts/partials/index/_options.html.erb deleted file mode 100644 index 16c582ad0..000000000 --- a/app/views/posts/partials/index/_options.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -
-

Options

- -
diff --git a/app/views/posts/partials/index/_posts.html.erb b/app/views/posts/partials/index/_posts.html.erb deleted file mode 100644 index 18247f84e..000000000 --- a/app/views/posts/partials/index/_posts.html.erb +++ /dev/null @@ -1,40 +0,0 @@ -
- <% if post_set.shown_posts.empty? %> - <%= render "post_sets/blank" %> - <% else %> - <%= render_post_gallery(post_set.posts, show_deleted: post_set.show_deleted?, tags: post_set.tag_string, show_votes: post_set.show_votes?, size: params[:size]) do |gallery, posts| %> - <% gallery.footer do %> - <% if post_set.hidden_posts.present? %> -
- <% if post_set.banned_posts.present? %> - <%= post_set.banned_posts.size %> post(s) were removed from this page at the artist's request (<%= link_to_wiki "learn more", "banned_artist" %>).
- <% end %> - - <% if post_set.censored_posts.present? %> - <%= post_set.censored_posts.size %> post(s) on this page require a <%= link_to "Gold account", new_user_upgrade_path %> to view (<%= link_to_wiki "learn more", "help:censored_tags" %>).
- <% end %> - - <% if post_set.safe_posts.present? %> - <%= post_set.safe_posts.size %> post(s) on this page were hidden by safe mode. Go to <%= link_to "Danbooru", "https://danbooru.donmai.us" %> or disable safe mode to view them (<%= link_to_wiki "learn more", "help:user_settings" %>).
- <% end %> -
- <% end %> - - <% if !CurrentUser.user.is_anonymous? && post_set.tag.present? && post_set.current_page == 1 %> - <% cache("tag-change-notice:#{post_set.tag.name}", expires_in: 4.hours) do %> - <% if post_set.pending_bulk_update_requests.present? %> -
-

- This tag is being discussed in - <%= to_sentence post_set.pending_bulk_update_requests.map { |bur| link_to "Topic ##{bur.forum_topic_id}: #{bur.forum_topic.title}", bur.forum_post } %>. -

-
- <% end %> - <% end %> - <% end %> - - <%= numbered_paginator(posts) %> - <% end %> - <% end %> - <% end %> -
diff --git a/app/views/posts/partials/index/_related.html.erb b/app/views/posts/partials/index/_related.html.erb deleted file mode 100644 index 4a0333395..000000000 --- a/app/views/posts/partials/index/_related.html.erb +++ /dev/null @@ -1,20 +0,0 @@ - diff --git a/app/views/posts/partials/index/_seo_meta_tags.html.erb b/app/views/posts/partials/index/_seo_meta_tags.html.erb deleted file mode 100644 index 382f13e4b..000000000 --- a/app/views/posts/partials/index/_seo_meta_tags.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -<% if @post_set.query.is_empty_search? %> - <% page_title("#{Danbooru.config.app_name}: Anime Image Board", suffix: nil) %> - <% meta_description site_description %> - - <% atom_feed_tag "Posts", posts_url(format: :atom) %> -<% else %> - <% page_title("#{@post_set.humanized_tag_string} Art") %> - <% meta_description("See over #{number_with_delimiter(@post_set.post_count)} #{@post_set.humanized_tag_string} images on #{Danbooru.config.app_name}. #{DText.excerpt(@post_set.wiki_page&.body)}") %> - - <% atom_feed_tag "Posts: #{@post_set.tag_string}", posts_url(tags: @post_set.tag_string, format: :atom) %> -<% end %> - -<% if params[:tags].blank? && @post_set.current_page == 1 %> - <% canonical_url root_url(host: Danbooru.config.hostname) %> -<% else %> - <% canonical_url posts_url(host: Danbooru.config.hostname, tags: params[:tags], page: params[:page], limit: params[:limit]) %> -<% end %> - -<% noindex if @post_set.hide_from_crawler? %> - -<% if @post_set.has_explicit? %> - -<% end %> - -<% if @post_set.best_post.present? %> - <%= tag.meta property: "og:image", content: @post_set.best_post.open_graph_image_url %> - <%= tag.meta name: "twitter:image", content: @post_set.best_post.open_graph_image_url %> - <%= tag.meta name: "twitter:card", content: "summary_large_image" %> -<% end %>