changeset 6249:44e6e66c1855

templates: get rid of repo_breadcrumbs Generate the the breadcrumbs directly in the templates. That is what templates are for, generating html code.
author domruf <dominikruf@gmail.com>
date Mon, 26 Sep 2016 17:11:02 +0200
parents d39a579a4c60
children 9f4d95780f59
files kallithea/lib/helpers.py kallithea/templates/base/base.html
diffstat 2 files changed, 5 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/helpers.py	Fri Sep 23 18:34:53 2016 +0200
+++ b/kallithea/lib/helpers.py	Mon Sep 26 17:11:02 2016 +0200
@@ -1132,21 +1132,6 @@
         return ': ' + _('No files')
 
 
-def repo_breadcrumbs(groups_and_repos, link_class=None):
-    """
-    Makes breadcrumb links to a repo within its groups, like 'group >> subgroup >> repo'.
-    """
-    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, class_=link_class)
-
-    def make_link(group):
-        return link_to(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
--- a/kallithea/templates/base/base.html	Fri Sep 23 18:34:53 2016 +0200
+++ b/kallithea/templates/base/base.html	Mon Sep 26 17:11:02 2016 +0200
@@ -113,19 +113,16 @@
         %else:
           <i class="icon-globe"></i>
         %endif
-        ${h.repo_breadcrumbs(c.db_repo.groups_and_repo)}
+        %for group in c.db_repo.groups_with_parents:
+          ${h.link_to(group.name, url('repos_group_home', group_name=group.group_name))}
+          &raquo;
+        %endfor
+        ${h.link_to(c.db_repo.just_name, url('summary_home', repo_name=c.db_repo.repo_name))}
 
         %if current == 'createfork':
          - ${_('Create Fork')}
         %endif
       </h2>
-      <!--
-      <div id="breadcrumbs">
-        ${h.link_to(_('Repositories'),h.url('home'))}
-        &raquo;
-        ${h.repo_breadcrumbs(c.db_repo.groups_and_repo)}
-      </div>
-      -->
       <ul id="context-pages" class="horizontal-list">
         <li ${is_current('summary')} data-context="summary"><a href="${h.url('summary_home', repo_name=c.repo_name)}"><i class="icon-doc-text"></i> ${_('Summary')}</a></li>
         %if rev: