Changeset - bcdcdd576e0a
[Not reviewed]
default
0 1 0
domruf - 9 years ago 2016-09-15 18:50:30
dominikruf@gmail.com
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.)
1 file changed with 4 insertions and 3 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/helpers.py
Show inline comments
 
@@ -1128,30 +1128,31 @@ def changed_tooltip(nodes):
 
        return literal(pref + '<br/> '.join([safe_unicode(x.path)
 
                                             for x in nodes[:30]]) + suf)
 
    else:
 
        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
 

	
 
    ex::
 
        group >> subgroup >> repo
 

	
 
    :param groups_and_repos:
 
    :param last_url:
 
    """
 
    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]))
 

	
 

	
 
def fancy_file_stats(stats):
 
    """
 
    Displays a fancy two colored bar for number of added/deleted
0 comments (0 inline, 0 general)