From: Tom Hughes Date: Tue, 28 Feb 2012 21:49:41 +0000 (+0000) Subject: Improve the diary comments view X-Git-Tag: live~5775 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/c9a4ec5e63cb07ff9254ee98eef2f85cd16c4275 Improve the diary comments view Make sure all strings are translatable; replace a manually constructed link with link_to; improve date formatting; and use cycle to alternate colours for the table rows. --- diff --git a/app/views/diary_entry/comments.html.erb b/app/views/diary_entry/comments.html.erb index fbad59d47..1404847b3 100644 --- a/app/views/diary_entry/comments.html.erb +++ b/app/views/diary_entry/comments.html.erb @@ -1,21 +1,21 @@ -

<%= @title%> - <%= t('diary_entry.comments.has_commented_on',:display_name => @this_user.display_name) %> -

-

-
- - -<% for comment in @comments %> - - - - -<% end %> +

<%= t('diary_entry.comments.has_commented_on', :display_name => @this_user.display_name) %>

+ +
TitleDateComment
<%= comment.diary_entry.title %> - -<%= comment.created_at %> - -<%= htmlize(comment.body) %>
+ + + + + + <% @comments.each do |comment| -%> + <% cl = cycle('table0', 'table1') %> + + + + + + <% end -%>
<%= t 'diary_entry.comments.post' %><%= t 'diary_entry.comments.when' %><%= t 'diary_entry.comments.comment' %>
<%= link_to comment.diary_entry.title, :action => :view, :display_name => comment.diary_entry.user, :id => comment.diary_entry.id %><%= t 'diary_entry.comments.ago', :ago => time_ago_in_words(comment.created_at) %><%= htmlize(comment.body) %>
+ <%= link_to t('diary_entry.comments.older_comments') , { :page => @comment_pages.current.next} if @comment_pages.current.next %> <% if @comment_pages.current.next and @comment_pages.current.previous %> | diff --git a/config/locales/en.yml b/config/locales/en.yml index 49b9d1d34..bc8bb05ac 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -394,6 +394,10 @@ en: description: "Recent diary entries from users of OpenStreetMap" comments: has_commented_on: "%{display_name} has commented on the following diary entries" + post: Post + when: When + comment: Comment + ago: %{ago} ago newer_comments: "Newer Comments" older_comments: "Older Comments" export: