# HG changeset patch # User Marcin Kuzminski # Date 2012-07-05 14:48:56 # Node ID 0ff919f1c283006e00d338d97fcda17ce1b983de # Parent 01273e4f8d6382653f2d5f69508deccffc411b0c Fixed sorting by data when using custom date format from settings diff --git a/rhodecode/public/js/rhodecode.js b/rhodecode/public/js/rhodecode.js --- a/rhodecode/public/js/rhodecode.js +++ b/rhodecode/public/js/rhodecode.js @@ -1251,10 +1251,15 @@ var get_group_name = function(node){ 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 @@ var revisionSort = function(a, b, desc, 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); diff --git a/rhodecode/templates/admin/repos/repos.html b/rhodecode/templates/admin/repos/repos.html --- a/rhodecode/templates/admin/repos/repos.html +++ b/rhodecode/templates/admin/repos/repos.html @@ -56,7 +56,7 @@ ##LAST CHANGE - ${h.age(repo['last_change'])} + ${h.age(repo['last_change'])} ##LAST REVISION diff --git a/rhodecode/templates/index_base.html b/rhodecode/templates/index_base.html --- a/rhodecode/templates/index_base.html +++ b/rhodecode/templates/index_base.html @@ -89,7 +89,7 @@ ##LAST CHANGE DATE - ${h.age(repo['last_change'])} + ${h.age(repo['last_change'])} ##LAST REVISION