Show More
@@ -225,8 +225,7 b' class RepoFilesView(RepoAppView):' | |||||
225 |
|
225 | |||
226 | return branch_name, sha_commit_id, is_head |
|
226 | return branch_name, sha_commit_id, is_head | |
227 |
|
227 | |||
228 | def _get_tree_at_commit( |
|
228 | def _get_tree_at_commit(self, c, commit_id, f_path, full_load=False): | |
229 | self, c, commit_id, f_path, full_load=False): |
|
|||
230 |
|
229 | |||
231 | repo_id = self.db_repo.repo_id |
|
230 | repo_id = self.db_repo.repo_id | |
232 | force_recache = self.get_recache_flag() |
|
231 | force_recache = self.get_recache_flag() | |
@@ -632,8 +631,7 b' class RepoFilesView(RepoAppView):' | |||||
632 | c.authors = [] |
|
631 | c.authors = [] | |
633 | # this loads a simple tree without metadata to speed things up |
|
632 | # this loads a simple tree without metadata to speed things up | |
634 | # later via ajax we call repo_nodetree_full and fetch whole |
|
633 | # later via ajax we call repo_nodetree_full and fetch whole | |
635 | c.file_tree = self._get_tree_at_commit( |
|
634 | c.file_tree = self._get_tree_at_commit(c, c.commit.raw_id, f_path) | |
636 | c, c.commit.raw_id, f_path) |
|
|||
637 |
|
635 | |||
638 | except RepositoryError as e: |
|
636 | except RepositoryError as e: | |
639 | h.flash(safe_str(h.escape(e)), category='error') |
|
637 | h.flash(safe_str(h.escape(e)), category='error') |
@@ -367,8 +367,7 b' class RepoSummaryView(RepoAppView):' | |||||
367 | }) |
|
367 | }) | |
368 | return result |
|
368 | return result | |
369 |
|
369 | |||
370 | def _create_reference_items(self, repo, full_repo_name, refs, ref_type, |
|
370 | def _create_reference_items(self, repo, full_repo_name, refs, ref_type, format_ref_id): | |
371 | format_ref_id): |
|
|||
372 | result = [] |
|
371 | result = [] | |
373 | is_svn = h.is_svn(repo) |
|
372 | is_svn = h.is_svn(repo) | |
374 | for ref_name, raw_id in refs.iteritems(): |
|
373 | for ref_name, raw_id in refs.iteritems(): | |
@@ -380,6 +379,7 b' class RepoSummaryView(RepoAppView):' | |||||
380 | 'raw_id': raw_id, |
|
379 | 'raw_id': raw_id, | |
381 | 'type': ref_type, |
|
380 | 'type': ref_type, | |
382 | 'files_url': files_url, |
|
381 | 'files_url': files_url, | |
|
382 | 'idx': 0, | |||
383 | }) |
|
383 | }) | |
384 | return result |
|
384 | return result | |
385 |
|
385 |
@@ -217,9 +217,10 b' class _ToolTip(object):' | |||||
217 | tooltip = _ToolTip() |
|
217 | tooltip = _ToolTip() | |
218 |
|
218 | |||
219 |
|
219 | |||
220 | def files_breadcrumbs(repo_name, commit_id, file_path): |
|
220 | def files_breadcrumbs(repo_name, commit_id, file_path, at_ref=None): | |
221 | if isinstance(file_path, str): |
|
221 | if isinstance(file_path, str): | |
222 | file_path = safe_unicode(file_path) |
|
222 | file_path = safe_unicode(file_path) | |
|
223 | route_qry = {'at': at_ref} if at_ref else None | |||
223 |
|
224 | |||
224 | # TODO: johbo: Is this always a url like path, or is this operating |
|
225 | # TODO: johbo: Is this always a url like path, or is this operating | |
225 | # system dependent? |
|
226 | # system dependent? | |
@@ -236,8 +237,9 b' def files_breadcrumbs(repo_name, commit_' | |||||
236 | 'repo_files', |
|
237 | 'repo_files', | |
237 | repo_name=repo_name, |
|
238 | repo_name=repo_name, | |
238 | commit_id=commit_id, |
|
239 | commit_id=commit_id, | |
239 |
f_path='' |
|
240 | f_path='', | |
240 | class_='pjax-link')] |
|
241 | _query=route_qry), | |
|
242 | )] | |||
241 |
|
243 | |||
242 | last_cnt = len(path_segments) - 1 |
|
244 | last_cnt = len(path_segments) - 1 | |
243 | for cnt, segment in enumerate(path_segments): |
|
245 | for cnt, segment in enumerate(path_segments): | |
@@ -253,8 +255,9 b' def files_breadcrumbs(repo_name, commit_' | |||||
253 | 'repo_files', |
|
255 | 'repo_files', | |
254 | repo_name=repo_name, |
|
256 | repo_name=repo_name, | |
255 | commit_id=commit_id, |
|
257 | commit_id=commit_id, | |
256 |
f_path='/'.join(path_segments[:cnt + 1]) |
|
258 | f_path='/'.join(path_segments[:cnt + 1]), | |
257 | class_='pjax-link')) |
|
259 | _query=route_qry), | |
|
260 | )) | |||
258 | else: |
|
261 | else: | |
259 | url_segments.append(segment_html) |
|
262 | url_segments.append(segment_html) | |
260 |
|
263 |
@@ -142,7 +142,7 b' var fileBrowserListeners = function(node' | |||||
142 | }; |
|
142 | }; | |
143 |
|
143 | |||
144 | var typeIcon = '<i class="{0}"></i>'.format(typeObj[t]); |
|
144 | var typeIcon = '<i class="{0}"></i>'.format(typeObj[t]); | |
145 |
match.push('<tr class="browser-result"><td><a class=" |
|
145 | match.push('<tr class="browser-result"><td><a class="match-link" href="{0}">{1}{2}</a></td><td colspan="5"></td></tr>'.format(new_url,typeIcon, n_hl)); | |
146 | } |
|
146 | } | |
147 | } |
|
147 | } | |
148 | if(results.length > limit){ |
|
148 | if(results.length > limit){ | |
@@ -231,8 +231,8 b' var fileBrowserListeners = function(node' | |||||
231 | } |
|
231 | } | |
232 | if (e.keyCode === 13){ // Enter |
|
232 | if (e.keyCode === 13){ // Enter | |
233 | if ($('.browser-highlight').length !== 0){ |
|
233 | if ($('.browser-highlight').length !== 0){ | |
234 |
var url = $('.browser-highlight').find('. |
|
234 | var url = $('.browser-highlight').find('.match-link').attr('href'); | |
235 | $.pjax({url: url, container: '#pjax-container', timeout: pjaxTimeout}); |
|
235 | window.location = url; | |
236 | } |
|
236 | } | |
237 | } |
|
237 | } | |
238 | if (e.keyCode === 27){ // Esc |
|
238 | if (e.keyCode === 27){ // Esc |
@@ -18,7 +18,7 b'' | |||||
18 | <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=commit.raw_id,_query=dict(at=book))}"><i class="icon-bookmark"></i>${h.shorter(book)}</a> |
|
18 | <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=commit.raw_id,_query=dict(at=book))}"><i class="icon-bookmark"></i>${h.shorter(book)}</a> | |
19 | </span> |
|
19 | </span> | |
20 | <script> |
|
20 | <script> | |
21 | fileTreeRefs["${book}"] = {raw_id: "${commit.raw_id}", type:"book"}; |
|
21 | fileTreeRefs["${book}"] = {raw_id: "${commit.raw_id}", type:"book", text: "${book}"}; | |
22 | </script> |
|
22 | </script> | |
23 | %endfor |
|
23 | %endfor | |
24 | %endif |
|
24 | %endif | |
@@ -28,7 +28,7 b'' | |||||
28 | <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=commit.raw_id,_query=dict(at=tag))}"><i class="icon-tag"></i>${tag}</a> |
|
28 | <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=commit.raw_id,_query=dict(at=tag))}"><i class="icon-tag"></i>${tag}</a> | |
29 | </span> |
|
29 | </span> | |
30 | <script> |
|
30 | <script> | |
31 | fileTreeRefs["${tag}"] = {raw_id: "${commit.raw_id}", type:"tag"}; |
|
31 | fileTreeRefs["${tag}"] = {raw_id: "${commit.raw_id}", type:"tag", text: "${tag}"}; | |
32 | </script> |
|
32 | </script> | |
33 | %endfor |
|
33 | %endfor | |
34 |
|
34 | |||
@@ -37,7 +37,7 b'' | |||||
37 | <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=commit.raw_id,_query=dict(at=commit.branch))}"><i class="icon-code-fork"></i>${h.shorter(commit.branch)}</a> |
|
37 | <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=commit.raw_id,_query=dict(at=commit.branch))}"><i class="icon-code-fork"></i>${h.shorter(commit.branch)}</a> | |
38 | </span> |
|
38 | </span> | |
39 | <script> |
|
39 | <script> | |
40 | fileTreeRefs["${commit.branch}"] = {raw_id: "${commit.raw_id}", type:"branch"}; |
|
40 | fileTreeRefs["${commit.branch}"] = {raw_id: "${commit.raw_id}", type:"branch", text: "${commit.branch}"}; | |
41 | </script> |
|
41 | </script> | |
42 | %endif |
|
42 | %endif | |
43 |
|
43 |
@@ -1,9 +1,9 b'' | |||||
1 | <%inherit file="/base/base.mako"/> |
|
1 | <%inherit file="/base/base.mako"/> | |
2 |
|
2 | |||
3 | <%def name="title(*args)"> |
|
3 | <%def name="title(*args)"> | |
4 |
${_(' |
|
4 | ${_('{} Files').format(c.repo_name)} | |
5 | %if hasattr(c,'file'): |
|
5 | %if hasattr(c,'file'): | |
6 | · ${h.safe_unicode(c.file.path) or '\\'} |
|
6 | · ${(h.safe_unicode(c.file.path) or '\\')} | |
7 | %endif |
|
7 | %endif | |
8 |
|
8 | |||
9 | %if c.rhodecode_name: |
|
9 | %if c.rhodecode_name: | |
@@ -27,17 +27,16 b'' | |||||
27 | </%def> |
|
27 | </%def> | |
28 |
|
28 | |||
29 | <%def name="main()"> |
|
29 | <%def name="main()"> | |
30 | <div id="pjax-container"> |
|
30 | <div> | |
31 | <div id="files_data"> |
|
31 | <div id="files_data"> | |
32 | <%include file='files_pjax.mako'/> |
|
32 | <%include file='files_pjax.mako'/> | |
33 | </div> |
|
33 | </div> | |
34 | </div> |
|
34 | </div> | |
35 | <script> |
|
35 | <script> | |
36 | var pjaxTimeout = 5000; |
|
|||
37 |
|
36 | |||
38 |
var |
|
37 | var metadataRequest = null; | |
39 | commit_id: "${c.commit.raw_id}" |
|
38 | var fileSourcePage = ${c.file_source_page}; | |
40 | }; |
|
39 | var atRef = '${request.GET.get('at', '')}'; | |
41 |
|
40 | |||
42 | var getState = function(context) { |
|
41 | var getState = function(context) { | |
43 | var url = $(location).attr('href'); |
|
42 | var url = $(location).attr('href'); | |
@@ -65,23 +64,30 b'' | |||||
65 | var f_path = parts2.join('/'); |
|
64 | var f_path = parts2.join('/'); | |
66 | } |
|
65 | } | |
67 |
|
66 | |||
|
67 | var url_params = { | |||
|
68 | repo_name: templateContext.repo_name, | |||
|
69 | commit_id: rev, | |||
|
70 | f_path:'__FPATH__' | |||
|
71 | }; | |||
|
72 | if (atRef !== '') { | |||
|
73 | url_params['at'] = atRef | |||
|
74 | } | |||
|
75 | ||||
|
76 | var _url_base = pyroutes.url('repo_files', url_params); | |||
68 | var _node_list_url = pyroutes.url('repo_files_nodelist', |
|
77 | var _node_list_url = pyroutes.url('repo_files_nodelist', | |
69 | {repo_name: templateContext.repo_name, |
|
78 | {repo_name: templateContext.repo_name, | |
70 | commit_id: rev, f_path: f_path}); |
|
79 | commit_id: rev, f_path: f_path}); | |
71 | var _url_base = pyroutes.url('repo_files', |
|
80 | ||
72 | {repo_name: templateContext.repo_name, |
|
|||
73 | commit_id: rev, f_path:'__FPATH__'}); |
|
|||
74 | return { |
|
81 | return { | |
75 | url: url, |
|
82 | url: url, | |
76 | f_path: f_path, |
|
83 | f_path: f_path, | |
77 | rev: rev, |
|
84 | rev: rev, | |
78 |
commit_id: c |
|
85 | commit_id: "${c.commit.raw_id}", | |
79 | node_list_url: _node_list_url, |
|
86 | node_list_url: _node_list_url, | |
80 | url_base: _url_base |
|
87 | url_base: _url_base | |
81 | }; |
|
88 | }; | |
82 | }; |
|
89 | }; | |
83 |
|
90 | |||
84 | var metadataRequest = null; |
|
|||
85 | var getFilesMetadata = function() { |
|
91 | var getFilesMetadata = function() { | |
86 | if (metadataRequest && metadataRequest.readyState != 4) { |
|
92 | if (metadataRequest && metadataRequest.readyState != 4) { | |
87 | metadataRequest.abort(); |
|
93 | metadataRequest.abort(); | |
@@ -120,7 +126,6 b'' | |||||
120 | }; |
|
126 | }; | |
121 |
|
127 | |||
122 | var callbacks = function() { |
|
128 | var callbacks = function() { | |
123 | var state = getState('callbacks'); |
|
|||
124 | timeagoActivate(); |
|
129 | timeagoActivate(); | |
125 |
|
130 | |||
126 | if ($('#trimmed_message_box').height() < 50) { |
|
131 | if ($('#trimmed_message_box').height() < 50) { | |
@@ -132,6 +137,8 b'' | |||||
132 | $(this).hide(); |
|
137 | $(this).hide(); | |
133 | }); |
|
138 | }); | |
134 |
|
139 | |||
|
140 | var state = getState('callbacks'); | |||
|
141 | ||||
135 | // VIEW FOR FILE SOURCE |
|
142 | // VIEW FOR FILE SOURCE | |
136 | if (fileSourcePage) { |
|
143 | if (fileSourcePage) { | |
137 | // variants for with source code, not tree view |
|
144 | // variants for with source code, not tree view | |
@@ -147,6 +154,7 b'' | |||||
147 | raw_id: null, |
|
154 | raw_id: null, | |
148 | files_url: null |
|
155 | files_url: null | |
149 | }; |
|
156 | }; | |
|
157 | ||||
150 | select2FileHistorySwitcher('#diff1', initialCommitData, state); |
|
158 | select2FileHistorySwitcher('#diff1', initialCommitData, state); | |
151 |
|
159 | |||
152 | // show at, diff to actions handlers |
|
160 | // show at, diff to actions handlers | |
@@ -200,7 +208,7 b'' | |||||
200 |
|
208 | |||
201 | $.pjax({ |
|
209 | $.pjax({ | |
202 | url: url, |
|
210 | url: url, | |
203 | data: 'annotate=${"1" if c.annotate else "0"}', |
|
211 | data: 'annotate=${("1" if c.annotate else "0")}', | |
204 | container: '#file_authors', |
|
212 | container: '#file_authors', | |
205 | push: false, |
|
213 | push: false, | |
206 | timeout: pjaxTimeout |
|
214 | timeout: pjaxTimeout | |
@@ -240,9 +248,8 b'' | |||||
240 | fileBrowserListeners(state.node_list_url, state.url_base); |
|
248 | fileBrowserListeners(state.node_list_url, state.url_base); | |
241 |
|
249 | |||
242 | // switch to widget |
|
250 | // switch to widget | |
243 | console.log(state) |
|
|||
244 | var initialCommitData = { |
|
251 | var initialCommitData = { | |
245 |
at_ref: |
|
252 | at_ref: atRef, | |
246 | id: null, |
|
253 | id: null, | |
247 | text: '${c.commit.raw_id}', |
|
254 | text: '${c.commit.raw_id}', | |
248 | type: 'sha', |
|
255 | type: 'sha', | |
@@ -251,6 +258,12 b'' | |||||
251 | files_url: null, |
|
258 | files_url: null, | |
252 | }; |
|
259 | }; | |
253 |
|
260 | |||
|
261 | // check if we have ref info. | |||
|
262 | var selectedRef = fileTreeRefs[atRef]; | |||
|
263 | if (selectedRef !== undefined) { | |||
|
264 | $.extend(initialCommitData, selectedRef) | |||
|
265 | } | |||
|
266 | ||||
254 | var loadUrl = pyroutes.url('repo_refs_data', {'repo_name': templateContext.repo_name}); |
|
267 | var loadUrl = pyroutes.url('repo_refs_data', {'repo_name': templateContext.repo_name}); | |
255 |
|
268 | |||
256 | var select2RefFileSwitcher = function (targetElement, loadUrl, initialData) { |
|
269 | var select2RefFileSwitcher = function (targetElement, loadUrl, initialData) { | |
@@ -260,7 +273,6 b'' | |||||
260 |
|
273 | |||
261 | var formatSelection = function (data, container) { |
|
274 | var formatSelection = function (data, container) { | |
262 | var commit_ref = data; |
|
275 | var commit_ref = data; | |
263 | console.log(data) |
|
|||
264 |
|
276 | |||
265 | var tmpl = ''; |
|
277 | var tmpl = ''; | |
266 | if (commit_ref.type === 'sha') { |
|
278 | if (commit_ref.type === 'sha') { | |
@@ -319,60 +331,12 b'' | |||||
319 |
|
331 | |||
320 | $('#refs_filter').on('change', function(e) { |
|
332 | $('#refs_filter').on('change', function(e) { | |
321 | var data = $('#refs_filter').select2('data'); |
|
333 | var data = $('#refs_filter').select2('data'); | |
322 |
|
|
334 | window.location = data.files_url | |
323 | $.pjax({url: data.files_url, container: '#pjax-container', timeout: pjaxTimeout}); |
|
|||
324 | }); |
|
|||
325 |
|
||||
326 | $("#prev_commit_link").on('click', function(e) { |
|
|||
327 | var data = $(this).data(); |
|
|||
328 | curState.commit_id = data.commitId; |
|
|||
329 | }); |
|
|||
330 |
|
||||
331 | $("#next_commit_link").on('click', function(e) { |
|
|||
332 | var data = $(this).data(); |
|
|||
333 | curState.commit_id = data.commitId; |
|
|||
334 | }); |
|
335 | }); | |
335 |
|
336 | |||
336 | } |
|
337 | } | |
337 | }; |
|
338 | }; | |
338 |
|
339 | |||
339 | $(document).pjax(".pjax-link", "#pjax-container", { |
|
|||
340 | "fragment": "#pjax-content", |
|
|||
341 | "maxCacheLength": 1000, |
|
|||
342 | "timeout": pjaxTimeout |
|
|||
343 | }); |
|
|||
344 |
|
||||
345 | // define global back/forward states |
|
|||
346 | var isPjaxPopState = false; |
|
|||
347 | $(document).on('pjax:popstate', function() { |
|
|||
348 | isPjaxPopState = true; |
|
|||
349 | }); |
|
|||
350 |
|
||||
351 | $(document).on('pjax:end', function(xhr, options) { |
|
|||
352 | if (isPjaxPopState) { |
|
|||
353 | isPjaxPopState = false; |
|
|||
354 | callbacks(); |
|
|||
355 | _NODEFILTER.resetFilter(); |
|
|||
356 | } |
|
|||
357 |
|
||||
358 | // run callback for tracking if defined for google analytics etc. |
|
|||
359 | // this is used to trigger tracking on pjax |
|
|||
360 | if (typeof window.rhodecode_statechange_callback !== 'undefined') { |
|
|||
361 | var state = getState('statechange'); |
|
|||
362 | rhodecode_statechange_callback(state.url, null) |
|
|||
363 | } |
|
|||
364 | }); |
|
|||
365 |
|
||||
366 | $(document).on('pjax:success', function(event, xhr, options) { |
|
|||
367 | if (event.target.id == "file_history_container") { |
|
|||
368 | $('#file_history_overview').hide(); |
|
|||
369 | $('#file_history_overview_full').show(); |
|
|||
370 | timeagoActivate(); |
|
|||
371 | } else { |
|
|||
372 | callbacks(); |
|
|||
373 | } |
|
|||
374 | }); |
|
|||
375 |
|
||||
376 | $(document).ready(function() { |
|
340 | $(document).ready(function() { | |
377 | callbacks(); |
|
341 | callbacks(); | |
378 | var search_GET = "${request.GET.get('search','')}"; |
|
342 | var search_GET = "${request.GET.get('search','')}"; | |
@@ -383,4 +347,4 b'' | |||||
383 |
|
347 | |||
384 | </script> |
|
348 | </script> | |
385 |
|
349 | |||
386 |
</%def> |
|
350 | </%def> No newline at end of file |
@@ -33,7 +33,7 b'' | |||||
33 | </div> |
|
33 | </div> | |
34 | <div class="right-content"> |
|
34 | <div class="right-content"> | |
35 | <div id="specify-custom-path-container"> |
|
35 | <div id="specify-custom-path-container"> | |
36 | <span id="path-breadcrumbs">${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.f_path)}</span> |
|
36 | <span id="path-breadcrumbs">${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.f_path, request.GET.get('at'))}</span> | |
37 | <a class="custom-path-link" id="specify-custom-path" href="#">${_('Specify Custom Path')}</a> |
|
37 | <a class="custom-path-link" id="specify-custom-path" href="#">${_('Specify Custom Path')}</a> | |
38 | </div> |
|
38 | </div> | |
39 | <div id="remove-custom-path-container" style="display: none;"> |
|
39 | <div id="remove-custom-path-container" style="display: none;"> |
@@ -6,13 +6,13 b'' | |||||
6 | <div class="info_box"> |
|
6 | <div class="info_box"> | |
7 |
|
7 | |||
8 | <div class="info_box_elem previous"> |
|
8 | <div class="info_box_elem previous"> | |
9 |
<a id="prev_commit_link" data-commit-id="${c.prev_commit.raw_id}" class=" |
|
9 | <a id="prev_commit_link" data-commit-id="${c.prev_commit.raw_id}" class=" ${'disabled' if c.url_prev == '#' else ''}" href="${c.url_prev}" title="${_('Previous commit')}"><i class="icon-left"></i></a> | |
10 | </div> |
|
10 | </div> | |
11 |
|
11 | |||
12 | ${h.hidden('refs_filter')} |
|
12 | ${h.hidden('refs_filter')} | |
13 |
|
13 | |||
14 | <div class="info_box_elem next"> |
|
14 | <div class="info_box_elem next"> | |
15 |
<a id="next_commit_link" data-commit-id="${c.next_commit.raw_id}" class=" |
|
15 | <a id="next_commit_link" data-commit-id="${c.next_commit.raw_id}" class=" ${'disabled' if c.url_next == '#' else ''}" href="${c.url_next}" title="${_('Next commit')}"><i class="icon-right"></i></a> | |
16 | </div> |
|
16 | </div> | |
17 | </div> |
|
17 | </div> | |
18 |
|
18 |
@@ -1,4 +1,10 b'' | |||||
1 | <div id="file-tree-wrapper" class="browser-body ${'full-load' if c.full_load else ''}"> |
|
1 | <% | |
|
2 | if request.GET.get('at'): | |||
|
3 | query={'at': request.GET.get('at')} | |||
|
4 | else: | |||
|
5 | query=None | |||
|
6 | %> | |||
|
7 | <div id="file-tree-wrapper" class="browser-body ${('full-load' if c.full_load else '')}"> | |||
2 | <table class="code-browser rctable repo_summary"> |
|
8 | <table class="code-browser rctable repo_summary"> | |
3 | <thead> |
|
9 | <thead> | |
4 | <tr> |
|
10 | <tr> | |
@@ -14,7 +20,7 b'' | |||||
14 | %if c.file.parent: |
|
20 | %if c.file.parent: | |
15 | <tr class="parity0"> |
|
21 | <tr class="parity0"> | |
16 | <td class="td-componentname"> |
|
22 | <td class="td-componentname"> | |
17 |
<a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.file.parent.path)}" |
|
23 | <a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.file.parent.path, _query=query)}"> | |
18 | <i class="icon-directory"></i>.. |
|
24 | <i class="icon-directory"></i>.. | |
19 | </a> |
|
25 | </a> | |
20 | </td> |
|
26 | </td> | |
@@ -38,8 +44,9 b'' | |||||
38 | % endif |
|
44 | % endif | |
39 | </span> |
|
45 | </span> | |
40 | % else: |
|
46 | % else: | |
41 | <a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=h.safe_unicode(node.path))}" class="pjax-link"> |
|
47 | ||
42 | <i class="${'icon-file-text browser-file' if node.is_file() else 'icon-directory browser-dir'}"></i>${node.name} |
|
48 | <a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=h.safe_unicode(node.path), _query=query)}"> | |
|
49 | <i class="${('icon-file-text browser-file' if node.is_file() else 'icon-directory browser-dir')}"></i>${node.name} | |||
43 | </a> |
|
50 | </a> | |
44 | % endif |
|
51 | % endif | |
45 | </td> |
|
52 | </td> |
@@ -31,7 +31,7 b'' | |||||
31 | ${_('Path')}: |
|
31 | ${_('Path')}: | |
32 | </div> |
|
32 | </div> | |
33 | <div class="right-content"> |
|
33 | <div class="right-content"> | |
34 | <span id="path-breadcrumbs">${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.f_path)}</span> |
|
34 | <span id="path-breadcrumbs">${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.f_path, request.GET.get('at'))}</span> | |
35 | </div> |
|
35 | </div> | |
36 | </div> |
|
36 | </div> | |
37 | </div> |
|
37 | </div> |
@@ -32,7 +32,7 b'' | |||||
32 | </div> |
|
32 | </div> | |
33 | <div class="right-content"> |
|
33 | <div class="right-content"> | |
34 | <div id="specify-custom-path-container"> |
|
34 | <div id="specify-custom-path-container"> | |
35 | <span id="path-breadcrumbs">${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.f_path)}</span> |
|
35 | <span id="path-breadcrumbs">${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.f_path, request.GET.get('at'))}</span> | |
36 | </div> |
|
36 | </div> | |
37 | </div> |
|
37 | </div> | |
38 | </div> |
|
38 | </div> |
@@ -9,17 +9,13 b'' | |||||
9 | %endif |
|
9 | %endif | |
10 | </%def> |
|
10 | </%def> | |
11 |
|
11 | |||
12 | <div id="pjax-content" data-title="${self.title()}"> |
|
12 | <div> | |
13 | <script> |
|
|||
14 | // set the pageSource variable |
|
|||
15 | var fileSourcePage = ${c.file_source_page}; |
|
|||
16 | </script> |
|
|||
17 |
|
13 | |||
18 | <div class="summary-detail"> |
|
14 | <div class="summary-detail"> | |
19 | <div class="summary-detail-header"> |
|
15 | <div class="summary-detail-header"> | |
20 | <div class="breadcrumbs files_location"> |
|
16 | <div class="breadcrumbs files_location"> | |
21 | <h4> |
|
17 | <h4> | |
22 | ${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.file.path)} |
|
18 | ${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.file.path, request.GET.get('at'))} | |
23 | %if c.annotate: |
|
19 | %if c.annotate: | |
24 | - ${_('annotation')} |
|
20 | - ${_('annotation')} | |
25 | %endif |
|
21 | %endif |
@@ -41,19 +41,19 b' def test_urlify_text(url, expected_url):' | |||||
41 |
|
41 | |||
42 | @pytest.mark.parametrize('repo_name, commit_id, path, expected_result', [ |
|
42 | @pytest.mark.parametrize('repo_name, commit_id, path, expected_result', [ | |
43 | ('rX<X', 'cX<X', 'pX<X/aX<X/bX<X', |
|
43 | ('rX<X', 'cX<X', 'pX<X/aX<X/bX<X', | |
44 |
'<a |
|
44 | '<a href="/rX%3CX/files/cX%3CX/">rX<X</a>/' | |
45 |
'<a |
|
45 | '<a href="/rX%3CX/files/cX%3CX/pX%3CX">pX<X</a>/' | |
46 |
'<a |
|
46 | '<a href="/rX%3CX/files/cX%3CX/pX%3CX/aX%3CX">aX<X' | |
47 | '</a>/bX<X'), |
|
47 | '</a>/bX<X'), | |
48 | # Path with only one segment |
|
48 | # Path with only one segment | |
49 | ('rX<X', 'cX<X', 'pX<X', |
|
49 | ('rX<X', 'cX<X', 'pX<X', | |
50 |
'<a |
|
50 | '<a href="/rX%3CX/files/cX%3CX/">rX<X</a>/pX<X'), | |
51 | # Empty path |
|
51 | # Empty path | |
52 | ('rX<X', 'cX<X', '', 'rX<X'), |
|
52 | ('rX<X', 'cX<X', '', 'rX<X'), | |
53 | ('rX"X', 'cX"X', 'pX"X/aX"X/bX"X', |
|
53 | ('rX"X', 'cX"X', 'pX"X/aX"X/bX"X', | |
54 |
'<a |
|
54 | '<a href="/rX%22X/files/cX%22X/">rX"X</a>/' | |
55 |
'<a |
|
55 | '<a href="/rX%22X/files/cX%22X/pX%22X">pX"X</a>/' | |
56 |
'<a |
|
56 | '<a href="/rX%22X/files/cX%22X/pX%22X/aX%22X">aX"X' | |
57 | '</a>/bX"X'), |
|
57 | '</a>/bX"X'), | |
58 | ], ids=['simple', 'one_segment', 'empty_path', 'simple_quote']) |
|
58 | ], ids=['simple', 'one_segment', 'empty_path', 'simple_quote']) | |
59 | def test_files_breadcrumbs_xss( |
|
59 | def test_files_breadcrumbs_xss( |
General Comments 0
You need to be logged in to leave comments.
Login now