diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index cefdb39e9..0f0300cce 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,7 +4,6 @@ class ApplicationController < ActionController::Base before_action :reset_current_user before_action :set_current_user after_action :reset_current_user - before_action :set_title before_action :normalize_search before_action :set_started_at_session before_action :api_check @@ -190,10 +189,6 @@ class ApplicationController < ActionController::Base end end - def set_title - @page_title = Danbooru.config.app_name + "/#{params[:controller]}" - end - # Remove blank `search` params from the url. # # /tags?search[name]=touhou&search[category]=&search[order]= diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9a32f9721..b75d64569 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -198,7 +198,25 @@ module ApplicationHelper [:"#{prefix}-#{name}", value] end.to_h end - + + def page_title + if content_for(:page_title).present? + content_for(:page_title) + elsif action_name == "index" + "#{controller_name.titleize} - #{Danbooru.config.app_name}" + elsif action_name == "show" + "#{controller_name.singularize.titleize} - #{Danbooru.config.app_name}" + elsif action_name == "new" + "New #{controller_name.singularize.titleize} - #{Danbooru.config.app_name}" + elsif action_name == "edit" + "Edit #{controller_name.singularize.titleize} - #{Danbooru.config.app_name}" + elsif action_name == "search" + "Search #{controller_name.titleize} - #{Danbooru.config.app_name}" + else + "#{Danbooru.config.app_name}/#{controller_name}" + end + end + protected def nav_link_match(controller, url) url =~ case controller diff --git a/app/views/artist_commentaries/index.html.erb b/app/views/artist_commentaries/index.html.erb index 0f436650a..1057abdab 100644 --- a/app/views/artist_commentaries/index.html.erb +++ b/app/views/artist_commentaries/index.html.erb @@ -38,7 +38,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - Artist Commentary - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/artist_commentaries/search.html.erb b/app/views/artist_commentaries/search.html.erb index c904e5a27..bc8292a63 100644 --- a/app/views/artist_commentaries/search.html.erb +++ b/app/views/artist_commentaries/search.html.erb @@ -14,7 +14,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - Search Artist Commentary - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/artist_commentary_versions/index.html.erb b/app/views/artist_commentary_versions/index.html.erb index 97929c326..41c24cea5 100644 --- a/app/views/artist_commentary_versions/index.html.erb +++ b/app/views/artist_commentary_versions/index.html.erb @@ -16,7 +16,3 @@ <%= render "artist_commentaries/secondary_links" %> - -<% content_for(:page_title) do %> - Artist Commentary Versions - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/artist_urls/index.html.erb b/app/views/artist_urls/index.html.erb index eaa027766..9dd1e1255 100644 --- a/app/views/artist_urls/index.html.erb +++ b/app/views/artist_urls/index.html.erb @@ -43,7 +43,3 @@ <%= render "artists/secondary_links" %> - -<% content_for(:page_title) do %> - Artist URLs - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/artist_versions/index.html.erb b/app/views/artist_versions/index.html.erb index 824d16685..10b506e3c 100644 --- a/app/views/artist_versions/index.html.erb +++ b/app/views/artist_versions/index.html.erb @@ -8,7 +8,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - Artist Versions - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/artist_versions/search.html.erb b/app/views/artist_versions/search.html.erb index e89c10fca..a9c1c55b3 100644 --- a/app/views/artist_versions/search.html.erb +++ b/app/views/artist_versions/search.html.erb @@ -13,7 +13,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - Search Artist Changes - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/artists/edit.html.erb b/app/views/artists/edit.html.erb index 64c451061..1c22ca9e2 100644 --- a/app/views/artists/edit.html.erb +++ b/app/views/artists/edit.html.erb @@ -16,7 +16,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - Edit Artist - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/artists/index.html.erb b/app/views/artists/index.html.erb index 2b8eca9ba..ff7b6b647 100644 --- a/app/views/artists/index.html.erb +++ b/app/views/artists/index.html.erb @@ -32,7 +32,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - Artists - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/artists/new.html.erb b/app/views/artists/new.html.erb index e3e4faba2..bc37bbebc 100644 --- a/app/views/artists/new.html.erb +++ b/app/views/artists/new.html.erb @@ -9,7 +9,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - New Artist - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/bans/edit.html.erb b/app/views/bans/edit.html.erb index 213413430..553291a1a 100644 --- a/app/views/bans/edit.html.erb +++ b/app/views/bans/edit.html.erb @@ -13,7 +13,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - Edit Ban - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/bans/index.html.erb b/app/views/bans/index.html.erb index e5be766a3..870d32de5 100644 --- a/app/views/bans/index.html.erb +++ b/app/views/bans/index.html.erb @@ -45,7 +45,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - Bans - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/bans/new.html.erb b/app/views/bans/new.html.erb index 5f424706e..32b0f34ec 100644 --- a/app/views/bans/new.html.erb +++ b/app/views/bans/new.html.erb @@ -6,7 +6,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - New Ban - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/bulk_update_requests/edit.html.erb b/app/views/bulk_update_requests/edit.html.erb index 5a46c3c48..db42a8de4 100644 --- a/app/views/bulk_update_requests/edit.html.erb +++ b/app/views/bulk_update_requests/edit.html.erb @@ -6,7 +6,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - Edit Bulk Update Request - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/bulk_update_requests/index.html.erb b/app/views/bulk_update_requests/index.html.erb index 92536b117..75bf9c310 100644 --- a/app/views/bulk_update_requests/index.html.erb +++ b/app/views/bulk_update_requests/index.html.erb @@ -10,7 +10,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - Bulk Update Requests - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/bulk_update_requests/new.html.erb b/app/views/bulk_update_requests/new.html.erb index 1f9ed98f1..7280af32c 100644 --- a/app/views/bulk_update_requests/new.html.erb +++ b/app/views/bulk_update_requests/new.html.erb @@ -7,7 +7,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - New Bulk Update Request - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/bulk_update_requests/show.html.erb b/app/views/bulk_update_requests/show.html.erb index 880d7725b..c4a3fc344 100644 --- a/app/views/bulk_update_requests/show.html.erb +++ b/app/views/bulk_update_requests/show.html.erb @@ -22,7 +22,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - Bulk Update Request - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/comments/edit.html.erb b/app/views/comments/edit.html.erb index b163f50a7..49ae24061 100644 --- a/app/views/comments/edit.html.erb +++ b/app/views/comments/edit.html.erb @@ -7,7 +7,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - Edit Comment - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/comments/index.html.erb b/app/views/comments/index.html.erb index cbc06e8b2..c473d03cd 100644 --- a/app/views/comments/index.html.erb +++ b/app/views/comments/index.html.erb @@ -13,7 +13,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - Comments - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/comments/new.html.erb b/app/views/comments/new.html.erb index 25082c265..1854c471a 100644 --- a/app/views/comments/new.html.erb +++ b/app/views/comments/new.html.erb @@ -7,7 +7,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - New Comment - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/comments/search.html.erb b/app/views/comments/search.html.erb index 359cccfcf..2e82a51be 100644 --- a/app/views/comments/search.html.erb +++ b/app/views/comments/search.html.erb @@ -17,7 +17,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - Search Comments - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/comments/show.html.erb b/app/views/comments/show.html.erb index f07f52ef5..8ee5091c4 100644 --- a/app/views/comments/show.html.erb +++ b/app/views/comments/show.html.erb @@ -17,7 +17,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - Comment - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/delayed_jobs/index.html.erb b/app/views/delayed_jobs/index.html.erb index 62193ab0b..04610e1df 100644 --- a/app/views/delayed_jobs/index.html.erb +++ b/app/views/delayed_jobs/index.html.erb @@ -55,7 +55,3 @@ <%= numbered_paginator(@delayed_jobs) %> - -<% content_for(:page_title) do %> - Delayed Jobs - <%= Danbooru.config.app_name %> -<% end %> \ No newline at end of file diff --git a/app/views/favorite_groups/edit.html.erb b/app/views/favorite_groups/edit.html.erb index fb10a532f..3b4351b12 100644 --- a/app/views/favorite_groups/edit.html.erb +++ b/app/views/favorite_groups/edit.html.erb @@ -14,7 +14,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - Edit Favorite Group - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/favorite_groups/index.html.erb b/app/views/favorite_groups/index.html.erb index 6e30467aa..65d8975f2 100644 --- a/app/views/favorite_groups/index.html.erb +++ b/app/views/favorite_groups/index.html.erb @@ -32,7 +32,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - Favorite Groups - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/favorite_groups/new.html.erb b/app/views/favorite_groups/new.html.erb index 91013659c..8fa1f6833 100644 --- a/app/views/favorite_groups/new.html.erb +++ b/app/views/favorite_groups/new.html.erb @@ -13,7 +13,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - New Favorite Group - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/forum_posts/edit.html.erb b/app/views/forum_posts/edit.html.erb index a2df840fc..17d2d0812 100644 --- a/app/views/forum_posts/edit.html.erb +++ b/app/views/forum_posts/edit.html.erb @@ -7,7 +7,3 @@ <%= render "forum_topics/secondary_links" %> - -<% content_for(:page_title) do %> - Edit Forum Post - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/forum_posts/index.html.erb b/app/views/forum_posts/index.html.erb index 9613706a6..4743c127f 100644 --- a/app/views/forum_posts/index.html.erb +++ b/app/views/forum_posts/index.html.erb @@ -30,7 +30,3 @@ <%= render "forum_topics/secondary_links" %> - -<% content_for(:page_title) do %> - Forum Posts - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/forum_posts/new.html.erb b/app/views/forum_posts/new.html.erb index cbe4189bb..5cb4bc67a 100644 --- a/app/views/forum_posts/new.html.erb +++ b/app/views/forum_posts/new.html.erb @@ -11,7 +11,3 @@ <%= render "forum_topics/secondary_links" %> - -<% content_for(:page_title) do %> - New Forum Post - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/forum_posts/search.html.erb b/app/views/forum_posts/search.html.erb index 21ccd9a5a..4caa22276 100644 --- a/app/views/forum_posts/search.html.erb +++ b/app/views/forum_posts/search.html.erb @@ -15,7 +15,3 @@ <%= render "forum_topics/secondary_links" %> - -<% content_for(:page_title) do %> - Search Forum Posts - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/forum_posts/show.html.erb b/app/views/forum_posts/show.html.erb index 839d1020f..44c844784 100644 --- a/app/views/forum_posts/show.html.erb +++ b/app/views/forum_posts/show.html.erb @@ -6,7 +6,3 @@ <%= render "forum_topics/secondary_links" %> - -<% content_for(:page_title) do %> - Forum Post - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/forum_topics/edit.html.erb b/app/views/forum_topics/edit.html.erb index cbb67c4a1..0c129aef2 100644 --- a/app/views/forum_topics/edit.html.erb +++ b/app/views/forum_topics/edit.html.erb @@ -5,7 +5,3 @@ <%= render "form", :forum_topic => @forum_topic %> - -<% content_for(:page_title) do %> - Edit Forum Topic - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/forum_topics/new.html.erb b/app/views/forum_topics/new.html.erb index 82c98c2e9..c45f51477 100644 --- a/app/views/forum_topics/new.html.erb +++ b/app/views/forum_topics/new.html.erb @@ -7,7 +7,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - New Forum Topic - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/ip_bans/index.html.erb b/app/views/ip_bans/index.html.erb index 323953d26..d69f92ef2 100644 --- a/app/views/ip_bans/index.html.erb +++ b/app/views/ip_bans/index.html.erb @@ -28,7 +28,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - IP Bans - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/ip_bans/new.html.erb b/app/views/ip_bans/new.html.erb index eb2372177..a0219ea8a 100644 --- a/app/views/ip_bans/new.html.erb +++ b/app/views/ip_bans/new.html.erb @@ -13,7 +13,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - New IP Ban - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/janitor_trials/index.html.erb b/app/views/janitor_trials/index.html.erb index e37158688..bc053c072 100644 --- a/app/views/janitor_trials/index.html.erb +++ b/app/views/janitor_trials/index.html.erb @@ -27,7 +27,3 @@ <%= render "secondary_links" %> - -<% content_for(:page_title) do %> - Janitor Trials - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/janitor_trials/new.html.erb b/app/views/janitor_trials/new.html.erb index d18017484..be6989053 100644 --- a/app/views/janitor_trials/new.html.erb +++ b/app/views/janitor_trials/new.html.erb @@ -15,6 +15,3 @@ <%= render "secondary_links" %> -<% content_for(:page_title) do %> - New Janitor - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/layouts/blank.html.erb b/app/views/layouts/blank.html.erb index d80cca2db..0ef6c70b3 100644 --- a/app/views/layouts/blank.html.erb +++ b/app/views/layouts/blank.html.erb @@ -1,7 +1,7 @@
-