Adds helper routine note_description

Adds new helper routine note_description for retrieving note's description. Helper routine returns "deleted" if author is deleted otherwise note's description.
This commit is contained in:
Nenad Vujicic 2025-01-23 16:16:51 +01:00
parent 68481fe775
commit a6d7c772e5
2 changed files with 9 additions and 0 deletions

View file

@ -1,6 +1,14 @@
module NoteHelper module NoteHelper
include ActionView::Helpers::TranslationHelper include ActionView::Helpers::TranslationHelper
def note_description(author, description)
if !author.nil? && author.status == "deleted"
RichText.new("text", t("notes.show.description_when_author_is_deleted"))
else
description
end
end
def note_event(event, at, by) def note_event(event, at, by)
if by.nil? if by.nil?
t("notes.show.event_#{event}_by_anonymous_html", t("notes.show.event_#{event}_by_anonymous_html",

View file

@ -3069,6 +3069,7 @@ en:
open_title: "Unresolved note #%{note_name}" open_title: "Unresolved note #%{note_name}"
closed_title: "Resolved note #%{note_name}" closed_title: "Resolved note #%{note_name}"
hidden_title: "Hidden note #%{note_name}" hidden_title: "Hidden note #%{note_name}"
description_when_author_is_deleted: "deleted"
event_opened_by_html: "Created by %{user} %{time_ago}" event_opened_by_html: "Created by %{user} %{time_ago}"
event_opened_by_anonymous_html: "Created by anonymous %{time_ago}" event_opened_by_anonymous_html: "Created by anonymous %{time_ago}"
event_commented_by_html: "Comment from %{user} %{time_ago}" event_commented_by_html: "Comment from %{user} %{time_ago}"