parent
8368f90310
commit
03356be588
2 changed files with 5 additions and 1 deletions
|
@ -5,7 +5,7 @@ module TitleHelper
|
||||||
@coder ||= HTMLEntities.new
|
@coder ||= HTMLEntities.new
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_title(title = false)
|
def set_title(title = nil)
|
||||||
if title
|
if title
|
||||||
@title = TitleHelper.coder.decode(title.gsub("<bdi>", "\u202a").gsub("</bdi>", "\u202c"))
|
@title = TitleHelper.coder.decode(title.gsub("<bdi>", "\u202a").gsub("</bdi>", "\u202c"))
|
||||||
response.headers["X-Page-Title"] = URI.escape(t("layouts.project_name.title") + " | " + @title)
|
response.headers["X-Page-Title"] = URI.escape(t("layouts.project_name.title") + " | " + @title)
|
||||||
|
|
|
@ -3,6 +3,10 @@ require "test_helper"
|
||||||
|
|
||||||
class TitleHelperTest < ActionView::TestCase
|
class TitleHelperTest < ActionView::TestCase
|
||||||
def test_set_title
|
def test_set_title
|
||||||
|
set_title
|
||||||
|
assert_equal "OpenStreetMap", response.header["X-Page-Title"]
|
||||||
|
assert_nil @title
|
||||||
|
|
||||||
set_title(nil)
|
set_title(nil)
|
||||||
assert_equal "OpenStreetMap", response.header["X-Page-Title"]
|
assert_equal "OpenStreetMap", response.header["X-Page-Title"]
|
||||||
assert_nil @title
|
assert_nil @title
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue