From: Aaron Lidman Date: Sun, 10 Nov 2013 07:39:02 +0000 (-0800) Subject: Restructured notes page X-Git-Tag: live~4668^2~129 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/b56fb250680e95146256161e8adb5f1a327859fd?ds=sidebyside Restructured notes page --- diff --git a/app/helpers/note_helper.rb b/app/helpers/note_helper.rb index f2bff861f..e0eef269b 100644 --- a/app/helpers/note_helper.rb +++ b/app/helpers/note_helper.rb @@ -1,9 +1,16 @@ module NoteHelper - def note_event(at, by) + def note_event(event, at, by) if by.nil? - I18n.t("browse.note.at_html", :when => friendly_date(at)).html_safe + I18n.t("browse.note." + event + "_by_anonymous", + :when => friendly_date(at), + :exact_time => l(at) + ).html_safe else - I18n.t("browse.note.at_by_html", :when => friendly_date(at), :user => note_author(by)).html_safe + I18n.t("browse.note." + event + "_by", + :when => friendly_date(at), + :exact_time => l(at), + :user => note_author(by) + ).html_safe end end @@ -14,4 +21,5 @@ module NoteHelper link_to h(author.display_name), link_options.merge({:controller => "user", :action => "view", :display_name => author.display_name}) end end + end diff --git a/app/views/browse/note.html.erb b/app/views/browse/note.html.erb index a20de88a0..ed13f97c7 100644 --- a/app/views/browse/note.html.erb +++ b/app/views/browse/note.html.erb @@ -5,21 +5,14 @@ <%= t "browse.note.#{@note.status}_title", :note_name => @note.id %>
- - <%= t "browse.note.opened" %>: - <%= note_event(@note.created_at, @note.author) %> by - <% if @note.author.nil? %> - <%= t "browse.note.anonymous" %> - <% else %> - <%= note_author(@note.author) %> - <% end %> +

+ <%= @note.author %> + <%= note_event(@note.status, @note.created_at, @note.author) %> <% if @note.status == "closed" %> - - <%= t "browse.note.closed" %>: - <%= note_event(@note.closed_at, @note.author) %> by - <%= @note.comments.last.author %> +
+ <%= note_event(@note.status, @note.closed_at, @note.comments.last.author) %> <% end %> -
+

<% if @note.comments.find { |comment| comment.author.nil? } -%> @@ -29,22 +22,9 @@ <% end -%>
- <% if @note.status == "closed" %> -
-

<%= t "browse.note.closed" %>

-

<%= note_event(@note.closed_at, @note.comments.last.author) %>

-
- <% elsif @note.comments.length > 1 %> -
-

<%= t "browse.note.last_modified" %>

-

<%= note_event(@note.updated_at, @note.comments.last.author) %>

-
- <% end %> -

<%= t "browse.note.description" %>

<%= h(@note.comments.first.body.to_html) %> -
@@ -59,8 +39,8 @@
    <% @note.comments[1..-1].each do |comment| %>
  • + <%= note_event(comment.event, comment.created_at, comment.author) %> <%= comment.body.to_html %> - <%= note_event(comment.created_at, comment.author) %>
  • <% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index 1de138f2d..5cbbf8cd8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -292,6 +292,14 @@ en: description: "Description" comments: "Comments" anonymous: "anonymous" + open_by: "Created by %{user} %{when} ago" + open_by_anonymous: "Created by anonymous %{when} ago" + commented_by: "Comment from %{user} %{when} ago" + commented_by_anonymous: "Comment from anonymous %{when} ago" + closed_by: "Resolved by %{user} %{when} ago" + closed_by_anonymous: "Resolved by anonymous %{when} ago" + reopened_by: "Reactivated by %{user} %{when} ago" + reopened_by_anonymous: "Reactivated by anonymous %{when} ago" changeset: changeset_paging_nav: showing_page: "Page %{page}"