diff rhodecode/public/js/rhodecode.js @ 1782:eaf09acf6872 beta

added sorting to bookmarks tags and branches
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 17 Dec 2011 21:31:54 +0200
parents 9edd6ac132f0
children d4a7b6c82efe
line wrap: on
line diff
--- a/rhodecode/public/js/rhodecode.js	Sat Dec 17 16:35:11 2011 +0200
+++ b/rhodecode/public/js/rhodecode.js	Sat Dec 17 21:31:54 2011 +0200
@@ -646,6 +646,12 @@
 	var name = node.firstElementChild.children[1].innerHTML;
 	return name
 }
+var get_date = function(node){
+	console.log(node.firstElementChild)
+	var date_ = node.firstElementChild.innerHTML;
+	return date_
+}
+
 var revisionSort = function(a, b, desc, field) {
 	  
 	  var a_ = fromHTML(a.getData(field));
@@ -692,4 +698,16 @@
     var comp = YAHOO.util.Sort.compare;
     var compState = comp(a_, b_, desc);
     return compState;
+};
+var dateSort = function(a, b, desc, field) {
+    var a_ = fromHTML(a.getData(field));
+    var b_ = fromHTML(b.getData(field));
+    
+    // extract name from table
+    a_ = get_date(a_)
+    b_ = get_date(b_)          
+    
+    var comp = YAHOO.util.Sort.compare;
+    var compState = comp(a_, b_, desc);
+    return compState;
 };
\ No newline at end of file