Show More
@@ -37,7 +37,8 b' from rhodecode.lib import diffs' | |||||
37 | from rhodecode.lib import helpers as h |
|
37 | from rhodecode.lib import helpers as h | |
38 |
|
38 | |||
39 | from rhodecode.lib.compat import OrderedDict |
|
39 | from rhodecode.lib.compat import OrderedDict | |
40 | from rhodecode.lib.utils2 import convert_line_endings, detect_mode, safe_str |
|
40 | from rhodecode.lib.utils2 import convert_line_endings, detect_mode, safe_str,\ | |
|
41 | str2bool | |||
41 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator |
|
42 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator | |
42 | from rhodecode.lib.base import BaseRepoController, render |
|
43 | from rhodecode.lib.base import BaseRepoController, render | |
43 | from rhodecode.lib.vcs.backends.base import EmptyChangeset |
|
44 | from rhodecode.lib.vcs.backends.base import EmptyChangeset | |
@@ -430,6 +431,18 b' class FilesController(BaseRepoController' | |||||
430 | c.context_url = _context_url |
|
431 | c.context_url = _context_url | |
431 | c.changes = OrderedDict() |
|
432 | c.changes = OrderedDict() | |
432 | c.changes[diff2] = [] |
|
433 | c.changes[diff2] = [] | |
|
434 | ||||
|
435 | #special case if we want a show rev only, it's impl here | |||
|
436 | #to reduce JS and callbacks | |||
|
437 | if request.GET.get('show_rev'): | |||
|
438 | if str2bool(request.GET.get('annotate', 'False')): | |||
|
439 | _url = url('files_annotate_home', repo_name=c.repo_name, | |||
|
440 | revision=diff1, f_path=c.f_path) | |||
|
441 | else: | |||
|
442 | _url = url('files_home', repo_name=c.repo_name, | |||
|
443 | revision=diff1, f_path=c.f_path) | |||
|
444 | ||||
|
445 | return redirect(_url) | |||
433 | try: |
|
446 | try: | |
434 | if diff1 not in ['', None, 'None', '0' * 12, '0' * 40]: |
|
447 | if diff1 not in ['', None, 'None', '0' * 12, '0' * 40]: | |
435 | c.changeset_1 = c.rhodecode_repo.get_changeset(diff1) |
|
448 | c.changeset_1 = c.rhodecode_repo.get_changeset(diff1) |
@@ -8,6 +8,7 b'' | |||||
8 | ${h.select('diff1',c.file_changeset.raw_id,c.file_history)} |
|
8 | ${h.select('diff1',c.file_changeset.raw_id,c.file_history)} | |
9 | ${h.submit('diff',_('diff to revision'),class_="ui-btn")} |
|
9 | ${h.submit('diff',_('diff to revision'),class_="ui-btn")} | |
10 | ${h.submit('show_rev',_('show at revision'),class_="ui-btn")} |
|
10 | ${h.submit('show_rev',_('show at revision'),class_="ui-btn")} | |
|
11 | ${h.hidden('annotate', c.annotate)} | |||
11 | ${h.end_form()} |
|
12 | ${h.end_form()} | |
12 | </div> |
|
13 | </div> | |
13 | <div class="file_author"> |
|
14 | <div class="file_author"> | |
@@ -111,16 +112,7 b' YUE.onDOMReady(function(){' | |||||
111 | window.location.hash = old_hash; |
|
112 | window.location.hash = old_hash; | |
112 |
|
113 | |||
113 | } |
|
114 | } | |
114 | YUE.on('show_rev','click',function(e){ |
|
115 | ||
115 | YUE.preventDefault(e); |
|
|||
116 | var cs = YUD.get('diff1').value; |
|
|||
117 | %if c.annotate: |
|
|||
118 | var url = "${h.url('files_annotate_home',repo_name=c.repo_name,revision='__CS__',f_path=c.f_path)}".replace('__CS__',cs); |
|
|||
119 | %else: |
|
|||
120 | var url = "${h.url('files_home',repo_name=c.repo_name,revision='__CS__',f_path=c.f_path)}".replace('__CS__',cs); |
|
|||
121 | %endif |
|
|||
122 | window.location = url; |
|
|||
123 | }); |
|
|||
124 | YUE.on('hlcode','mouseup',getSelectionLink("${_('Selection link')}")) |
|
116 | YUE.on('hlcode','mouseup',getSelectionLink("${_('Selection link')}")) | |
125 | }); |
|
117 | }); | |
126 | </script> |
|
118 | </script> |
General Comments 0
You need to be logged in to leave comments.
Login now