Changeset - 9812e617c564
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 13 years ago 2012-10-02 23:24:41
marcin@python-works.com
fix files quick filter links
2 files changed with 9 insertions and 12 deletions:
0 comments (0 inline, 0 general)
rhodecode/public/js/rhodecode.js
Show inline comments
 
@@ -670,16 +670,13 @@ var removeReviewer = function(reviewer_i
 
	if (el.parentNode !== undefined){
 
		el.parentNode.removeChild(el);
 
	}
 
}
 

	
 
var fileBrowserListeners = function(current_url, node_list_url, url_base){
 
	
 
	var current_url_branch = +"?branch=__BRANCH__";
 
	var url = url_base;
 
	var node_url = node_list_url;	
 

	
 
	YUE.on('stay_at_branch','click',function(e){
 
	    if(e.target.checked){
 
	        var uri = current_url_branch;
 
	        uri = uri.replace('__BRANCH__',e.target.value);
 
	        window.location = uri;
 
@@ -697,13 +694,13 @@ var fileBrowserListeners = function(curr
 

	
 
	F.initFilter = function(){
 
	  YUD.setStyle('node_filter_box_loading','display','');
 
	  YUD.setStyle('search_activate_id','display','none');
 
	  YUD.setStyle('add_node_id','display','none');
 
	  YUC.initHeader('X-PARTIAL-XHR',true);
 
	  YUC.asyncRequest('GET',url,{
 
	  YUC.asyncRequest('GET', node_list_url, {
 
	      success:function(o){
 
	        nodes = JSON.parse(o.responseText).nodes;
 
	        YUD.setStyle('node_filter_box_loading','display','none');
 
	        YUD.setStyle('node_filter_box','display','');
 
	        n_filter.focus();
 
			if(YUD.hasClass(n_filter,'init')){
 
@@ -740,14 +737,14 @@ var fileBrowserListeners = function(curr
 
	                    
 
	                    var n = nodes[i].name;
 
	                    var t = nodes[i].type;
 
	                    var n_hl = n.substring(0,pos)
 
	                      +"<b>{0}</b>".format(n.substring(pos,pos+query.length))
 
	                      +n.substring(pos+query.length)
 
	                    node_url = node_url.replace('__FPATH__',n);
 
	                    match.push('<tr><td><a class="browser-{0}" href="{1}">{2}</a></td><td colspan="5"></td></tr>'.format(t,node_url,n_hl));
 
	                    var new_url = url_base.replace('__FPATH__',n);
 
	                    match.push('<tr><td><a class="browser-{0}" href="{1}">{2}</a></td><td colspan="5"></td></tr>'.format(t,new_url,n_hl));
 
	                }
 
	                if(match.length >= matches_max){
 
	                    match.push('<tr><td>{0}</td><td colspan="5"></td></tr>'.format(_TM['search truncated']));
 
	                }
 
	            }                       
 
	        }
rhodecode/templates/files/files.html
Show inline comments
 
@@ -38,15 +38,15 @@
 
</div>
 

	
 
<script type="text/javascript">
 
var CACHE = {};
 
var CACHE_EXPIRE = 60*1000; //cache for 60s
 
//used to construct links from the search list
 
var node_list_url = '${h.url("files_home",repo_name=c.repo_name,revision='__REV__',f_path='__FPATH__')}';
 
var url_base = '${h.url("files_home",repo_name=c.repo_name,revision='__REV__',f_path='__FPATH__')}';
 
//send the nodelist request to this url
 
var url_base = '${h.url("files_nodelist_home",repo_name=c.repo_name,revision='__REV__',f_path='__FPATH__')}';
 
var node_list_url = '${h.url("files_nodelist_home",repo_name=c.repo_name,revision='__REV__',f_path='__FPATH__')}';
 

	
 
var ypjax_links = function(){
 
    YUE.on(YUQ('.ypjax-link'), 'click',function(e){
 

	
 
    	//don't do ypjax on middle click
 
    	if(e.which == 2 || !History.enabled){
 
@@ -68,14 +68,14 @@ var ypjax_links = function(){
 
        var parts2 = parts[1].split('/');
 
      	var rev = parts2.shift(); // pop the first element which is the revision
 
      	var f_path = parts2.join('/');
 

	
 
        var title = "${_('%s files') % c.repo_name}" + " - " + f_path;
 

	
 
        var _node_list_url = node_list_url.replace('__REV__',rev);
 
        var _url_base = url_base.replace('__REV__',rev).replace('__FPATH__', f_path);
 
        var _node_list_url = node_list_url.replace('__REV__',rev).replace('__FPATH__', f_path);
 
        var _url_base = url_base.replace('__REV__',rev);
 

	
 
        // Change our States and save some data for handling events
 
        var data = {url:url,title:title, url_base:_url_base,
 
                    node_list_url:_node_list_url};
 
        History.pushState(data, title, url);
 

	
 
@@ -129,14 +129,14 @@ YUE.onDOMReady(function(){
 
    });
 

	
 
    // init the search filter
 
    var _State = {
 
       url: "${h.url.current()}",
 
       data: {
 
         node_list_url: node_list_url.replace('__REV__',"${c.changeset.raw_id}"),
 
         url_base: url_base.replace('__REV__',"${c.changeset.raw_id}").replace('__FPATH__', "${h.safe_unicode(c.file.path)}")
 
         node_list_url: node_list_url.replace('__REV__',"${c.changeset.raw_id}").replace('__FPATH__', "${h.safe_unicode(c.file.path)}"),
 
         url_base: url_base.replace('__REV__',"${c.changeset.raw_id}")
 
       }
 
    }
 
    fileBrowserListeners(_State.url, _State.data.node_list_url, _State.data.url_base);
 
});
 

	
 
</script>
0 comments (0 inline, 0 general)