diff --git a/rhodecode/apps/repository/tests/test_repo_files.py b/rhodecode/apps/repository/tests/test_repo_files.py --- a/rhodecode/apps/repository/tests/test_repo_files.py +++ b/rhodecode/apps/repository/tests/test_repo_files.py @@ -181,7 +181,7 @@ class TestFilesViews(object): landing_rev = backend.repo.landing_ref_name files_url = route_path('repo_files:default_path', repo_name=backend.repo_name, - commit_id=landing_rev) + commit_id=landing_rev, params={'at': landing_rev}) assert landing_rev != 'tip' response.mustcontain( diff --git a/rhodecode/apps/repository/views/repo_files.py b/rhodecode/apps/repository/views/repo_files.py --- a/rhodecode/apps/repository/views/repo_files.py +++ b/rhodecode/apps/repository/views/repo_files.py @@ -589,6 +589,20 @@ class RepoFilesView(RepoAppView): raise HTTPFound(compare_url) @LoginRequired() + @view_config( + route_name='repo_files:default_commit', request_method='GET', + renderer=None) + def repo_files_default(self): + c = self.load_default_context() + + landing_url = h.route_path( + 'repo_files', repo_name=c.repo_name, + commit_id=c.rhodecode_db_repo.landing_ref_name, f_path='', + _query={'at': c.rhodecode_db_repo.landing_ref_name}) + + raise HTTPFound(landing_url) + + @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') @view_config( @@ -598,9 +612,6 @@ class RepoFilesView(RepoAppView): route_name='repo_files:default_path', request_method='GET', renderer=None) @view_config( - route_name='repo_files:default_commit', request_method='GET', - renderer=None) - @view_config( route_name='repo_files:rendered', request_method='GET', renderer=None) @view_config( diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -256,11 +256,17 @@ tooltip = _ToolTip() files_icon = u'' -def files_breadcrumbs(repo_name, commit_id, file_path, at_ref=None, limit_items=False, linkify_last_item=False): +def files_breadcrumbs(repo_name, commit_id, file_path, landing_ref_name=None, at_ref=None, + limit_items=False, linkify_last_item=False, hide_last_item=False, copy_path_icon=True): if isinstance(file_path, str): file_path = safe_unicode(file_path) - route_qry = {'at': at_ref} if at_ref else None + if at_ref: + route_qry = {'at': at_ref} + default_commit_id = at_ref or landing_ref_name or commit_id + else: + route_qry = None + default_commit_id = commit_id # first segment is a `..` link to repo files root_name = literal(u'') @@ -270,7 +276,7 @@ def files_breadcrumbs(repo_name, commit_ route_path( 'repo_files', repo_name=repo_name, - commit_id=commit_id, + commit_id=default_commit_id, f_path='', _query=route_qry), )] @@ -284,6 +290,10 @@ def files_breadcrumbs(repo_name, commit_ last_item = cnt == last_cnt + if last_item and hide_last_item: + # iterate over and hide last element + continue + if last_item and linkify_last_item is False: # plain version url_segments.append(segment_html) @@ -294,7 +304,7 @@ def files_breadcrumbs(repo_name, commit_ route_path( 'repo_files', repo_name=repo_name, - commit_id=commit_id, + commit_id=default_commit_id, f_path='/'.join(path_segments[:cnt + 1]), _query=route_qry), )) @@ -304,7 +314,11 @@ def files_breadcrumbs(repo_name, commit_ url_segments = limited_url_segments full_path = file_path - icon = files_icon.format(escape(full_path)) + if copy_path_icon: + icon = files_icon.format(escape(full_path)) + else: + icon = '' + if file_path == '': return root_name else: diff --git a/rhodecode/templates/base/base.mako b/rhodecode/templates/base/base.mako --- a/rhodecode/templates/base/base.mako +++ b/rhodecode/templates/base/base.mako @@ -365,7 +365,7 @@