From 604b6ce54728ba8233000c20938cd53bb81f529b Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 17 Apr 2022 03:55:50 -0500 Subject: [PATCH] views: inline partials into default layout. Inline the page footer, news updates, the ban notice, and the user verification notice into the default layout. This is a micro optimization to reduce the number of spans reported to the APM. --- app/views/layouts/_main_links.html.erb | 20 ----- app/views/layouts/default.html.erb | 83 +++++++++++++++++-- app/views/news_updates/_listing.html.erb | 11 --- app/views/static/_footer.html.erb | 23 ----- app/views/users/_ban_notice.html.erb | 11 --- app/views/users/_verification_notice.html.erb | 10 --- 6 files changed, 78 insertions(+), 80 deletions(-) delete mode 100644 app/views/layouts/_main_links.html.erb delete mode 100644 app/views/news_updates/_listing.html.erb delete mode 100644 app/views/static/_footer.html.erb delete mode 100644 app/views/users/_ban_notice.html.erb delete mode 100644 app/views/users/_verification_notice.html.erb diff --git a/app/views/layouts/_main_links.html.erb b/app/views/layouts/_main_links.html.erb deleted file mode 100644 index 634614c5c..000000000 --- a/app/views/layouts/_main_links.html.erb +++ /dev/null @@ -1,20 +0,0 @@ - - <% if CurrentUser.is_anonymous? %> - <%= nav_link_to("Login", login_path(url: request.fullpath), rel: "nofollow") %> - <% else %> - <%= nav_link_to("My Account #{unread_dmail_indicator(CurrentUser.user)}", profile_path) %> - <% end %> - <%= nav_link_to("Posts", posts_path) %> - <%= nav_link_to("Comments", comments_path) %> - <%= nav_link_to("Notes", notes_path) %> - <%= nav_link_to("Artists", artists_path) %> - <%= nav_link_to("Tags", tags_path) %> - <%= nav_link_to("Pools", gallery_pools_path) %> - <%= nav_link_to("Wiki", wiki_page_path("help:home")) %> - <%= nav_link_to("Forum", forum_topics_path, :class => (CurrentUser.has_forum_been_updated? ? "forum-updated" : nil)) %> - <% if CurrentUser.is_moderator? %> - <%= nav_link_to("Reports", moderation_reports_path, :class => (ModerationReport.where(status: "pending").present? ? "reports-pending" : nil)) %> - <%= nav_link_to("Dashboard", moderator_dashboard_path) %> - <% end %> - <%= nav_link_to("More »", site_map_path) %> - diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb index 3c69dc1da..d6202b4b7 100644 --- a/app/views/layouts/default.html.erb +++ b/app/views/layouts/default.html.erb @@ -56,8 +56,19 @@ <%= yield :html_header %> <%= raw Danbooru.config.custom_html_header_content %> + <%= tag.body **body_attributes(CurrentUser.user, params, @current_item, @exception) do %> - <%= render "news_updates/listing" %> + <% if NewsUpdate.recent.present? %> + + <% end %>
<%= link_to Danbooru.config.app_name, root_path, id: "app-name-header", class: "font-bold font-header leading-normal" %> @@ -68,7 +79,30 @@
- <%= render "users/verification_notice" %> + <% if CurrentUser.user.is_restricted? && (params[:controller] == "users" || cookies[:hide_verify_account_notice].blank?) %> +
+

Your account is restricted.

+
+ You must verify your account because you signed up from a proxy or a VPN. + <%= link_to "Verify your account now", verify_user_email_path(CurrentUser.user) %>. +
+
<%= link_to "Close this", "#", id: "hide-verify-account-notice" %>
+
+ <% end %> <% if Danbooru.config.is_promotion? && cookies[:hide_winter_sale_notice].blank? %>
@@ -97,7 +140,15 @@ <%= render "users/upgrade_notice" %> <% end %> - <%= render "users/ban_notice" %> + <% if CurrentUser.user.is_banned? %> +
+

You have been banned <%= humanized_duration CurrentUser.user.active_ban.duration %>

+ +
+ Reason: <%= format_text CurrentUser.user.active_ban.reason, inline: true %> +
+
+ <% end %> <% if params[:controller] != "dmails" && has_unread_dmails?(CurrentUser.user) %> <%= render "users/dmail_notice" %> @@ -128,6 +179,28 @@
- <%= render "static/footer" %> +
+ <%= Danbooru.config.app_name %> + / <%= link_to "Rules", terms_of_service_path %> + / <%= link_to "Contact", contact_path %> + / + +
<% end %> diff --git a/app/views/news_updates/_listing.html.erb b/app/views/news_updates/_listing.html.erb deleted file mode 100644 index ae8684144..000000000 --- a/app/views/news_updates/_listing.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -<% if NewsUpdate.recent.present? %> - -<% end %> diff --git a/app/views/static/_footer.html.erb b/app/views/static/_footer.html.erb deleted file mode 100644 index 2dc26ba31..000000000 --- a/app/views/static/_footer.html.erb +++ /dev/null @@ -1,23 +0,0 @@ -
- <%= Danbooru.config.app_name %> - / <%= link_to "Rules", terms_of_service_path %> - / <%= link_to "Contact", contact_path %> - / - -
diff --git a/app/views/users/_ban_notice.html.erb b/app/views/users/_ban_notice.html.erb deleted file mode 100644 index fcc9d8ccf..000000000 --- a/app/views/users/_ban_notice.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -<% if CurrentUser.user.is_banned? %> - <% @active_ban = CurrentUser.user.active_ban %> - -
-

You have been banned <%= humanized_duration @active_ban.duration %>

- -
- Reason: <%= format_text @active_ban.reason, inline: true %> -
-
-<% end %> diff --git a/app/views/users/_verification_notice.html.erb b/app/views/users/_verification_notice.html.erb deleted file mode 100644 index bd8ee22a4..000000000 --- a/app/views/users/_verification_notice.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -<% if CurrentUser.user.is_restricted? && (params[:controller] == "users" || cookies[:hide_verify_account_notice].blank?) %> -
-

Your account is restricted.

-
- You must verify your account because you signed up from a proxy or a VPN. - <%= link_to "Verify your account now", verify_user_email_path(CurrentUser.user) %>. -
-
<%= link_to "Close this", "#", id: "hide-verify-account-notice" %>
-
-<% end %>