Merge remote-tracking branch 'upstream/pull/2271'
This commit is contained in:
commit
16c3c53302
17 changed files with 57 additions and 61 deletions
|
@ -49,6 +49,10 @@ module ApplicationHelper
|
|||
content_tag(:span, time_ago_in_words(date), :title => l(date, :format => :friendly))
|
||||
end
|
||||
|
||||
def friendly_date_ago(date)
|
||||
content_tag(:span, time_ago_in_words(date, :scope => :'datetime.distance_in_words_ago'), :title => l(date, :format => :friendly))
|
||||
end
|
||||
|
||||
def body_class
|
||||
if content_for? :body_class
|
||||
content_for :body_class
|
||||
|
|
|
@ -12,11 +12,11 @@ module ChangesetsHelper
|
|||
def changeset_details(changeset)
|
||||
if changeset.closed_at > Time.now
|
||||
action = :created
|
||||
time = distance_of_time_in_words_to_now(changeset.created_at)
|
||||
time = time_ago_in_words(changeset.created_at, :scope => :'datetime.distance_in_words_ago')
|
||||
title = l(changeset.created_at)
|
||||
else
|
||||
action = :closed
|
||||
time = distance_of_time_in_words_to_now(changeset.closed_at)
|
||||
time = time_ago_in_words(changeset.closed_at, :scope => :'datetime.distance_in_words_ago')
|
||||
title = "#{t('browse.created')}: #{l(changeset.created_at)} #{t('browse.closed')}: #{l(changeset.closed_at)}".html_safe
|
||||
end
|
||||
|
||||
|
|
|
@ -2,11 +2,11 @@ module NoteHelper
|
|||
def note_event(event, at, by)
|
||||
if by.nil?
|
||||
I18n.t("browse.note." + event + "_by_anonymous",
|
||||
:when => friendly_date(at),
|
||||
:when => friendly_date_ago(at),
|
||||
:exact_time => l(at)).html_safe
|
||||
else
|
||||
I18n.t("browse.note." + event + "_by",
|
||||
:when => friendly_date(at),
|
||||
:when => friendly_date_ago(at),
|
||||
:exact_time => l(at),
|
||||
:user => note_author(by)).html_safe
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ module UserBlocksHelper
|
|||
# either because the user viewed the block (updated_at) or it expired or was
|
||||
# revoked (ends_at)
|
||||
last_time = [block.ends_at, block.updated_at].max
|
||||
I18n.t("user_blocks.helper.time_past", :time => friendly_date(last_time)).html_safe
|
||||
I18n.t("user_blocks.helper.time_past", :time => friendly_date_ago(last_time)).html_safe
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<div class="note-comment" style="margin-top: 5px">
|
||||
<% if comment.author.nil? -%>
|
||||
<div class="note-comment-description" style="font-size: smaller; color: #999999"><%= t ".#{comment.event}_at_html", :when => friendly_date(comment.created_at) %></div>
|
||||
<div class="note-comment-description" style="font-size: smaller; color: #999999"><%= t ".#{comment.event}_at_html", :when => friendly_date_ago(comment.created_at) %></div>
|
||||
<% else -%>
|
||||
<div class="note-comment-description" style="font-size: smaller; color: #999999"><%= t ".#{comment.event}_at_by_html", :when => friendly_date(comment.created_at), :user => note_author(comment.author, :only_path => false) %></div>
|
||||
<div class="note-comment-description" style="font-size: smaller; color: #999999"><%= t ".#{comment.event}_at_by_html", :when => friendly_date_ago(comment.created_at), :user => note_author(comment.author, :only_path => false) %></div>
|
||||
<% end -%>
|
||||
<div class="note-comment-text"><%= comment.body %></div>
|
||||
</div>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<div class="details">
|
||||
<%= t "browse.#{common_details.visible? ? :edited : :deleted}_by_html",
|
||||
:time => distance_of_time_in_words_to_now(common_details.timestamp),
|
||||
:time => time_ago_in_words(common_details.timestamp, :scope => :'datetime.distance_in_words_ago'),
|
||||
:user => changeset_user_link(common_details.changeset),
|
||||
:title => l(common_details.timestamp) %>
|
||||
</div>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<li id="c<%= comment.id %>">
|
||||
<small class='deemphasize'>
|
||||
<%= t(".commented_by",
|
||||
:when => friendly_date(comment.created_at),
|
||||
:when => friendly_date_ago(comment.created_at),
|
||||
:exact_time => l(comment.created_at),
|
||||
:user => link_to(h(comment.author.display_name), user_path(comment.author))).html_safe %>
|
||||
<% if current_user and current_user.moderator? %>
|
||||
|
@ -49,7 +49,7 @@
|
|||
<li id="c<%= comment.id %>">
|
||||
<small class='deemphasize'>
|
||||
<%= t(".hidden_commented_by",
|
||||
:when => friendly_date(comment.created_at),
|
||||
:when => friendly_date_ago(comment.created_at),
|
||||
:exact_time => l(comment.created_at),
|
||||
:user => link_to(h(comment.author.display_name), user_path(comment.author))).html_safe %>
|
||||
— <span class="action-button deemphasize" data-comment-id="<%= comment.id %>" data-method="POST" data-url="<%= changeset_comment_unhide_url(comment.id) %>"><%= t("javascripts.changesets.show.unhide_comment") %></span>
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
:author => comment.author.display_name,
|
||||
:changeset_id => comment.changeset.id.to_s %></h2>
|
||||
<div class="changeset-comment" style="margin-top: 5px">
|
||||
<div class="changeset-comment-description" style="font-size: smaller; color: #999999"><%= t ".commented_at_by_html", :when => friendly_date(comment.created_at), :user => comment.author.display_name %></div>
|
||||
<div class="changeset-comment-description" style="font-size: smaller; color: #999999"><%= t ".commented_at_by_html", :when => friendly_date_ago(comment.created_at), :user => comment.author.display_name %></div>
|
||||
<div class="changeset-comment-text"><%= comment.body %></div>
|
||||
</div>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<% cl = cycle("table0", "table1") %>
|
||||
<tr class="<%= cl %>">
|
||||
<td width="25%"><%= link_to comment.diary_entry.title, diary_entry_path(comment.diary_entry.user, comment.diary_entry) %></td>
|
||||
<td width="25%"><span title="<%= l comment.created_at, :format => :friendly %>"><%= t ".ago", :ago => time_ago_in_words(comment.created_at) %></span></td>
|
||||
<td width="25%"><span title="<%= l comment.created_at, :format => :friendly %>"><%= time_ago_in_words(comment.created_at, :scope => :'datetime.distance_in_words_ago') %></span></td>
|
||||
<td width="50%" class="richtext"><%= comment.body.to_html %></td>
|
||||
</tr>
|
||||
<% end -%>
|
||||
|
|
|
@ -38,10 +38,10 @@
|
|||
<td>
|
||||
<% if issue.user_updated %>
|
||||
<%= t ".last_updated_time_user_html", :user => link_to(issue.user_updated.display_name, user_path(issue.user_updated)),
|
||||
:time => distance_of_time_in_words_to_now(issue.updated_at),
|
||||
:time => time_ago_in_words(issue.updated_at, :scope => :'datetime.distance_in_words_ago'),
|
||||
:title => l(issue.updated_at) %>
|
||||
<% else %>
|
||||
<%= t ".last_updated_time_html", :time => distance_of_time_in_words_to_now(issue.updated_at),
|
||||
<%= t ".last_updated_time_html", :time => time_ago_in_words(issue.updated_at, :scope => :'datetime.distance_in_words_ago'),
|
||||
:title => l(issue.updated_at) %>
|
||||
<% end %>
|
||||
</td>
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
<td><%= link_to note.id, browse_note_path(note) %></td>
|
||||
<td><%= note_author(note.author) %></td>
|
||||
<td><%= note.comments.first.body.to_html %></td>
|
||||
<td><%= t ".ago_html", :when => friendly_date(note.created_at) %></td>
|
||||
<td><%= t ".ago_html", :when => friendly_date(note.updated_at) %></td>
|
||||
<td><%= friendly_date_ago(note.created_at) %></td>
|
||||
<td><%= friendly_date_ago(note.updated_at) %></td>
|
||||
</tr>
|
||||
<% end -%>
|
||||
</table>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<% if trace.inserted %>
|
||||
(<%= t ".count_points", :count => trace.size.to_s.gsub(/(\d)(?=(\d{3})+$)/, '\1,') %>)
|
||||
<% end %>
|
||||
... <%= t ".ago", :time_in_words_ago => time_ago_in_words(trace.timestamp) %></span>
|
||||
... <%= time_ago_in_words(trace.timestamp, :scope => :'datetime.distance_in_words_ago') %></span>
|
||||
<%= link_to_if trace.inserted?, t(".map"), { :controller => "site", :action => "index", :mlat => trace.latitude, :mlon => trace.longitude, :anchor => "map=14/#{trace.latitude}/#{trace.longitude}" }, { :title => t(".view_map") } %> /
|
||||
<%= link_to t(".edit"), { :controller => "site", :action => "edit", :gpx => trace.id }, { :title => t(".edit_map") } %>
|
||||
<span class="trace_<%= trace.visibility %>"><%= t("." + trace.visibility) %></span>
|
||||
|
|
|
@ -28,6 +28,6 @@
|
|||
|
||||
<% else %>
|
||||
<p>
|
||||
<%= t(".past", :time => distance_of_time_in_words_to_now(@user_block.ends_at)) %>
|
||||
<%= t(".past", :time => time_ago_in_words(@user_block.ends_at, :scope => :'datetime.distance_in_words_ago')) %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
</p>
|
||||
<% end %>
|
||||
|
||||
<p><b><%= t ".created" %></b>: <%= raw t ".ago", :time => friendly_date(@user_block.created_at) %></p>
|
||||
<p><b><%= t ".created" %></b>: <%= friendly_date_ago(@user_block.created_at) %></p>
|
||||
|
||||
<p><b><%= t ".status" %></b>: <%= block_status(@user_block) %></p>
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<p>
|
||||
<% changeset = contact.changesets.first %>
|
||||
<% if changeset %>
|
||||
<%= t("users.show.latest edit", :ago => t("users.show.ago", :time_in_words_ago => time_ago_in_words(changeset.created_at))) %>
|
||||
<%= t("users.show.latest edit", :ago => time_ago_in_words(changeset.created_at, :scope => :'datetime.distance_in_words_ago')) %>
|
||||
<% comment = changeset.tags["comment"].to_s != "" ? changeset.tags["comment"] : t("browse.no_comment") %>
|
||||
"<%= link_to(comment,
|
||||
{ :controller => "browse", :action => "changeset", :id => changeset.id },
|
||||
|
|
|
@ -163,14 +163,14 @@ en:
|
|||
api:
|
||||
notes:
|
||||
comment:
|
||||
opened_at_html: "Created %{when} ago"
|
||||
opened_at_by_html: "Created %{when} ago by %{user}"
|
||||
commented_at_html: "Updated %{when} ago"
|
||||
commented_at_by_html: "Updated %{when} ago by %{user}"
|
||||
closed_at_html: "Resolved %{when} ago"
|
||||
closed_at_by_html: "Resolved %{when} ago by %{user}"
|
||||
reopened_at_html: "Reactivated %{when} ago"
|
||||
reopened_at_by_html: "Reactivated %{when} ago by %{user}"
|
||||
opened_at_html: "Created %{when}"
|
||||
opened_at_by_html: "Created %{when} by %{user}"
|
||||
commented_at_html: "Updated %{when}"
|
||||
commented_at_by_html: "Updated %{when}by %{user}"
|
||||
closed_at_html: "Resolved %{when}"
|
||||
closed_at_by_html: "Resolved %{when} by %{user}"
|
||||
reopened_at_html: "Reactivated %{when}"
|
||||
reopened_at_by_html: "Reactivated %{when} by %{user}"
|
||||
rss:
|
||||
title: "OpenStreetMap Notes"
|
||||
description_area: "A list of notes, reported, commented on or closed in your area [(%{min_lat}|%{min_lon}) -- (%{max_lat}|%{max_lon})]"
|
||||
|
@ -185,12 +185,12 @@ en:
|
|||
browse:
|
||||
created: "Created"
|
||||
closed: "Closed"
|
||||
created_html: "Created <abbr title='%{title}'>%{time} ago</abbr>"
|
||||
closed_html: "Closed <abbr title='%{title}'>%{time} ago</abbr>"
|
||||
created_by_html: "Created <abbr title='%{title}'>%{time} ago</abbr> by %{user}"
|
||||
deleted_by_html: "Deleted <abbr title='%{title}'>%{time} ago</abbr> by %{user}"
|
||||
edited_by_html: "Edited <abbr title='%{title}'>%{time} ago</abbr> by %{user}"
|
||||
closed_by_html: "Closed <abbr title='%{title}'>%{time} ago</abbr> by %{user}"
|
||||
created_html: "Created <abbr title='%{title}'>%{time}</abbr>"
|
||||
closed_html: "Closed <abbr title='%{title}'>%{time}</abbr>"
|
||||
created_by_html: "Created <abbr title='%{title}'>%{time}</abbr> by %{user}"
|
||||
deleted_by_html: "Deleted <abbr title='%{title}'>%{time}</abbr> by %{user}"
|
||||
edited_by_html: "Edited <abbr title='%{title}'>%{time}</abbr> by %{user}"
|
||||
closed_by_html: "Closed <abbr title='%{title}'>%{time}</abbr> by %{user}"
|
||||
version: "Version"
|
||||
in_changeset: "Changeset"
|
||||
anonymous: "anonymous"
|
||||
|
@ -210,8 +210,8 @@ en:
|
|||
relation: "Relations (%{count})"
|
||||
relation_paginated: "Relations (%{x}-%{y} of %{count})"
|
||||
comment: "Comments (%{count})"
|
||||
hidden_commented_by: "Hidden comment from %{user} <abbr title='%{exact_time}'>%{when} ago</abbr>"
|
||||
commented_by: "Comment from %{user} <abbr title='%{exact_time}'>%{when} ago</abbr>"
|
||||
hidden_commented_by: "Hidden comment from %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
|
||||
commented_by: "Comment from %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
|
||||
changesetxml: "Changeset XML"
|
||||
osmchangexml: "osmChange XML"
|
||||
feed:
|
||||
|
@ -286,15 +286,15 @@ en:
|
|||
open_title: "Unresolved note #%{note_name}"
|
||||
closed_title: "Resolved note #%{note_name}"
|
||||
hidden_title: "Hidden note #%{note_name}"
|
||||
open_by: "Created by %{user} <abbr title='%{exact_time}'>%{when} ago</abbr>"
|
||||
open_by_anonymous: "Created by anonymous <abbr title='%{exact_time}'>%{when} ago</abbr>"
|
||||
commented_by: "Comment from %{user} <abbr title='%{exact_time}'>%{when} ago</abbr>"
|
||||
commented_by_anonymous: "Comment from anonymous <abbr title='%{exact_time}'>%{when} ago</abbr>"
|
||||
closed_by: "Resolved by %{user} <abbr title='%{exact_time}'>%{when} ago</abbr>"
|
||||
closed_by_anonymous: "Resolved by anonymous <abbr title='%{exact_time}'>%{when} ago</abbr>"
|
||||
reopened_by: "Reactivated by %{user} <abbr title='%{exact_time}'>%{when} ago</abbr>"
|
||||
reopened_by_anonymous: "Reactivated by anonymous <abbr title='%{exact_time}'>%{when} ago</abbr>"
|
||||
hidden_by: "Hidden by %{user} <abbr title='%{exact_time}'>%{when} ago</abbr>"
|
||||
open_by: "Created by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
|
||||
open_by_anonymous: "Created by anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
|
||||
commented_by: "Comment from %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
|
||||
commented_by_anonymous: "Comment from anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
|
||||
closed_by: "Resolved by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
|
||||
closed_by_anonymous: "Resolved by anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
|
||||
reopened_by: "Reactivated by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
|
||||
reopened_by_anonymous: "Reactivated by anonymous <abbr title='%{exact_time}'>%{when}</abbr>"
|
||||
hidden_by: "Hidden by %{user} <abbr title='%{exact_time}'>%{when}</abbr>"
|
||||
report: Report this note
|
||||
query:
|
||||
title: "Query Features"
|
||||
|
@ -333,7 +333,7 @@ en:
|
|||
changeset_comments:
|
||||
comment:
|
||||
comment: "New comment on changeset #%{changeset_id} by %{author}"
|
||||
commented_at_by_html: "Updated %{when} ago by %{user}"
|
||||
commented_at_by_html: "Updated %{when} by %{user}"
|
||||
comments:
|
||||
comment: "New comment on changeset #%{changeset_id} by %{author}"
|
||||
index:
|
||||
|
@ -415,7 +415,6 @@ en:
|
|||
post: Post
|
||||
when: When
|
||||
comment: Comment
|
||||
ago: "%{ago} ago"
|
||||
newer_comments: "Newer Comments"
|
||||
older_comments: "Older Comments"
|
||||
geocoder:
|
||||
|
@ -1028,8 +1027,8 @@ en:
|
|||
status: Status
|
||||
reports: Reports
|
||||
last_updated: Last Updated
|
||||
last_updated_time_html: "<abbr title='%{title}'>%{time} ago</abbr>"
|
||||
last_updated_time_user_html: "<abbr title='%{title}'>%{time} ago</abbr> by %{user}"
|
||||
last_updated_time_html: "<abbr title='%{title}'>%{time}</abbr>"
|
||||
last_updated_time_user_html: "<abbr title='%{title}'>%{time}</abbr> by %{user}"
|
||||
link_to_reports: View Reports
|
||||
reported_user: Reported User
|
||||
reports_count:
|
||||
|
@ -1857,7 +1856,6 @@ en:
|
|||
trace:
|
||||
pending: "PENDING"
|
||||
count_points: "%{count} points"
|
||||
ago: "%{time_in_words_ago} ago"
|
||||
more: "more"
|
||||
trace_details: "View Trace Details"
|
||||
view_map: "View Map"
|
||||
|
@ -2130,12 +2128,10 @@ en:
|
|||
remove as friend: Unfriend
|
||||
add as friend: Add Friend
|
||||
mapper since: "Mapper since:"
|
||||
ago: "(%{time_in_words_ago} ago)"
|
||||
ct status: "Contributor terms:"
|
||||
ct undecided: Undecided
|
||||
ct declined: Declined
|
||||
ct accepted: Accepted %{ago} ago
|
||||
latest edit: "Latest edit %{ago}:"
|
||||
latest edit: "Latest edit (%{ago}):"
|
||||
email address: "Email address:"
|
||||
created from: "Created from:"
|
||||
status: "Status:"
|
||||
|
@ -2368,7 +2364,7 @@ en:
|
|||
title: "Revoking block on %{block_on}"
|
||||
heading: "Revoking block on %{block_on} by %{block_by}"
|
||||
time_future: "This block will end in %{time}."
|
||||
past: "This block ended %{time} ago and cannot be revoked now."
|
||||
past: "This block ended %{time} and cannot be revoked now."
|
||||
confirm: "Are you sure you wish to revoke this block?"
|
||||
revoke: "Revoke!"
|
||||
flash: "This block has been revoked."
|
||||
|
@ -2376,7 +2372,7 @@ en:
|
|||
time_future: "Ends in %{time}."
|
||||
until_login: "Active until the user logs in."
|
||||
time_future_and_until_login: "Ends in %{time} and after the user has logged in."
|
||||
time_past: "Ended %{time} ago."
|
||||
time_past: "Ended %{time}."
|
||||
block_duration:
|
||||
hours:
|
||||
one: "1 hour"
|
||||
|
@ -2404,10 +2400,7 @@ en:
|
|||
show:
|
||||
title: "%{block_on} blocked by %{block_by}"
|
||||
heading: "%{block_on} blocked by %{block_by}"
|
||||
time_future: "Ends in %{time}"
|
||||
time_past: "Ended %{time} ago"
|
||||
created: "Created"
|
||||
ago: "%{time} ago"
|
||||
status: "Status"
|
||||
show: "Show"
|
||||
edit: "Edit"
|
||||
|
@ -2441,7 +2434,6 @@ en:
|
|||
description: "Description"
|
||||
created_at: "Created at"
|
||||
last_changed: "Last changed"
|
||||
ago_html: "%{when} ago"
|
||||
javascripts:
|
||||
close: Close
|
||||
share:
|
||||
|
|
|
@ -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">.*</span> ago</abbr>$}, note_event("open", 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">.*</span> ago</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("open", 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