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)
|
def friendly_date(date)
|
||||||
content_tag(:span, time_ago_in_words(date), :title => l(date, :format => :friendly))
|
content_tag(:span, time_ago_in_words(date), :title => l(date, :format => :friendly))
|
||||||
end
|
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
|
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 class='browse-section common'>
|
||||||
<div>
|
<div>
|
||||||
<h4><%= t "browse.note.opened" %></h4>
|
<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>
|
</div>
|
||||||
|
|
||||||
<% if @note.status == "closed" %>
|
<% if @note.status == "closed" %>
|
||||||
<div>
|
<div>
|
||||||
<h4><%= t "browse.note.closed" %></h4>
|
<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>
|
</div>
|
||||||
<% elsif @note.comments.length > 1 %>
|
<% elsif @note.comments.length > 1 %>
|
||||||
<div>
|
<div>
|
||||||
<h4><%= t "browse.note.last_modified" %></h4>
|
<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>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
<% @note.comments[1..-1].each do |comment| %>
|
<% @note.comments[1..-1].each do |comment| %>
|
||||||
<li>
|
<li>
|
||||||
<%= comment.body.to_html %>
|
<%= 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>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
<div>
|
<div>
|
||||||
<% description.comments.each do |comment| -%>
|
<% description.comments.each do |comment| -%>
|
||||||
<div class="note-comment" style="margin-top: 5px">
|
<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 class="note-comment-text"><%= comment.body %></div>
|
||||||
</div>
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
|
@ -288,6 +288,7 @@ en:
|
||||||
opened: "Opened:"
|
opened: "Opened:"
|
||||||
last_modified: "Last modified:"
|
last_modified: "Last modified:"
|
||||||
closed: "Closed:"
|
closed: "Closed:"
|
||||||
|
at_html: "%{when} ago"
|
||||||
at_by_html: "%{when} ago by %{user}"
|
at_by_html: "%{when} ago by %{user}"
|
||||||
description: "Description:"
|
description: "Description:"
|
||||||
comments: "Comments:"
|
comments: "Comments:"
|
||||||
|
@ -1979,9 +1980,13 @@ en:
|
||||||
needs_view: "The user needs to log in before this block will be cleared."
|
needs_view: "The user needs to log in before this block will be cleared."
|
||||||
note:
|
note:
|
||||||
description:
|
description:
|
||||||
|
opened_at: "Created %{when} ago"
|
||||||
opened_at_by: "Created %{when} ago by %{user}"
|
opened_at_by: "Created %{when} ago by %{user}"
|
||||||
|
commented_at: "Updated %{when} ago"
|
||||||
commented_at_by: "Updated %{when} ago by %{user}"
|
commented_at_by: "Updated %{when} ago by %{user}"
|
||||||
|
closed_at: "Resolved %{when} ago"
|
||||||
closed_at_by: "Resolved %{when} ago by %{user}"
|
closed_at_by: "Resolved %{when} ago by %{user}"
|
||||||
|
reopened_at: "Reactivated %{when} ago"
|
||||||
reopened_at_by: "Reactivated %{when} ago by %{user}"
|
reopened_at_by: "Reactivated %{when} ago by %{user}"
|
||||||
rss:
|
rss:
|
||||||
title: "OpenStreetMap Notes"
|
title: "OpenStreetMap Notes"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue