Commits

Marcin Kuzminski committed 4c7cc3a

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

Comments (0)

Files changed (2)

rhodecode/controllers/files.py

 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
         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)

rhodecode/templates/files/files_source.html

     		${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()}
     		</div>
             <div class="file_author">
     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')}"))
    });
 </script>