changeset 2428:530bd12fc18a beta

removed JSON array envelope from filter files function - switched to translation map for labels in file filter
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 08 Jun 2012 22:26:39 +0200
parents f467c75544af
children d6efacde970f
files rhodecode/controllers/files.py rhodecode/public/js/rhodecode.js rhodecode/templates/base/root.html rhodecode/templates/files/files.html
diffstat 4 files changed, 10 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/files.py	Fri Jun 08 21:54:50 2012 +0200
+++ b/rhodecode/controllers/files.py	Fri Jun 08 22:26:39 2012 +0200
@@ -487,4 +487,4 @@
             cs = self.__get_cs_or_redirect(revision, repo_name)
             _d, _f = ScmModel().get_nodes(repo_name, cs.raw_id, f_path,
                                           flat=False)
-            return _d + _f
+            return {'nodes': _d + _f}
--- a/rhodecode/public/js/rhodecode.js	Fri Jun 08 21:54:50 2012 +0200
+++ b/rhodecode/public/js/rhodecode.js	Fri Jun 08 22:26:39 2012 +0200
@@ -611,8 +611,8 @@
 }
 
 
-var fileBrowserListeners = function(current_url, node_list_url, url_base,
-									truncated_lbl, nomatch_lbl){
+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;	
@@ -641,7 +641,7 @@
 	  YUC.initHeader('X-PARTIAL-XHR',true);
 	  YUC.asyncRequest('GET',url,{
 	      success:function(o){
-	        nodes = JSON.parse(o.responseText);
+	        nodes = JSON.parse(o.responseText).nodes;
 	        YUD.setStyle('node_filter_box_loading','display','none');
 	        YUD.setStyle('node_filter_box','display','');
 	        n_filter.focus();
@@ -685,9 +685,8 @@
 	                    match.push('<tr><td><a class="browser-{0}" href="{1}">{2}</a></td><td colspan="5"></td></tr>'.format(t,node_url.replace('__FPATH__',n),n_hl));
 	                }
 	                if(match.length >= matches_max){
-	                    match.push('<tr><td>{0}</td><td colspan="5"></td></tr>'.format(truncated_lbl));
+	                    match.push('<tr><td>{0}</td><td colspan="5"></td></tr>'.format(_TM['search truncated']));
 	                }
-	                
 	            }                       
 	        }
 	        if(query != ""){
@@ -695,7 +694,7 @@
 	            YUD.setStyle('tbody_filtered','display','');
 	            
 	            if (match.length==0){
-	              match.push('<tr><td>{0}</td><td colspan="5"></td></tr>'.format(nomatch_lbl));
+	              match.push('<tr><td>{0}</td><td colspan="5"></td></tr>'.format(_TM['no matching files']));
 	            }                           
 	            
 	            YUD.get('tbody_filtered').innerHTML = match.join("");   
--- a/rhodecode/templates/base/root.html	Fri Jun 08 21:54:50 2012 +0200
+++ b/rhodecode/templates/base/root.html	Fri Jun 08 22:26:39 2012 +0200
@@ -43,7 +43,9 @@
                 'Stop following this repository':"${_('Stop following this repository')}",
                 'Start following this repository':"${_('Start following this repository')}",
                 'Group':"${_('Group')}",
-                'members':"${_('members')}"
+                'members':"${_('members')}",
+                'search truncated': "${_('search truncated')}",
+                'no matching files': "${_('no matching files')}"                
 
             };
             var _TM = TRANSLATION_MAP;
--- a/rhodecode/templates/files/files.html	Fri Jun 08 21:54:50 2012 +0200
+++ b/rhodecode/templates/files/files.html	Fri Jun 08 22:26:39 2012 +0200
@@ -41,8 +41,6 @@
 var current_url = "${h.url.current()}";
 var node_list_url = '${h.url("files_home",repo_name=c.repo_name,revision=c.changeset.raw_id,f_path='__FPATH__')}';
 var url_base = '${h.url("files_nodelist_home",repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.file.path)}';
-var truncated_lbl = "${_('search truncated')}";
-var nomatch_lbl = "${_('no matching files')}";
-fileBrowserListeners(current_url, node_list_url, url_base, truncated_lbl, nomatch_lbl);
+fileBrowserListeners(current_url, node_list_url, url_base);
 </script>
 </%def>