Rework note events to avoid raw html in translations
This commit is contained in:
parent
aebac722c2
commit
fad3aedbbb
3 changed files with 17 additions and 17 deletions
|
@ -3,13 +3,13 @@ module NoteHelper
|
|||
|
||||
def note_event(event, at, by)
|
||||
if by.nil?
|
||||
t("notes.show.#{event}_by_anonymous_html",
|
||||
:when => friendly_date_ago(at),
|
||||
:exact_time => l(at))
|
||||
t("notes.show.event_#{event}_by_anonymous_html",
|
||||
:time_ago => tag.abbr(friendly_date_ago(at),
|
||||
:title => l(at)))
|
||||
else
|
||||
t("notes.show.#{event}_by_html",
|
||||
:when => friendly_date_ago(at),
|
||||
:exact_time => l(at),
|
||||
t("notes.show.event_#{event}_by_html",
|
||||
:time_ago => tag.abbr(friendly_date_ago(at),
|
||||
:title => l(at)),
|
||||
:user => note_author(by))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2880,15 +2880,15 @@ en:
|
|||
open_title: "Unresolved note #%{note_name}"
|
||||
closed_title: "Resolved note #%{note_name}"
|
||||
hidden_title: "Hidden note #%{note_name}"
|
||||
opened_by_html: "Created by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
|
||||
opened_by_anonymous_html: "Created by anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
|
||||
commented_by_html: "Comment from %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
|
||||
commented_by_anonymous_html: "Comment from anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
|
||||
closed_by_html: "Resolved by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
|
||||
closed_by_anonymous_html: "Resolved by anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
|
||||
reopened_by_html: "Reactivated by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
|
||||
reopened_by_anonymous_html: "Reactivated by anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
|
||||
hidden_by_html: "Hidden by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
|
||||
event_opened_by_html: "Created by %{user} %{time_ago}"
|
||||
event_opened_by_anonymous_html: "Created by anonymous %{time_ago}"
|
||||
event_commented_by_html: "Comment from %{user} %{time_ago}"
|
||||
event_commented_by_anonymous_html: "Comment from anonymous %{time_ago}"
|
||||
event_closed_by_html: "Resolved by %{user} %{time_ago}"
|
||||
event_closed_by_anonymous_html: "Resolved by anonymous %{time_ago}"
|
||||
event_reopened_by_html: "Reactivated by %{user} %{time_ago}"
|
||||
event_reopened_by_anonymous_html: "Reactivated by anonymous %{time_ago}"
|
||||
event_hidden_by_html: "Hidden by %{user} %{time_ago}"
|
||||
report: report this note
|
||||
coordinates_html: "%{latitude}, %{longitude}"
|
||||
anonymous_warning: This note includes comments from anonymous users which should be independently verified.
|
||||
|
|
|
@ -8,8 +8,8 @@ class NoteHelperTest < ActionView::TestCase
|
|||
date = Time.new(2014, 3, 5, 21, 37, 45, "+00:00")
|
||||
user = create(:user)
|
||||
|
||||
assert_match %r{^Created by anonymous <abbr title='Wed, 05 Mar 2014 21:37:45 \+0000'><span title=" 5 March 2014 at 21:37">.* ago</span></abbr>$}, note_event("opened", date, nil)
|
||||
assert_match %r{^Resolved by <a href="/user/#{ERB::Util.u(user.display_name)}">#{user.display_name}</a> <abbr title='Wed, 05 Mar 2014 21:37:45 \+0000'><span title=" 5 March 2014 at 21:37">.* ago</span></abbr>$}, note_event("closed", date, user)
|
||||
assert_match %r{^Created by anonymous <abbr title="Wed, 05 Mar 2014 21:37:45 \+0000"><span title=" 5 March 2014 at 21:37">.* ago</span></abbr>$}, note_event("opened", date, nil)
|
||||
assert_match %r{^Resolved by <a href="/user/#{ERB::Util.u(user.display_name)}">#{user.display_name}</a> <abbr title="Wed, 05 Mar 2014 21:37:45 \+0000"><span title=" 5 March 2014 at 21:37">.* ago</span></abbr>$}, note_event("closed", date, user)
|
||||
end
|
||||
|
||||
def test_note_author
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue