diff pylons_app/lib/helpers.py @ 102:2dc0c8e4f384

Updated tempaltes, added file browser breadcrumbs, and feed icons
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 25 Apr 2010 18:42:58 +0200
parents 01d0f363f36d
children 4cea52709743
line wrap: on
line diff
--- a/pylons_app/lib/helpers.py	Sun Apr 25 01:25:54 2010 +0200
+++ b/pylons_app/lib/helpers.py	Sun Apr 25 18:42:58 2010 +0200
@@ -69,7 +69,17 @@
             return _("%.1f MB") % (bytes / (1024 * 1024))
         return _("%.1f GB") % (bytes / (1024 * 1024 * 1024))
 
+class _FilesBreadCrumbs(object):
+    
+    def __call__(self, repo_name, rev, paths):
+        url_l = [link_to(repo_name, url('files_home', repo_name=repo_name, f_path=''))]
+        paths_l = paths.split('/')
+        
+        for cnt, p in enumerate(paths_l, 1):
+            if p != '':
+                url_l.append(link_to(p, url('files_home', repo_name=repo_name, f_path='/'.join(paths_l[:cnt]))))
 
+        return literal(' / '.join(url_l))
 
 def pygmentize(code, **kwargs):
     '''
@@ -78,7 +88,7 @@
     return literal(highlight(code, guess_lexer(code), HtmlFormatter(**kwargs)))
 
 
-
+files_breadcrumbs = _FilesBreadCrumbs()
 filesizeformat = _FileSizeFormat()
 link = _Link()
 flash = _Flash()