]> git.openstreetmap.org Git - rails.git/commitdiff
Add a "friendly" date/time format and use it whenever we are printing
authorTom Hughes <tom@compton.nu>
Sun, 28 Feb 2010 16:57:22 +0000 (16:57 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 28 Feb 2010 16:57:22 +0000 (16:57 +0000)
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
app/views/diary_entry/_diary_entry.html.erb
app/views/message/_message_summary.html.erb
app/views/message/_sent_message_summary.html.erb
app/views/message/read.html.erb
app/views/trace/edit.html.erb
app/views/trace/view.html.erb
app/views/user/view.html.erb
config/locales/en.yml

index 6bc7f73f9ffdfe1f0b78d90c58a65f8261fb1792..77238b4d37690348afd5586010d8609bff3f2d18 100644 (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')} %>
index c9a6baec0a6940249536103b4d6592273f1a99e0..17078a8bb9f42be93b20e1be82f03cd6a1d0a542 100644 (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' %>
index d4d4f788be69d7c7117b6c4fba741f4f1e3a86a2..1397d65aff3669c92faee30d68398819d79e05e0 100644 (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 %>
index 9d3275835d42dca96f717342201d9c4ac713104a..d4d8b3fa5749a8e9c9ca0dbf52887018fd4c7edd 100644 (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>
index 8a7b6b1563c235340f6969e42a320f5b53b3497e..5764031704b9698097d4109c112a2cb9583a2d0f 100644 (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>
 
   <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>
 
index 523607ae63b660094bcd930dbe92a175b261b105..202f9039d573b5a81ed954818c91f2af6ee40941 100644 (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>
index c1d5e044570f1b1b197fa62e284f3a69525cb3db..73638cb3d917da56649a77be0bd504b807746f4e 100644 (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>
index 8aa4ead492486182895318e2f801335490a8964f..77ad06a8f7059410a170280f9bef454636ef8885 100644 (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>  
index 5d647e515222de0ca2a828f6804ccb6708ea4011..633f54c12e57954b3061ab76a0a1ea712ae21191 100644 (file)
@@ -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"