]> git.openstreetmap.org Git - rails.git/blob - app/helpers/note_helper.rb
Switches from comments to all_comments
[rails.git] / app / helpers / note_helper.rb
1 module NoteHelper
2   include ActionView::Helpers::TranslationHelper
3
4   def note_description(author, description)
5     if !author.nil? && author.status == "deleted"
6       RichText.new("text", t("notes.show.description_when_author_is_deleted"))
7     else
8       description
9     end
10   end
11
12   def note_event(event, at, by)
13     if by.nil?
14       t("notes.show.event_#{event}_by_anonymous_html",
15         :time_ago => friendly_date_ago(at))
16     else
17       t("notes.show.event_#{event}_by_html",
18         :time_ago => friendly_date_ago(at),
19         :user => note_author(by))
20     end
21   end
22
23   def note_author(author, link_options = {})
24     if author.nil?
25       ""
26     elsif author.status == "deleted"
27       t("users.no_such_user.deleted")
28     else
29       link_to h(author.display_name), link_options.merge(:controller => "/users", :action => "show", :display_name => author.display_name),
30               :class => "mw-100 d-inline-block align-bottom text-truncate text-wrap", :dir => "auto"
31     end
32   end
33 end