From c9a4ec5e63cb07ff9254ee98eef2f85cd16c4275 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 28 Feb 2012 21:49:41 +0000 Subject: [PATCH] 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. --- app/views/diary_entry/comments.html.erb | 34 ++++++++++++------------- config/locales/en.yml | 4 +++ 2 files changed, 21 insertions(+), 17 deletions(-) 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: -- 2.39.5