From 9d35062ba3013891e44265261eaa1111ab1ebc47 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 28 Feb 2010 16:57:22 +0000 Subject: [PATCH] Add a "friendly" date/time format and use it whenever we are printing dates and times on the web site. Also try and improve formatting of message pages a but, and include the image of the recipient when viewing a sent message. --- app/views/diary_entry/_diary_comment.html.erb | 2 +- app/views/diary_entry/_diary_entry.html.erb | 2 +- app/views/message/_message_summary.html.erb | 2 +- .../message/_sent_message_summary.html.erb | 2 +- app/views/message/read.html.erb | 19 +++++++++++-------- app/views/trace/edit.html.erb | 2 +- app/views/trace/view.html.erb | 2 +- app/views/user/view.html.erb | 2 +- config/locales/en.yml | 11 +++++++---- 9 files changed, 25 insertions(+), 19 deletions(-) diff --git a/app/views/diary_entry/_diary_comment.html.erb b/app/views/diary_entry/_diary_comment.html.erb index 6bc7f73f9..77238b4d3 100644 --- a/app/views/diary_entry/_diary_comment.html.erb +++ b/app/views/diary_entry/_diary_comment.html.erb @@ -1,5 +1,5 @@ <%= user_thumbnail diary_comment.user, :style => "float: right" %> -

<%= t('diary_entry.diary_comment.comment_from', :link_user => (link_to h(diary_comment.user.display_name), :controller => 'user', :action => 'view', :display_name => diary_comment.user.display_name), :comment_created_at => l(diary_comment.created_at)) %>

+

<%= t('diary_entry.diary_comment.comment_from', :link_user => (link_to h(diary_comment.user.display_name), :controller => 'user', :action => 'view', :display_name => diary_comment.user.display_name), :comment_created_at => l(diary_comment.created_at, :format => :friendly)) %>

<%= htmlize(diary_comment.body) %> <% if @user && @user.administrator? %> <%= link_to t('diary_entry.diary_comment.hide_link'), {:action => 'hidecomment', :display_name => @user.display_name, :id => diary_comment.diary_entry.id, :comment => diary_comment.id}, {:confirm => t('diary_entry.diary_comment.confirm')} %> diff --git a/app/views/diary_entry/_diary_entry.html.erb b/app/views/diary_entry/_diary_entry.html.erb index c9a6baec0..17078a8bb 100644 --- a/app/views/diary_entry/_diary_entry.html.erb +++ b/app/views/diary_entry/_diary_entry.html.erb @@ -4,7 +4,7 @@ <%= render :partial => "location", :object => diary_entry %>
<% end %> -<%= t 'diary_entry.diary_entry.posted_by', :link_user => (link_to h(diary_entry.user.display_name), :controller => 'user', :action => 'view', :display_name => diary_entry.user.display_name), :created => l(diary_entry.created_at), :language_link => (link_to h(diary_entry.language.name), :controller => 'diary_entry', :action => 'list', :language => diary_entry.language_code) %> +<%= t 'diary_entry.diary_entry.posted_by', :link_user => (link_to h(diary_entry.user.display_name), :controller => 'user', :action => 'view', :display_name => diary_entry.user.display_name), :created => l(diary_entry.created_at, :format => :friendly), :language_link => (link_to h(diary_entry.language.name), :controller => 'diary_entry', :action => 'list', :language => diary_entry.language_code) %> <% if params[:action] == 'list' %>
<%= link_to t('diary_entry.diary_entry.comment_link'), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id, :anchor => 'newcomment' %> diff --git a/app/views/message/_message_summary.html.erb b/app/views/message/_message_summary.html.erb index d4d4f788b..1397d65af 100644 --- a/app/views/message/_message_summary.html.erb +++ b/app/views/message/_message_summary.html.erb @@ -3,7 +3,7 @@ "> <%= link_to h(message_summary.sender.display_name), :controller => 'user', :action => message_summary.sender.display_name %> <%= link_to h(message_summary.title), :controller => 'message', :action => 'read', :message_id => message_summary.id %> - <%= l message_summary.sent_on %> + <%= l message_summary.sent_on, :format => :friendly %> <% if message_summary.message_read? %> <%= button_to t('message.message_summary.unread_button'), {:controller => 'message', :action => 'mark', :message_id => message_summary.id, :mark => 'unread'}, { :onclick => remote_function(:url => {:controller => 'message', :action => 'mark', :message_id => message_summary.id, :mark => 'unread'}) + "; return false;" } %> <% else %> diff --git a/app/views/message/_sent_message_summary.html.erb b/app/views/message/_sent_message_summary.html.erb index 9d3275835..d4d8b3fa5 100644 --- a/app/views/message/_sent_message_summary.html.erb +++ b/app/views/message/_sent_message_summary.html.erb @@ -3,6 +3,6 @@ <%= link_to h(sent_message_summary.recipient.display_name), :controller => 'user', :action => sent_message_summary.recipient.display_name %> <%= link_to h(sent_message_summary.title), :controller => 'message', :action => 'read', :message_id => sent_message_summary.id %> - <%= l sent_message_summary.sent_on %> + <%= l sent_message_summary.sent_on, :format => :friendly %> <%= button_to t('message.sent_message_summary.delete_button'), :controller => 'message', :action => 'delete', :message_id => sent_message_summary.id, :referer => request.request_uri %> diff --git a/app/views/message/read.html.erb b/app/views/message/read.html.erb index 8a7b6b156..576403170 100644 --- a/app/views/message/read.html.erb +++ b/app/views/message/read.html.erb @@ -5,24 +5,23 @@ - + + + - + + +
<%= t'message.read.from' %> - <% if @message.sender.image %> - <%= image_tag url_for_file_column(@message.sender, "image") %> - <% end %> - -<%= link_to h(@message.sender.display_name), :controller => 'user', :action => 'view', :display_name => @message.sender.display_name %><%= link_to h(@message.sender.display_name), :controller => 'user', :action => 'view', :display_name => @message.sender.display_name %><%= user_thumbnail @message.sender %>
<%= t'message.read.subject' %> <%= h(@message.title) %>
<%= t'message.read.date' %><%= l @message.sent_on %><%= l @message.sent_on, :format => :friendly %>
<%= htmlize(@message.body) %>
@@ -44,18 +43,22 @@ <%= t'message.read.to' %> <%= link_to h(@message.recipient.display_name), :controller => 'user', :action => 'view', :display_name => @message.recipient.display_name %> + <%= user_thumbnail @message.recipient %> <%= t'message.read.subject' %> <%= h(@message.title) %> + <%= t'message.read.date' %> - <%= l @message.sent_on %> + <%= l @message.sent_on, :format => :friendly %> + <%= htmlize(@message.body) %> + diff --git a/app/views/trace/edit.html.erb b/app/views/trace/edit.html.erb index 523607ae6..202f9039d 100644 --- a/app/views/trace/edit.html.erb +++ b/app/views/trace/edit.html.erb @@ -11,7 +11,7 @@ <%= t'trace.edit.uploaded_at' %> - <%= l @trace.timestamp %> + <%= l @trace.timestamp, :format => :friendly %> <% if @trace.inserted? %> diff --git a/app/views/trace/view.html.erb b/app/views/trace/view.html.erb index c1d5e0445..73638cb3d 100644 --- a/app/views/trace/view.html.erb +++ b/app/views/trace/view.html.erb @@ -15,7 +15,7 @@ <%= t'trace.view.uploaded' %> - <%= l @trace.timestamp %> + <%= l @trace.timestamp, :format => :friendly %> <% if @trace.inserted? %> diff --git a/app/views/user/view.html.erb b/app/views/user/view.html.erb index 8aa4ead49..77ad06a8f 100644 --- a/app/views/user/view.html.erb +++ b/app/views/user/view.html.erb @@ -75,7 +75,7 @@ <% end %> -

<%= t 'user.view.mapper since' %> <%= l @this_user.creation_time %> <%= t 'user.view.ago', :time_in_words_ago => time_ago_in_words(@this_user.creation_time) %>

+

<%= t 'user.view.mapper since' %> <%= l @this_user.creation_time, :format => :friendly %> <%= t 'user.view.ago', :time_in_words_ago => time_ago_in_words(@this_user.creation_time) %>

<% if @user and @user.administrator? %>

<%= t 'user.view.email address' %> <%= @this_user.email %>

diff --git a/config/locales/en.yml b/config/locales/en.yml index 5d647e515..633f54c12 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,6 +1,9 @@ en: html: dir: ltr + time: + formats: + friendly: "%e %B %Y at %H:%M" activerecord: # Translates all the model names, which is used in error handling on the web site models: @@ -324,7 +327,7 @@ en: heading: "The user {{user}} does not exist" body: "Sorry, there is no user with the name {{user}}. Please check your spelling, or maybe the link you clicked is wrong." diary_entry: - posted_by: "Posted by {{link_user}} at {{created}} in {{language_link}}" + posted_by: "Posted by {{link_user}} on {{created}} in {{language_link}}" comment_link: Comment on this entry reply_link: Reply to this entry comment_count: @@ -334,7 +337,7 @@ en: hide_link: Hide this entry confirm: Confirm diary_comment: - comment_from: "Comment from {{link_user}} at {{comment_created_at}}" + comment_from: "Comment from {{link_user}} on {{comment_created_at}}" hide_link: Hide this comment confirm: Confirm location: @@ -1190,7 +1193,7 @@ en: heading: "Editing trace {{name}}" filename: "Filename:" download: "download" - uploaded_at: "Uploaded at:" + uploaded_at: "Uploaded:" points: "Points:" start_coord: "Start coordinate:" map: "map" @@ -1231,7 +1234,7 @@ en: pending: "PENDING" filename: "Filename:" download: "download" - uploaded: "Uploaded at:" + uploaded: "Uploaded:" points: "Points:" start_coordinates: "Start coordinate:" map: "map" -- 2.39.5