Improve display of anonymous note comments
This commit is contained in:
parent
0b993e5ce0
commit
2ef58f47a2
5 changed files with 27 additions and 13 deletions
|
@ -99,12 +99,4 @@ module ApplicationHelper
|
|||
def friendly_date(date)
|
||||
content_tag(:span, time_ago_in_words(date), :title => l(date, :format => :friendly))
|
||||
end
|
||||
|
||||
def note_author(object, link_options = {})
|
||||
if object.author.nil?
|
||||
""
|
||||
else
|
||||
link_to h(object.author.display_name), link_options.merge({:controller => "user", :action => "view", :display_name => object.author.display_name})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
13
app/helpers/note_helper.rb
Normal file
13
app/helpers/note_helper.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
module NoteHelper
|
||||
def note_event(at, by)
|
||||
if by.nil?
|
||||
I18n.t("browse.note.at_html", :when => friendly_date(at)).html_safe
|
||||
else
|
||||
I18n.t("browse.note.at_by_html", :when => friendly_date(at), :user => note_author(by)).html_safe
|
||||
end
|
||||
end
|
||||
|
||||
def note_author(author, link_options = {})
|
||||
link_to h(author.display_name), link_options.merge({:controller => "user", :action => "view", :display_name => author.display_name})
|
||||
end
|
||||
end
|
|
@ -18,18 +18,18 @@
|
|||
<div class='browse-section common'>
|
||||
<div>
|
||||
<h4><%= t "browse.note.opened" %></h4>
|
||||
<p><%= t "browse.note.at_by_html", :when => friendly_date(@note.created_at), :user => note_author(@note) %></p>
|
||||
<p><%= note_event(@note.created_at, @note.author) %></p>
|
||||
</div>
|
||||
|
||||
<% if @note.status == "closed" %>
|
||||
<div>
|
||||
<h4><%= t "browse.note.closed" %></h4>
|
||||
<p><%= t "browse.note.at_by_html", :when => friendly_date(@note.closed_at), :user => note_author(@note.comments.last) %></p>
|
||||
<p><%= note_event(@note.closed_at, @note.comments.last.author) %></p>
|
||||
</div>
|
||||
<% elsif @note.comments.length > 1 %>
|
||||
<div>
|
||||
<h4><%= t "browse.note.last_modified" %></h4>
|
||||
<p><%= t "browse.note.at_by_html", :when => friendly_date(@note.updated_at), :user => note_author(@note.comments.last) %></p>
|
||||
<p><%= note_event(@note.updated_at, @note.comments.last.author) %></p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
@ -51,7 +51,7 @@
|
|||
<% @note.comments[1..-1].each do |comment| %>
|
||||
<li>
|
||||
<%= comment.body.to_html %>
|
||||
<small class="deemphasize"><%= t "browse.note.at_by_html", :when => friendly_date(comment.created_at), :user => note_author(comment) %></small>
|
||||
<small class="deemphasize"><%= note_event(comment.created_at, comment.author) %></small>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
<div>
|
||||
<% description.comments.each do |comment| -%>
|
||||
<div class="note-comment" style="margin-top: 5px">
|
||||
<div class="note-comment-description" style="font-size: smaller; color: #999999"><%= t "note.description.#{comment.event}_at_by", :when => friendly_date(comment.created_at), :user => note_author(comment, :only_path => false) %></div>
|
||||
<% if comment.author.nil> -%>
|
||||
<div class="note-comment-description" style="font-size: smaller; color: #999999"><%= t "note.description.#{comment.event}_at", :when => friendly_date(comment.created_at) %></div>
|
||||
<% else -%>
|
||||
<div class="note-comment-description" style="font-size: smaller; color: #999999"><%= t "note.description.#{comment.event}_at_by", :when => friendly_date(comment.created_at), :user => note_author(comment.author, :only_path => false) %></div>
|
||||
<% end -%>
|
||||
<div class="note-comment-text"><%= comment.body %></div>
|
||||
</div>
|
||||
<% end -%>
|
||||
|
|
|
@ -288,6 +288,7 @@ en:
|
|||
opened: "Opened:"
|
||||
last_modified: "Last modified:"
|
||||
closed: "Closed:"
|
||||
at_html: "%{when} ago"
|
||||
at_by_html: "%{when} ago by %{user}"
|
||||
description: "Description:"
|
||||
comments: "Comments:"
|
||||
|
@ -1979,9 +1980,13 @@ en:
|
|||
needs_view: "The user needs to log in before this block will be cleared."
|
||||
note:
|
||||
description:
|
||||
opened_at: "Created %{when} ago"
|
||||
opened_at_by: "Created %{when} ago by %{user}"
|
||||
commented_at: "Updated %{when} ago"
|
||||
commented_at_by: "Updated %{when} ago by %{user}"
|
||||
closed_at: "Resolved %{when} ago"
|
||||
closed_at_by: "Resolved %{when} ago by %{user}"
|
||||
reopened_at: "Reactivated %{when} ago"
|
||||
reopened_at_by: "Reactivated %{when} ago by %{user}"
|
||||
rss:
|
||||
title: "OpenStreetMap Notes"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue