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 @@ -647,32 +647,6 @@ class RepoFilesView(RepoAppView): c.f_path = f_path at_rev = self.request.GET.get('at') - # prev link - try: - prev_commit = c.commit.prev(c.branch) - c.prev_commit = prev_commit - c.url_prev = h.route_path( - 'repo_files', repo_name=self.db_repo_name, - commit_id=prev_commit.raw_id, f_path=f_path) - if c.branch: - c.url_prev += '?branch=%s' % c.branch - except (CommitDoesNotExistError, VCSError): - c.url_prev = '#' - c.prev_commit = EmptyCommit() - - # next link - try: - next_commit = c.commit.next(c.branch) - c.next_commit = next_commit - c.url_next = h.route_path( - 'repo_files', repo_name=self.db_repo_name, - commit_id=next_commit.raw_id, f_path=f_path) - if c.branch: - c.url_next += '?branch=%s' % c.branch - except (CommitDoesNotExistError, VCSError): - c.url_next = '#' - c.next_commit = EmptyCommit() - # files or dirs try: c.file = c.commit.get_node(f_path, pre_load=['is_binary', 'size', 'data']) @@ -680,8 +654,35 @@ class RepoFilesView(RepoAppView): c.file_author = True c.file_tree = '' + # prev link + try: + prev_commit = c.commit.prev(c.branch) + c.prev_commit = prev_commit + c.url_prev = h.route_path( + 'repo_files', repo_name=self.db_repo_name, + commit_id=prev_commit.raw_id, f_path=f_path) + if c.branch: + c.url_prev += '?branch=%s' % c.branch + except (CommitDoesNotExistError, VCSError): + c.url_prev = '#' + c.prev_commit = EmptyCommit() + + # next link + try: + next_commit = c.commit.next(c.branch) + c.next_commit = next_commit + c.url_next = h.route_path( + 'repo_files', repo_name=self.db_repo_name, + commit_id=next_commit.raw_id, f_path=f_path) + if c.branch: + c.url_next += '?branch=%s' % c.branch + except (CommitDoesNotExistError, VCSError): + c.url_next = '#' + c.next_commit = EmptyCommit() + # load file content if c.file.is_file(): + c.lf_node = {} has_lf_enabled = self._is_lf_enabled(self.db_repo) diff --git a/rhodecode/model/repo.py b/rhodecode/model/repo.py --- a/rhodecode/model/repo.py +++ b/rhodecode/model/repo.py @@ -39,6 +39,7 @@ from rhodecode.lib.utils2 import ( safe_str, remove_prefix, obfuscate_url_pw, get_current_rhodecode_user, safe_int, action_logger_generic) from rhodecode.lib.vcs.backends import get_backend +from rhodecode.lib.vcs.nodes import NodeKind from rhodecode.model import BaseModel from rhodecode.model.db import ( _hash_key, func, case, joinedload, or_, in_filter_generator, @@ -1128,6 +1129,10 @@ class ReadmeFinder: """ Find a readme in the given `commit`. """ + # firstly, check the PATH type if it is actually a DIR + if commit.get_node(path).kind != NodeKind.DIR: + return None + nodes = commit.get_nodes(path) matches = self._match_readmes(nodes) matches = self._sort_according_to_priority(matches) diff --git a/rhodecode/templates/ejs_templates/templates.html b/rhodecode/templates/ejs_templates/templates.html --- a/rhodecode/templates/ejs_templates/templates.html +++ b/rhodecode/templates/ejs_templates/templates.html @@ -264,7 +264,10 @@ They are permanent until deleted, or con - + ##// END OF EJS Templates diff --git a/rhodecode/templates/files/files_browser_tree.mako b/rhodecode/templates/files/files_browser_tree.mako --- a/rhodecode/templates/files/files_browser_tree.mako +++ b/rhodecode/templates/files/files_browser_tree.mako @@ -1,5 +1,13 @@ <%namespace name="base" file="/base/base.mako"/> +<%doc> +Please note the content of this file is cached, so changes here might not be reflected when editing. +add ?no-cache=true into the file url to disable caches. + +e.g +http://docker-dev:10020/ipython/files/master/IPython/frontend/html/notebook/static?no-cache=1 + + <% at_ref = request.GET.get('at') if at_ref: @@ -29,65 +37,71 @@ <% has_files = False %> - % for cnt,node in enumerate(c.file): - <% has_files = True %> - - - % if node.is_submodule(): - - % if node.url.startswith('http://') or node.url.startswith('https://'): - - ${node.name} + % if not c.file.is_submodule(): + % for cnt, node in enumerate(c.file): + <% has_files = True %> + + + % if node.is_submodule(): + + % if node.url.startswith('http://') or node.url.startswith('https://'): + + ${node.name} + + % else: + ${node.name} + % endif + + % else: + + ${node.name} - % else: - ${node.name} % endif - - % else: - - ${node.name} - - % endif - - %if node.is_file(): - - % if c.full_load: - ${h.format_byte_size_binary(node.size)} - % else: - ${_('Loading ...')} - % endif - - - % if c.full_load: - ${h.age_component(node.last_commit.date)} - % endif - - - % if c.full_load: -
-
r${node.last_commit.idx}:${node.last_commit.short_id}
-
- % endif - - - % if c.full_load: - ${h.gravatar_with_user(request, node.last_commit.author, tooltip=True)|n} - % endif - - %else: - - - - - %endif - - % endfor + + %if node.is_file(): + + % if c.full_load: + ${h.format_byte_size_binary(node.size)} + % else: + ${_('Loading ...')} + % endif + + + % if c.full_load: + ${h.age_component(node.last_commit.date)} + % endif + + + % if c.full_load: +
+
r${node.last_commit.idx}:${node.last_commit.short_id}
+
+ % endif + + + % if c.full_load: + ${h.gravatar_with_user(request, node.last_commit.author, tooltip=True)|n} + % endif + + %else: + + + + + %endif + + % endfor + % endif % if not has_files: ##empty-dir mostly SVN -   + + ## submodule if we somehow endup + % if c.file.is_submodule(): + Submodule ${h.escape(c.file.name)} + %endif % endif diff --git a/rhodecode/templates/files/files_pjax.mako b/rhodecode/templates/files/files_pjax.mako --- a/rhodecode/templates/files/files_pjax.mako +++ b/rhodecode/templates/files/files_pjax.mako @@ -15,17 +15,15 @@
- - % if c.file.is_submodule(): - Submodule ${h.escape(c.file.name)} - % elif c.file.is_dir(): + % if c.file.is_dir() or c.file.is_submodule(): <%include file='files_tree_header.mako'/> % else: <%include file='files_source_header.mako'/> % endif - % if c.file.is_dir(): + + % if c.file.is_dir() or c.file.is_submodule(): <%include file='files_browser.mako'/> % else: <%include file='files_source.mako'/>