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.
This commit is contained in:
Tom Hughes 2010-02-28 16:57:22 +00:00
parent 4ebc48618e
commit 9d35062ba3
9 changed files with 25 additions and 19 deletions

View file

@ -1,5 +1,5 @@
<%= user_thumbnail diary_comment.user, :style => "float: right" %>
<h4 id="comment<%= diary_comment.id %>"><%= 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)) %></h4>
<h4 id="comment<%= diary_comment.id %>"><%= 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)) %></h4>
<%= 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')} %>

View file

@ -4,7 +4,7 @@
<%= render :partial => "location", :object => diary_entry %>
<br />
<% 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' %>
<br />
<%= link_to t('diary_entry.diary_entry.comment_link'), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id, :anchor => 'newcomment' %>

View file

@ -3,7 +3,7 @@
<tr id="inbox-<%= message_summary.id %>" class="inbox-row<%= "-unread" if not message_summary.message_read? %>">
<td class="inbox-sender" bgcolor="<%= this_colour %>"><%= link_to h(message_summary.sender.display_name), :controller => 'user', :action => message_summary.sender.display_name %></td>
<td class="inbox-subject" bgcolor="<%= this_colour %>"><%= link_to h(message_summary.title), :controller => 'message', :action => 'read', :message_id => message_summary.id %></td>
<td class="inbox-sent nowrap" bgcolor="<%= this_colour %>"><%= l message_summary.sent_on %></td>
<td class="inbox-sent nowrap" bgcolor="<%= this_colour %>"><%= l message_summary.sent_on, :format => :friendly %></td>
<% if message_summary.message_read? %>
<td><%= 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;" } %></td>
<% else %>

View file

@ -3,6 +3,6 @@
<tr class="inbox-row">
<td class="inbox-sender" bgcolor="<%= this_colour %>"><%= link_to h(sent_message_summary.recipient.display_name), :controller => 'user', :action => sent_message_summary.recipient.display_name %></td>
<td class="inbox-subject" bgcolor="<%= this_colour %>"><%= link_to h(sent_message_summary.title), :controller => 'message', :action => 'read', :message_id => sent_message_summary.id %></td>
<td class="inbox-sent nowrap" bgcolor="<%= this_colour %>"><%= l sent_message_summary.sent_on %></td>
<td class="inbox-sent nowrap" bgcolor="<%= this_colour %>"><%= l sent_message_summary.sent_on, :format => :friendly %></td>
<td><%= button_to t('message.sent_message_summary.delete_button'), :controller => 'message', :action => 'delete', :message_id => sent_message_summary.id, :referer => request.request_uri %></td>
</tr>

View file

@ -5,24 +5,23 @@
<table>
<tr>
<th align="right"><%= t'message.read.from' %></th>
<td>
<% 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 %></td>
<td><%= link_to h(@message.sender.display_name), :controller => 'user', :action => 'view', :display_name => @message.sender.display_name %></td>
<td rowspan="4" valign="top"><%= user_thumbnail @message.sender %></td>
</tr>
<tr>
<th align="right"><%= t'message.read.subject' %></th>
<td><%= h(@message.title) %></td>
<td></td>
</tr>
<tr>
<th align="right"><%= t'message.read.date' %></th>
<td><%= l @message.sent_on %></td>
<td><%= l @message.sent_on, :format => :friendly %></td>
<td></td>
</tr>
<tr>
<th></th>
<td><%= htmlize(@message.body) %></td>
<td></td>
</tr>
</table>
@ -44,18 +43,22 @@
<tr>
<th align="right"><%= t'message.read.to' %></th>
<td><%= link_to h(@message.recipient.display_name), :controller => 'user', :action => 'view', :display_name => @message.recipient.display_name %></td>
<td rowspan="4" valign="top"><%= user_thumbnail @message.recipient %></td>
</tr>
<tr>
<th align="right"><%= t'message.read.subject' %></th>
<td><%= h(@message.title) %></td>
<td></td>
</tr>
<tr>
<th align="right"><%= t'message.read.date' %></th>
<td><%= l @message.sent_on %></td>
<td><%= l @message.sent_on, :format => :friendly %></td>
<td></td>
</tr>
<tr>
<th></th>
<td><%= htmlize(@message.body) %></td>
<td></td>
</tr>
</table>

View file

@ -11,7 +11,7 @@
</tr>
<tr>
<td><%= t'trace.edit.uploaded_at' %></td>
<td><%= l @trace.timestamp %></td>
<td><%= l @trace.timestamp, :format => :friendly %></td>
</tr>
<% if @trace.inserted? %>
<tr>

View file

@ -15,7 +15,7 @@
</tr>
<tr>
<td><%= t'trace.view.uploaded' %></td>
<td><%= l @trace.timestamp %></td>
<td><%= l @trace.timestamp, :format => :friendly %></td>
</tr>
<% if @trace.inserted? %>
<tr>

View file

@ -75,7 +75,7 @@
<% end %>
</div>
<p><b><%= t 'user.view.mapper since' %></b> <%= l @this_user.creation_time %> <%= t 'user.view.ago', :time_in_words_ago => time_ago_in_words(@this_user.creation_time) %></p>
<p><b><%= t 'user.view.mapper since' %></b> <%= l @this_user.creation_time, :format => :friendly %> <%= t 'user.view.ago', :time_in_words_ago => time_ago_in_words(@this_user.creation_time) %></p>
<% if @user and @user.administrator? %>
<p><b><%= t 'user.view.email address' %></b> <%= @this_user.email %></p>