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