changeset 6240:bcdcdd576e0a

helpers: allow to set class for repo_link breadcrumb links This helps Bootstrap support. (Since this is a high level function that returns several links and not just a single html element, the patch has been modified to only allow specifying a class that is used for all the links.)
author domruf <dominikruf@gmail.com>
date Thu, 15 Sep 2016 18:50:30 +0200
parents fa85c3df571b
children 19c9f4f5428e
files kallithea/lib/helpers.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/helpers.py	Sun Sep 25 17:21:07 2016 +0200
+++ b/kallithea/lib/helpers.py	Thu Sep 15 18:50:30 2016 +0200
@@ -1131,7 +1131,7 @@
         return ': ' + _('No files')
 
 
-def repo_link(groups_and_repos):
+def repo_link(groups_and_repos, link_class=None):
     """
     Makes a breadcrumbs link to repo within a group
     joins &raquo; on each group to create a fancy link
@@ -1144,11 +1144,12 @@
     """
     groups, just_name, repo_name = groups_and_repos
     last_url = url('summary_home', repo_name=repo_name)
-    last_link = link_to(just_name, last_url)
+    last_link = link_to(just_name, last_url, class_=link_class)
 
     def make_link(group):
         return link_to(group.name,
-                       url('repos_group_home', group_name=group.group_name))
+                       url('repos_group_home', group_name=group.group_name),
+                       class_=link_class)
     return literal(' &raquo; '.join(map(make_link, groups) + ['<span>%s</span>' % last_link]))