# HG changeset patch # User Marcin Kuzminski # Date 2012-10-17 19:13:04 # Node ID 4c7cc3a4c3306de1befe3cba22d02e55894cd3d6 # Parent a01c5994015c14bdfb0395aa6ca8682b36d96689 fixed issue with show at revision button. Some JS were not properly loaded due to ajaxified files view. Removed JS code and the logic for that is in python view now. Simpler and less ugly JS callbacks diff --git a/rhodecode/controllers/files.py b/rhodecode/controllers/files.py --- a/rhodecode/controllers/files.py +++ b/rhodecode/controllers/files.py @@ -37,7 +37,8 @@ from rhodecode.lib import diffs from rhodecode.lib import helpers as h from rhodecode.lib.compat import OrderedDict -from rhodecode.lib.utils2 import convert_line_endings, detect_mode, safe_str +from rhodecode.lib.utils2 import convert_line_endings, detect_mode, safe_str,\ + str2bool from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator from rhodecode.lib.base import BaseRepoController, render from rhodecode.lib.vcs.backends.base import EmptyChangeset @@ -430,6 +431,18 @@ class FilesController(BaseRepoController c.context_url = _context_url c.changes = OrderedDict() c.changes[diff2] = [] + + #special case if we want a show rev only, it's impl here + #to reduce JS and callbacks + if request.GET.get('show_rev'): + if str2bool(request.GET.get('annotate', 'False')): + _url = url('files_annotate_home', repo_name=c.repo_name, + revision=diff1, f_path=c.f_path) + else: + _url = url('files_home', repo_name=c.repo_name, + revision=diff1, f_path=c.f_path) + + return redirect(_url) try: if diff1 not in ['', None, 'None', '0' * 12, '0' * 40]: c.changeset_1 = c.rhodecode_repo.get_changeset(diff1) diff --git a/rhodecode/templates/files/files_source.html b/rhodecode/templates/files/files_source.html --- a/rhodecode/templates/files/files_source.html +++ b/rhodecode/templates/files/files_source.html @@ -8,6 +8,7 @@ ${h.select('diff1',c.file_changeset.raw_id,c.file_history)} ${h.submit('diff',_('diff to revision'),class_="ui-btn")} ${h.submit('show_rev',_('show at revision'),class_="ui-btn")} + ${h.hidden('annotate', c.annotate)} ${h.end_form()}
@@ -111,16 +112,7 @@ YUE.onDOMReady(function(){ window.location.hash = old_hash; } - YUE.on('show_rev','click',function(e){ - YUE.preventDefault(e); - var cs = YUD.get('diff1').value; - %if c.annotate: - var url = "${h.url('files_annotate_home',repo_name=c.repo_name,revision='__CS__',f_path=c.f_path)}".replace('__CS__',cs); - %else: - var url = "${h.url('files_home',repo_name=c.repo_name,revision='__CS__',f_path=c.f_path)}".replace('__CS__',cs); - %endif - window.location = url; - }); + YUE.on('hlcode','mouseup',getSelectionLink("${_('Selection link')}")) });