##// 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 c.f_path = f_path
647 c.f_path = f_path
648 at_rev = self.request.GET.get('at')
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 # files or dirs
650 # files or dirs
677 try:
651 try:
678 c.file = c.commit.get_node(f_path, pre_load=['is_binary', 'size', 'data'])
652 c.file = c.commit.get_node(f_path, pre_load=['is_binary', 'size', 'data'])
@@ -680,8 +654,35 b' class RepoFilesView(RepoAppView):'
680 c.file_author = True
654 c.file_author = True
681 c.file_tree = ''
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 # load file content
683 # load file content
684 if c.file.is_file():
684 if c.file.is_file():
685
685 c.lf_node = {}
686 c.lf_node = {}
686
687
687 has_lf_enabled = self._is_lf_enabled(self.db_repo)
688 has_lf_enabled = self._is_lf_enabled(self.db_repo)
@@ -39,6 +39,7 b' from rhodecode.lib.utils2 import ('
39 safe_str, remove_prefix, obfuscate_url_pw,
39 safe_str, remove_prefix, obfuscate_url_pw,
40 get_current_rhodecode_user, safe_int, action_logger_generic)
40 get_current_rhodecode_user, safe_int, action_logger_generic)
41 from rhodecode.lib.vcs.backends import get_backend
41 from rhodecode.lib.vcs.backends import get_backend
42 from rhodecode.lib.vcs.nodes import NodeKind
42 from rhodecode.model import BaseModel
43 from rhodecode.model import BaseModel
43 from rhodecode.model.db import (
44 from rhodecode.model.db import (
44 _hash_key, func, case, joinedload, or_, in_filter_generator,
45 _hash_key, func, case, joinedload, or_, in_filter_generator,
@@ -1128,6 +1129,10 b' class ReadmeFinder:'
1128 """
1129 """
1129 Find a readme in the given `commit`.
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 nodes = commit.get_nodes(path)
1136 nodes = commit.get_nodes(path)
1132 matches = self._match_readmes(nodes)
1137 matches = self._match_readmes(nodes)
1133 matches = self._sort_according_to_priority(matches)
1138 matches = self._sort_according_to_priority(matches)
@@ -264,7 +264,10 b' They are permanent until deleted, or con'
264
264
265 </script>
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 ##// END OF EJS Templates
272 ##// END OF EJS Templates
270 </div>
273 </div>
@@ -1,5 +1,13 b''
1 <%namespace name="base" file="/base/base.mako"/>
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 at_ref = request.GET.get('at')
12 at_ref = request.GET.get('at')
5 if at_ref:
13 if at_ref:
@@ -29,65 +37,71 b''
29 </tr>
37 </tr>
30
38
31 <% has_files = False %>
39 <% has_files = False %>
32 % for cnt,node in enumerate(c.file):
40 % if not c.file.is_submodule():
33 <% has_files = True %>
41 % for cnt, node in enumerate(c.file):
34 <tr class="parity${(cnt % 2)}">
42 <% has_files = True %>
35 <td class="td-componentname">
43 <tr class="parity${(cnt % 2)}">
36 % if node.is_submodule():
44 <td class="td-componentname">
37 <span class="submodule-dir">
45 % if node.is_submodule():
38 % if node.url.startswith('http://') or node.url.startswith('https://'):
46 <span class="submodule-dir">
39 <a href="${node.url}">
47 % if node.url.startswith('http://') or node.url.startswith('https://'):
40 <i class="icon-directory browser-dir"></i>${node.name}
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 </a>
58 </a>
42 % else:
43 <i class="icon-directory browser-dir"></i>${node.name}
44 % endif
59 % endif
45 </span>
60 </td>
46 % else:
61 %if node.is_file():
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)}">
62 <td class="td-size" data-attr-name="size">
48 <i class="${('icon-file-text browser-file' if node.is_file() else 'icon-directory browser-dir')}"></i>${node.name}
63 % if c.full_load:
49 </a>
64 <span data-size="${node.size}">${h.format_byte_size_binary(node.size)}</span>
50 % endif
65 % else:
51 </td>
66 ${_('Loading ...')}
52 %if node.is_file():
67 % endif
53 <td class="td-size" data-attr-name="size">
68 </td>
54 % if c.full_load:
69 <td class="td-time" data-attr-name="modified_at">
55 <span data-size="${node.size}">${h.format_byte_size_binary(node.size)}</span>
70 % if c.full_load:
56 % else:
71 <span data-date="${node.last_commit.date}">${h.age_component(node.last_commit.date)}</span>
57 ${_('Loading ...')}
72 % endif
58 % endif
73 </td>
59 </td>
74 <td class="td-hash" data-attr-name="commit_id">
60 <td class="td-time" data-attr-name="modified_at">
75 % if c.full_load:
61 % 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)}">
62 <span data-date="${node.last_commit.date}">${h.age_component(node.last_commit.date)}</span>
77 <pre data-commit-id="${node.last_commit.raw_id}">r${node.last_commit.idx}:${node.last_commit.short_id}</pre>
63 % endif
78 </div>
64 </td>
79 % endif
65 <td class="td-hash" data-attr-name="commit_id">
80 </td>
66 % if c.full_load:
81 <td class="td-user" data-attr-name="author">
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)}">
82 % if c.full_load:
68 <pre data-commit-id="${node.last_commit.raw_id}">r${node.last_commit.idx}:${node.last_commit.short_id}</pre>
83 <span data-author="${node.last_commit.author}">${h.gravatar_with_user(request, node.last_commit.author, tooltip=True)|n}</span>
69 </div>
84 % endif
70 % endif
85 </td>
71 </td>
86 %else:
72 <td class="td-user" data-attr-name="author">
87 <td></td>
73 % if c.full_load:
88 <td></td>
74 <span data-author="${node.last_commit.author}">${h.gravatar_with_user(request, node.last_commit.author, tooltip=True)|n}</span>
89 <td></td>
75 % endif
90 <td></td>
76 </td>
91 %endif
77 %else:
92 </tr>
78 <td></td>
93 % endfor
79 <td></td>
94 % endif
80 <td></td>
81 <td></td>
82 %endif
83 </tr>
84 % endfor
85
95
86 % if not has_files:
96 % if not has_files:
87 <tr>
97 <tr>
88 <td colspan="5">
98 <td colspan="5">
89 ##empty-dir mostly SVN
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 </td>
105 </td>
92 </tr>
106 </tr>
93 % endif
107 % endif
@@ -15,17 +15,15 b''
15 <div class="summary-detail-header">
15 <div class="summary-detail-header">
16
16
17 </div><!--end summary-detail-header-->
17 </div><!--end summary-detail-header-->
18
18 % if c.file.is_dir() or c.file.is_submodule():
19 % if c.file.is_submodule():
20 <span class="submodule-dir">Submodule ${h.escape(c.file.name)}</span>
21 % elif c.file.is_dir():
22 <%include file='files_tree_header.mako'/>
19 <%include file='files_tree_header.mako'/>
23 % else:
20 % else:
24 <%include file='files_source_header.mako'/>
21 <%include file='files_source_header.mako'/>
25 % endif
22 % endif
26
23
27 </div> <!--end summary-detail-->
24 </div> <!--end summary-detail-->
28 % if c.file.is_dir():
25
26 % if c.file.is_dir() or c.file.is_submodule():
29 <%include file='files_browser.mako'/>
27 <%include file='files_browser.mako'/>
30 % else:
28 % else:
31 <%include file='files_source.mako'/>
29 <%include file='files_source.mako'/>
General Comments 0
You need to be logged in to leave comments. Login now