]> git.openstreetmap.org Git - rails.git/blob - app/helpers/title_helper.rb
Update to rails 7.2.1.1
[rails.git] / app / helpers / title_helper.rb
1 module TitleHelper
2   def self.coder
3     @coder ||= HTMLEntities.new
4   end
5
6   def set_title(title = nil)
7     project_title = t("layouts.project_name.title")
8
9     if title
10       @title = TitleHelper.coder.decode(title.gsub("<bdi>", "\u202a").gsub("</bdi>", "\u202c"))
11       response.headers["X-Page-Title"] = ERB::Util.u("#{@title} | #{project_title}")
12     else
13       @title = title
14       response.headers["X-Page-Title"] = ERB::Util.u(project_title)
15     end
16   end
17 end