You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2020/01/28 15:12:20 UTC

[allura] 03/03: Repo sidebar: no Browse Commits if repo is empty; add Browse Files for SVN which has no branches links

This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 0f274c149ef0fb49e9f6c09a697883147002ac09
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Tue Jan 28 10:06:14 2020 -0500

    Repo sidebar: no Browse Commits if repo is empty; add Browse Files for SVN which has no branches links
---
 Allura/allura/lib/repository.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/Allura/allura/lib/repository.py b/Allura/allura/lib/repository.py
index f05206c..1de7045 100644
--- a/Allura/allura/lib/repository.py
+++ b/Allura/allura/lib/repository.py
@@ -125,8 +125,10 @@ class RepositoryApp(Application):
     def sidebar_menu(self):
         if not self.repo or self.repo.status != 'ready':
             return []
-        links = [SitemapEntry('Browse Commits', c.app.url +
-                              'commit_browser', ui_icon=g.icons['browse_commits'])]
+        links = []
+        if not self.repo.is_empty():
+            links.append(SitemapEntry('Browse Commits', c.app.url + 'commit_browser',
+                                      ui_icon=g.icons['browse_commits']))
         if self.forkable and self.repo.status == 'ready' and not self.repo.is_empty():
             links.append(
                 SitemapEntry('Fork', c.app.url + 'fork', ui_icon=g.icons['fork']))
@@ -196,6 +198,12 @@ class RepositoryApp(Application):
                         'More Branches',
                         ref_url + 'branches/',
                     ))
+        elif not self.repo.is_empty():
+            # SVN repos, for example, should have a sidebar link to get to the main view
+            links.append(
+                SitemapEntry('Browse Files', c.app.url)
+            )
+
         tags = self.repo.get_tags()
         if tags:
             links.append(SitemapEntry('Tags'))