changeset 2548:0ff919f1c283 beta

Fixed sorting by data when using custom date format from settings
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 05 Jul 2012 16:48:56 +0200
parents 01273e4f8d63
children 411cd8fba253
files rhodecode/public/js/rhodecode.js rhodecode/templates/admin/repos/repos.html rhodecode/templates/index_base.html
diffstat 3 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/public/js/rhodecode.js	Thu Jul 05 13:39:02 2012 +0200
+++ b/rhodecode/public/js/rhodecode.js	Thu Jul 05 16:48:56 2012 +0200
@@ -1251,10 +1251,15 @@
 	return name
 }
 var get_date = function(node){
-	var date_ = node.firstElementChild.innerHTML;
+	var date_ = YUD.getAttribute(node.firstElementChild,'date');
 	return date_
 }
 
+var get_age = function(node){
+	console.log(node);
+	return node
+}
+
 var revisionSort = function(a, b, desc, field) {
 	  
 	  var a_ = fromHTML(a.getData(field));
@@ -1269,8 +1274,12 @@
 	  return compState;
 };
 var ageSort = function(a, b, desc, field) {
-    var a_ = a.getData(field);
-    var b_ = b.getData(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);
--- a/rhodecode/templates/admin/repos/repos.html	Thu Jul 05 13:39:02 2012 +0200
+++ b/rhodecode/templates/admin/repos/repos.html	Thu Jul 05 16:48:56 2012 +0200
@@ -56,7 +56,7 @@
               </td>
               ##LAST CHANGE
               <td>
-                <span class="tooltip" title="${h.tooltip(repo['last_change'])}">${h.age(repo['last_change'])}</span>
+                <span class="tooltip" date="${repo['last_change']}" title="${h.tooltip(repo['last_change'])}">${h.age(repo['last_change'])}</span>
               </td>
               ##LAST REVISION
               <td>
--- a/rhodecode/templates/index_base.html	Thu Jul 05 13:39:02 2012 +0200
+++ b/rhodecode/templates/index_base.html	Thu Jul 05 16:48:56 2012 +0200
@@ -89,7 +89,7 @@
                     </td>
                     ##LAST CHANGE DATE
                     <td>
-                      <span class="tooltip" title="${h.tooltip(h.fmt_date(repo['last_change']))}">${h.age(repo['last_change'])}</span>
+                      <span class="tooltip" date="${repo['last_change']}" title="${h.tooltip(h.fmt_date(repo['last_change']))}">${h.age(repo['last_change'])}</span>
                     </td>
                     ##LAST REVISION
                     <td>