##// END OF EJS Templates
fix(submodules): fixed an error if reaching out submodule path....
super-admin -
r5261:550d6219 default
parent child Browse files
Show More
@@ -647,32 +647,6 b' class RepoFilesView(RepoAppView):'
647 647 c.f_path = f_path
648 648 at_rev = self.request.GET.get('at')
649 649
650 # prev link
651 try:
652 prev_commit = c.commit.prev(c.branch)
653 c.prev_commit = prev_commit
654 c.url_prev = h.route_path(
655 'repo_files', repo_name=self.db_repo_name,
656 commit_id=prev_commit.raw_id, f_path=f_path)
657 if c.branch:
658 c.url_prev += '?branch=%s' % c.branch
659 except (CommitDoesNotExistError, VCSError):
660 c.url_prev = '#'
661 c.prev_commit = EmptyCommit()
662
663 # next link
664 try:
665 next_commit = c.commit.next(c.branch)
666 c.next_commit = next_commit
667 c.url_next = h.route_path(
668 'repo_files', repo_name=self.db_repo_name,
669 commit_id=next_commit.raw_id, f_path=f_path)
670 if c.branch:
671 c.url_next += '?branch=%s' % c.branch
672 except (CommitDoesNotExistError, VCSError):
673 c.url_next = '#'
674 c.next_commit = EmptyCommit()
675
676 650 # files or dirs
677 651 try:
678 652 c.file = c.commit.get_node(f_path, pre_load=['is_binary', 'size', 'data'])
@@ -680,8 +654,35 b' class RepoFilesView(RepoAppView):'
680 654 c.file_author = True
681 655 c.file_tree = ''
682 656
657 # prev link
658 try:
659 prev_commit = c.commit.prev(c.branch)
660 c.prev_commit = prev_commit
661 c.url_prev = h.route_path(
662 'repo_files', repo_name=self.db_repo_name,
663 commit_id=prev_commit.raw_id, f_path=f_path)
664 if c.branch:
665 c.url_prev += '?branch=%s' % c.branch
666 except (CommitDoesNotExistError, VCSError):
667 c.url_prev = '#'
668 c.prev_commit = EmptyCommit()
669
670 # next link
671 try:
672 next_commit = c.commit.next(c.branch)
673 c.next_commit = next_commit
674 c.url_next = h.route_path(
675 'repo_files', repo_name=self.db_repo_name,
676 commit_id=next_commit.raw_id, f_path=f_path)
677 if c.branch:
678 c.url_next += '?branch=%s' % c.branch
679 except (CommitDoesNotExistError, VCSError):
680 c.url_next = '#'
681 c.next_commit = EmptyCommit()
682
683 683 # load file content
684 684 if c.file.is_file():
685
685 686 c.lf_node = {}
686 687
687 688 has_lf_enabled = self._is_lf_enabled(self.db_repo)
@@ -39,6 +39,7 b' from rhodecode.lib.utils2 import ('
39 39 safe_str, remove_prefix, obfuscate_url_pw,
40 40 get_current_rhodecode_user, safe_int, action_logger_generic)
41 41 from rhodecode.lib.vcs.backends import get_backend
42 from rhodecode.lib.vcs.nodes import NodeKind
42 43 from rhodecode.model import BaseModel
43 44 from rhodecode.model.db import (
44 45 _hash_key, func, case, joinedload, or_, in_filter_generator,
@@ -1128,6 +1129,10 b' class ReadmeFinder:'
1128 1129 """
1129 1130 Find a readme in the given `commit`.
1130 1131 """
1132 # firstly, check the PATH type if it is actually a DIR
1133 if commit.get_node(path).kind != NodeKind.DIR:
1134 return None
1135
1131 1136 nodes = commit.get_nodes(path)
1132 1137 matches = self._match_readmes(nodes)
1133 1138 matches = self._sort_according_to_priority(matches)
@@ -264,7 +264,10 b' They are permanent until deleted, or con'
264 264
265 265 </script>
266 266
267
267 <script id="ejs_submoduleHovercard" type="text/template" class="ejsTemplate">
268 <strong>Submodule Node</strong><br/>
269 <pre><%= submodule_url %></pre>
270 </script>
268 271
269 272 ##// END OF EJS Templates
270 273 </div>
@@ -1,5 +1,13 b''
1 1 <%namespace name="base" file="/base/base.mako"/>
2 2
3 <%doc>
4 Please note the content of this file is cached, so changes here might not be reflected when editing.
5 add ?no-cache=true into the file url to disable caches.
6
7 e.g
8 http://docker-dev:10020/ipython/files/master/IPython/frontend/html/notebook/static?no-cache=1
9
10 </%doc>
3 11 <%
4 12 at_ref = request.GET.get('at')
5 13 if at_ref:
@@ -29,65 +37,71 b''
29 37 </tr>
30 38
31 39 <% has_files = False %>
32 % for cnt,node in enumerate(c.file):
33 <% has_files = True %>
34 <tr class="parity${(cnt % 2)}">
35 <td class="td-componentname">
36 % if node.is_submodule():
37 <span class="submodule-dir">
38 % if node.url.startswith('http://') or node.url.startswith('https://'):
39 <a href="${node.url}">
40 <i class="icon-directory browser-dir"></i>${node.name}
40 % if not c.file.is_submodule():
41 % for cnt, node in enumerate(c.file):
42 <% has_files = True %>
43 <tr class="parity${(cnt % 2)}">
44 <td class="td-componentname">
45 % if node.is_submodule():
46 <span class="submodule-dir">
47 % if node.url.startswith('http://') or node.url.startswith('https://'):
48 <a href="${node.url}">
49 <i class="icon-directory browser-dir"></i><span class="tooltip-hovercard" data-hovercard-alt="${node.url}" data-hovercard-url="javascript:renderTemplate('submoduleHovercard', {'submodule_url':'${node.url}'})">${node.name}</span>
50 </a>
51 % else:
52 <i class="icon-directory browser-dir"></i><span class="tooltip-hovercard" data-hovercard-alt="${node.url}" data-hovercard-url="javascript:renderTemplate('submoduleHovercard', {'submodule_url':'${node.url}'})">${node.name}</span>
53 % endif
54 </span>
55 % else:
56 <a href="${h.repo_files_by_ref_url(c.repo_name, c.rhodecode_db_repo.repo_type, f_path=h.safe_str(node.path), ref_name=default_landing_ref, commit_id=c.commit.raw_id, query=query)}">
57 <i class="${('icon-file-text browser-file' if node.is_file() else 'icon-directory browser-dir')}"></i>${node.name}
41 58 </a>
42 % else:
43 <i class="icon-directory browser-dir"></i>${node.name}
44 59 % endif
45 </span>
46 % else:
47 <a href="${h.repo_files_by_ref_url(c.repo_name, c.rhodecode_db_repo.repo_type, f_path=h.safe_str(node.path), ref_name=default_landing_ref, commit_id=c.commit.raw_id, query=query)}">
48 <i class="${('icon-file-text browser-file' if node.is_file() else 'icon-directory browser-dir')}"></i>${node.name}
49 </a>
50 % endif
51 </td>
52 %if node.is_file():
53 <td class="td-size" data-attr-name="size">
54 % if c.full_load:
55 <span data-size="${node.size}">${h.format_byte_size_binary(node.size)}</span>
56 % else:
57 ${_('Loading ...')}
58 % endif
59 </td>
60 <td class="td-time" data-attr-name="modified_at">
61 % if c.full_load:
62 <span data-date="${node.last_commit.date}">${h.age_component(node.last_commit.date)}</span>
63 % endif
64 </td>
65 <td class="td-hash" data-attr-name="commit_id">
66 % if c.full_load:
67 <div class="tooltip-hovercard" data-hovercard-alt="${node.last_commit.message}" data-hovercard-url="${h.route_path('hovercard_repo_commit', repo_name=c.repo_name, commit_id=node.last_commit.raw_id)}">
68 <pre data-commit-id="${node.last_commit.raw_id}">r${node.last_commit.idx}:${node.last_commit.short_id}</pre>
69 </div>
70 % endif
71 </td>
72 <td class="td-user" data-attr-name="author">
73 % if c.full_load:
74 <span data-author="${node.last_commit.author}">${h.gravatar_with_user(request, node.last_commit.author, tooltip=True)|n}</span>
75 % endif
76 </td>
77 %else:
78 <td></td>
79 <td></td>
80 <td></td>
81 <td></td>
82 %endif
83 </tr>
84 % endfor
60 </td>
61 %if node.is_file():
62 <td class="td-size" data-attr-name="size">
63 % if c.full_load:
64 <span data-size="${node.size}">${h.format_byte_size_binary(node.size)}</span>
65 % else:
66 ${_('Loading ...')}
67 % endif
68 </td>
69 <td class="td-time" data-attr-name="modified_at">
70 % if c.full_load:
71 <span data-date="${node.last_commit.date}">${h.age_component(node.last_commit.date)}</span>
72 % endif
73 </td>
74 <td class="td-hash" data-attr-name="commit_id">
75 % if c.full_load:
76 <div class="tooltip-hovercard" data-hovercard-alt="${node.last_commit.message}" data-hovercard-url="${h.route_path('hovercard_repo_commit', repo_name=c.repo_name, commit_id=node.last_commit.raw_id)}">
77 <pre data-commit-id="${node.last_commit.raw_id}">r${node.last_commit.idx}:${node.last_commit.short_id}</pre>
78 </div>
79 % endif
80 </td>
81 <td class="td-user" data-attr-name="author">
82 % if c.full_load:
83 <span data-author="${node.last_commit.author}">${h.gravatar_with_user(request, node.last_commit.author, tooltip=True)|n}</span>
84 % endif
85 </td>
86 %else:
87 <td></td>
88 <td></td>
89 <td></td>
90 <td></td>
91 %endif
92 </tr>
93 % endfor
94 % endif
85 95
86 96 % if not has_files:
87 97 <tr>
88 98 <td colspan="5">
89 99 ##empty-dir mostly SVN
90 &nbsp;
100
101 ## submodule if we somehow endup
102 % if c.file.is_submodule():
103 <span class="submodule-dir">Submodule ${h.escape(c.file.name)}</span>
104 %endif
91 105 </td>
92 106 </tr>
93 107 % endif
@@ -15,17 +15,15 b''
15 15 <div class="summary-detail-header">
16 16
17 17 </div><!--end summary-detail-header-->
18
19 % if c.file.is_submodule():
20 <span class="submodule-dir">Submodule ${h.escape(c.file.name)}</span>
21 % elif c.file.is_dir():
18 % if c.file.is_dir() or c.file.is_submodule():
22 19 <%include file='files_tree_header.mako'/>
23 20 % else:
24 21 <%include file='files_source_header.mako'/>
25 22 % endif
26 23
27 24 </div> <!--end summary-detail-->
28 % if c.file.is_dir():
25
26 % if c.file.is_dir() or c.file.is_submodule():
29 27 <%include file='files_browser.mako'/>
30 28 % else:
31 29 <%include file='files_source.mako'/>
General Comments 0
You need to be logged in to leave comments. Login now