changeset 2416:44f328d6f209 beta

Added a translatable date formatter for every date displayed.
author Vincent Duvert <vincent@duvert.net>
date Tue, 05 Jun 2012 00:17:28 +0200
parents b9abef8dd2b4
children 76d156bef5a2
files rhodecode/lib/helpers.py rhodecode/templates/admin/admin_log.html rhodecode/templates/admin/users/users.html rhodecode/templates/bookmarks/bookmarks_data.html rhodecode/templates/branches/branches_data.html rhodecode/templates/changelog/changelog.html rhodecode/templates/changeset/changeset.html rhodecode/templates/changeset/changeset_range.html rhodecode/templates/files/files_browser.html rhodecode/templates/files/files_source.html rhodecode/templates/index_base.html rhodecode/templates/journal/journal_data.html rhodecode/templates/shortlog/shortlog_data.html rhodecode/templates/tags/tags_data.html
diffstat 14 files changed, 22 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/helpers.py	Mon May 28 21:56:56 2012 +0200
+++ b/rhodecode/lib/helpers.py	Tue Jun 05 00:17:28 2012 +0200
@@ -345,6 +345,14 @@
 hide_credentials = lambda x: ''.join(credentials_filter(x))
 
 
+def fmt_date(date):
+    if date:
+        return (date.strftime(_(u"%a, %d %b %Y %H:%M:%S").encode('utf8'))
+            .decode('utf8'))
+    
+    return ""
+
+
 def is_git(repository):
     if hasattr(repository, 'alias'):
         _type = repository.alias
--- a/rhodecode/templates/admin/admin_log.html	Mon May 28 21:56:56 2012 +0200
+++ b/rhodecode/templates/admin/admin_log.html	Tue Jun 05 00:17:28 2012 +0200
@@ -25,7 +25,7 @@
 		%endif
 		</td>
 
-		<td>${l.action_date}</td>
+		<td>${h.fmt_date(l.action_date)}</td>
 		<td>${l.user_ip}</td>
 	</tr>
 	%endfor
--- a/rhodecode/templates/admin/users/users.html	Mon May 28 21:56:56 2012 +0200
+++ b/rhodecode/templates/admin/users/users.html	Tue Jun 05 00:17:28 2012 +0200
@@ -46,7 +46,7 @@
                     <td>${h.link_to(user.username,h.url('edit_user', id=user.user_id))}</td>
                     <td>${user.name}</td>
                     <td>${user.lastname}</td>
-                    <td>${user.last_login}</td>
+                    <td>${h.fmt_date(user.last_login)}</td>
                     <td>${h.bool2icon(user.active)}</td>
                     <td>${h.bool2icon(user.admin)}</td>
                     <td>${h.bool2icon(bool(user.ldap_dn))}</td>
--- a/rhodecode/templates/bookmarks/bookmarks_data.html	Mon May 28 21:56:56 2012 +0200
+++ b/rhodecode/templates/bookmarks/bookmarks_data.html	Tue Jun 05 00:17:28 2012 +0200
@@ -17,7 +17,7 @@
                     h.url('files_home',repo_name=c.repo_name,revision=book[1].raw_id))}</span>
                 </span>
             </td>
-            <td><span class="tooltip" title="${h.age(book[1].date)}">${book[1].date}</span></td>
+            <td><span class="tooltip" title="${h.age(book[1].date)}">${h.fmt_date(book[1].date)}</span></td>
 	        <td title="${book[1].author}">${h.person(book[1].author)}</td>
 	        <td>
               <div>
--- a/rhodecode/templates/branches/branches_data.html	Mon May 28 21:56:56 2012 +0200
+++ b/rhodecode/templates/branches/branches_data.html	Tue Jun 05 00:17:28 2012 +0200
@@ -17,7 +17,7 @@
                     h.url('files_home',repo_name=c.repo_name,revision=branch[1].raw_id))}</span>
                 </span>
             </td>
-            <td><span class="tooltip" title="${h.age(branch[1].date)}">${branch[1].date}</span></td>
+            <td><span class="tooltip" title="${h.age(branch[1].date)}">${h.fmt_date(branch[1].date)}</span></td>
             <td title="${branch[1].author}">${h.person(branch[1].author)}</td>
             <td>
                 <div>
@@ -35,7 +35,7 @@
                       h.url('changeset_home',repo_name=c.repo_name,revision=branch[1].raw_id))}</span>
                   </span>
               </td>
-              <td><span class="tooltip" title="${h.age(branch[1].date)}">${branch[1].date}</span></td>
+              <td><span class="tooltip" title="${h.age(branch[1].date)}">${h.fmt_date(branch[1].date)}</span></td>
               <td title="${branch[1].author}">${h.person(branch[1].author)}</td>
               <td>
                 <div>
--- a/rhodecode/templates/changelog/changelog.html	Mon May 28 21:56:56 2012 +0200
+++ b/rhodecode/templates/changelog/changelog.html	Tue Jun 05 00:17:28 2012 +0200
@@ -57,7 +57,7 @@
 								</div>
 								<div title="${cs.author}" class="user">${h.shorter(h.person(cs.author),22)}</div>
 							</div>
-                            <div class="date">${cs.date}</div>
+                            <div class="date">${h.fmt_date(cs.date)}</div>
 						</div>
 						<div class="mid">
                             <div class="message">${h.urlify_commit(h.wrap_paragraphs(cs.message),c.repo_name,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</div>
--- a/rhodecode/templates/changeset/changeset.html	Mon May 28 21:56:56 2012 +0200
+++ b/rhodecode/templates/changeset/changeset.html	Tue Jun 05 00:17:28 2012 +0200
@@ -31,7 +31,7 @@
                  r${c.changeset.revision}:${h.short_id(c.changeset.raw_id)}
                 </div>
                 <div class="date">
-                  ${c.changeset.date}
+                  ${h.fmt_date(c.changeset.date)}
                 </div>
                 <div class="diff-actions">
                   <a href="${h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='show')}" title="${_('raw diff')}" class="tooltip"><img class="icon" src="${h.url('/images/icons/page_white.png')}"/></a>
--- a/rhodecode/templates/changeset/changeset_range.html	Mon May 28 21:56:56 2012 +0200
+++ b/rhodecode/templates/changeset/changeset_range.html	Tue Jun 05 00:17:28 2012 +0200
@@ -40,7 +40,7 @@
                 <td><div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(h.email(cs.author),14)}"/></div></td>
                 <td>${h.link_to('r%s:%s' % (cs.revision,h.short_id(cs.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</td>
                 <td><div class="author">${h.person(cs.author)}</div></td>
-                <td><span class="tooltip" title="${h.age(cs.date)}">${cs.date}</span></td>
+                <td><span class="tooltip" title="${h.age(cs.date)}">${h.fmt_date(cs.date)}</span></td>
                 <td><div class="message">${h.urlify_commit(h.wrap_paragraphs(cs.message),c.repo_name)}</div></td>
                 </tr>
             %endfor
--- a/rhodecode/templates/files/files_browser.html	Mon May 28 21:56:56 2012 +0200
+++ b/rhodecode/templates/files/files_browser.html	Tue Jun 05 00:17:28 2012 +0200
@@ -95,7 +95,7 @@
 		             </td>
 		             <td>
 		             	%if node.is_file():
-		             		<span class="tooltip" title="${node.last_changeset.date}">
+		             		<span class="tooltip" title="${h.fmt_date(node.last_changeset.date)}">
                             ${h.age(node.last_changeset.date)}</span>
 		             	%endif
 		             </td>
--- a/rhodecode/templates/files/files_source.html	Mon May 28 21:56:56 2012 +0200
+++ b/rhodecode/templates/files/files_source.html	Tue Jun 05 00:17:28 2012 +0200
@@ -16,7 +16,7 @@
 	<div class="code-header">
         <div class="stats">
             <div class="left img"><img src="${h.url('/images/icons/file.png')}"/></div>
-            <div class="left item"><pre class="tooltip" title="${c.file.changeset.date}">${h.link_to("r%s:%s" % (c.file.changeset.revision,h.short_id(c.file.changeset.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=c.file.changeset.raw_id))}</pre></div>
+            <div class="left item"><pre class="tooltip" title="${h.fmt_date(c.file.changeset.date)}">${h.link_to("r%s:%s" % (c.file.changeset.revision,h.short_id(c.file.changeset.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=c.file.changeset.raw_id))}</pre></div>
             <div class="left item"><pre>${h.format_byte_size(c.file.size,binary=True)}</pre></div>
             <div class="left item last"><pre>${c.file.mimetype}</pre></div>
             <div class="buttons">
--- a/rhodecode/templates/index_base.html	Mon May 28 21:56:56 2012 +0200
+++ b/rhodecode/templates/index_base.html	Tue Jun 05 00:17:28 2012 +0200
@@ -89,7 +89,7 @@
                     </td>
                     ##LAST CHANGE DATE
                     <td>
-                      <span class="tooltip" title="${repo['last_change']}">${h.age(repo['last_change'])}</span>
+                      <span class="tooltip" title="${h.fmt_date(repo['last_change'])}">${h.age(repo['last_change'])}</span>
                     </td>
                     ##LAST REVISION
                     <td>
--- a/rhodecode/templates/journal/journal_data.html	Mon May 28 21:56:56 2012 +0200
+++ b/rhodecode/templates/journal/journal_data.html	Tue Jun 05 00:17:28 2012 +0200
@@ -24,7 +24,7 @@
 		                </span>
 		            </div>
 		            <div class="journal_action_params">${h.literal(h.action_parser(entry)[1]())}</div>
-		            <div class="date"><span class="tooltip" title="${entry.action_date}">${h.age(entry.action_date)}</span></div>
+		            <div class="date"><span class="tooltip" title="${h.fmt_date(entry.action_date)}">${h.age(entry.action_date)}</span></div>
 	            %endfor
 	            </div>
 	        </div>
--- a/rhodecode/templates/shortlog/shortlog_data.html	Mon May 28 21:56:56 2012 +0200
+++ b/rhodecode/templates/shortlog/shortlog_data.html	Tue Jun 05 00:17:28 2012 +0200
@@ -19,7 +19,7 @@
             h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id),
             title=cs.message)}
         </td>
-        <td><span class="tooltip" title="${cs.date}">
+        <td><span class="tooltip" title="${h.fmt_date(cs.date)}">
                       ${h.age(cs.date)}</span>
         </td>
 		<td title="${cs.author}">${h.person(cs.author)}</td>
--- a/rhodecode/templates/tags/tags_data.html	Mon May 28 21:56:56 2012 +0200
+++ b/rhodecode/templates/tags/tags_data.html	Tue Jun 05 00:17:28 2012 +0200
@@ -18,7 +18,7 @@
                     </span>
                 </span>
             </td>
-            <td><span class="tooltip" title="${h.age(tag[1].date)}">${tag[1].date}</span></td>
+            <td><span class="tooltip" title="${h.age(tag[1].date)}">${h.fmt_date(tag[1].date)}</span></td>
 	        <td title="${tag[1].author}">${h.person(tag[1].author)}</td>
 	        <td>
                 <div>