# HG changeset patch # User Marcin Kuzminski # Date 2019-05-07 11:02:36 # Node ID 6431a1ec186bf808791f52d0a802d5fad051f019 # Parent 46f48e4d3e9c92f7298ab564241631e7ac4fcc9d ui: new file tree switcher - removed the pjax implementation - pjax isn't really a better choice here, and removing it simplifies a lot of logic. 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 @@ -225,8 +225,7 @@ class RepoFilesView(RepoAppView): return branch_name, sha_commit_id, is_head - def _get_tree_at_commit( - self, c, commit_id, f_path, full_load=False): + def _get_tree_at_commit(self, c, commit_id, f_path, full_load=False): repo_id = self.db_repo.repo_id force_recache = self.get_recache_flag() @@ -632,8 +631,7 @@ class RepoFilesView(RepoAppView): c.authors = [] # this loads a simple tree without metadata to speed things up # later via ajax we call repo_nodetree_full and fetch whole - c.file_tree = self._get_tree_at_commit( - c, c.commit.raw_id, f_path) + c.file_tree = self._get_tree_at_commit(c, c.commit.raw_id, f_path) except RepositoryError as e: h.flash(safe_str(h.escape(e)), category='error') diff --git a/rhodecode/apps/repository/views/repo_summary.py b/rhodecode/apps/repository/views/repo_summary.py --- a/rhodecode/apps/repository/views/repo_summary.py +++ b/rhodecode/apps/repository/views/repo_summary.py @@ -367,8 +367,7 @@ class RepoSummaryView(RepoAppView): }) return result - def _create_reference_items(self, repo, full_repo_name, refs, ref_type, - format_ref_id): + def _create_reference_items(self, repo, full_repo_name, refs, ref_type, format_ref_id): result = [] is_svn = h.is_svn(repo) for ref_name, raw_id in refs.iteritems(): @@ -380,6 +379,7 @@ class RepoSummaryView(RepoAppView): 'raw_id': raw_id, 'type': ref_type, 'files_url': files_url, + 'idx': 0, }) return result diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -217,9 +217,10 @@ class _ToolTip(object): tooltip = _ToolTip() -def files_breadcrumbs(repo_name, commit_id, file_path): +def files_breadcrumbs(repo_name, commit_id, file_path, at_ref=None): if isinstance(file_path, str): file_path = safe_unicode(file_path) + route_qry = {'at': at_ref} if at_ref else None # TODO: johbo: Is this always a url like path, or is this operating # system dependent? @@ -236,8 +237,9 @@ def files_breadcrumbs(repo_name, commit_ 'repo_files', repo_name=repo_name, commit_id=commit_id, - f_path=''), - class_='pjax-link')] + f_path='', + _query=route_qry), + )] last_cnt = len(path_segments) - 1 for cnt, segment in enumerate(path_segments): @@ -253,8 +255,9 @@ def files_breadcrumbs(repo_name, commit_ 'repo_files', repo_name=repo_name, commit_id=commit_id, - f_path='/'.join(path_segments[:cnt + 1])), - class_='pjax-link')) + f_path='/'.join(path_segments[:cnt + 1]), + _query=route_qry), + )) else: url_segments.append(segment_html) diff --git a/rhodecode/public/js/src/rhodecode/files.js b/rhodecode/public/js/src/rhodecode/files.js --- a/rhodecode/public/js/src/rhodecode/files.js +++ b/rhodecode/public/js/src/rhodecode/files.js @@ -142,7 +142,7 @@ var fileBrowserListeners = function(node }; var typeIcon = ''.format(typeObj[t]); - match.push('{1}{2}'.format(new_url,typeIcon, n_hl)); + match.push('{1}{2}'.format(new_url,typeIcon, n_hl)); } } if(results.length > limit){ @@ -231,8 +231,8 @@ var fileBrowserListeners = function(node } if (e.keyCode === 13){ // Enter if ($('.browser-highlight').length !== 0){ - var url = $('.browser-highlight').find('.pjax-link').attr('href'); - $.pjax({url: url, container: '#pjax-container', timeout: pjaxTimeout}); + var url = $('.browser-highlight').find('.match-link').attr('href'); + window.location = url; } } if (e.keyCode === 27){ // Esc diff --git a/rhodecode/templates/files/base.mako b/rhodecode/templates/files/base.mako --- a/rhodecode/templates/files/base.mako +++ b/rhodecode/templates/files/base.mako @@ -18,7 +18,7 @@ ${h.shorter(book)} %endfor %endif @@ -28,7 +28,7 @@ ${tag} %endfor @@ -37,7 +37,7 @@ ${h.shorter(commit.branch)} %endif diff --git a/rhodecode/templates/files/files.mako b/rhodecode/templates/files/files.mako --- a/rhodecode/templates/files/files.mako +++ b/rhodecode/templates/files/files.mako @@ -1,9 +1,9 @@ <%inherit file="/base/base.mako"/> <%def name="title(*args)"> - ${_('%s Files') % c.repo_name} + ${_('{} Files').format(c.repo_name)} %if hasattr(c,'file'): - · ${h.safe_unicode(c.file.path) or '\\'} + · ${(h.safe_unicode(c.file.path) or '\\')} %endif %if c.rhodecode_name: @@ -27,17 +27,16 @@ <%def name="main()"> -
+
<%include file='files_pjax.mako'/>
- + \ No newline at end of file diff --git a/rhodecode/templates/files/files_add.mako b/rhodecode/templates/files/files_add.mako --- a/rhodecode/templates/files/files_add.mako +++ b/rhodecode/templates/files/files_add.mako @@ -33,7 +33,7 @@
- ${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.f_path)} + ${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.f_path, request.GET.get('at'))} ${_('Specify Custom Path')}