Changeset - 0ff919f1c283
[Not reviewed]
beta
0 3 0
Marcin Kuzminski - 13 years ago 2012-07-05 16:48:56
marcin@python-works.com
Fixed sorting by data when using custom date format from settings
3 files changed with 14 insertions and 5 deletions:
0 comments (0 inline, 0 general)
rhodecode/public/js/rhodecode.js
Show inline comments
 
@@ -1242,44 +1242,53 @@ var get_rev = function(node){
 
    }
 
}
 

	
 
var get_name = function(node){
 
	 var name = node.firstElementChild.children[2].innerHTML; 
 
	 return name
 
}
 
var get_group_name = function(node){
 
	var name = node.firstElementChild.children[1].innerHTML;
 
	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));
 
	  var b_ = fromHTML(b.getData(field));
 
	  
 
	  // extract revisions from string nodes 
 
	  a_ = get_rev(a_)
 
	  b_ = get_rev(b_)
 
	      	  
 
	  var comp = YAHOO.util.Sort.compare;
 
	  var compState = comp(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);
 
    return compState;
 
};
 

	
 
var nameSort = function(a, b, desc, field) {
 
    var a_ = fromHTML(a.getData(field));
 
    var b_ = fromHTML(b.getData(field));
 
    
 
    // extract name from table
 
    a_ = get_name(a_)
rhodecode/templates/admin/repos/repos.html
Show inline comments
 
@@ -47,25 +47,25 @@
 
              <td class="quick_repo_menu">
 
                ${dt.quick_menu(repo['name'])}
 
              </td>
 
              <td class="reponame">
 
                ${dt.repo_name(repo['name'],repo['dbrepo']['repo_type'],repo['dbrepo']['private'],repo['dbrepo_fork'].get('repo_name'), admin=True)}
 
              </td>
 
              ##DESCRIPTION
 
              <td><span class="tooltip" title="${h.tooltip(repo['description'])}">
 
                 ${h.truncate(repo['description'],60)}</span>
 
              </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>
 
                  ${dt.revision(repo['name'],repo['rev'],repo['tip'],repo['author'],repo['last_msg'])}
 
              </td>
 
            <td title="${repo['contact']}">${h.person(repo['contact'])}</td>
 
              <td>
 
                ${h.form(url('repo', repo_name=repo['name']),method='delete')}
 
                  ${h.submit('remove_%s' % repo['name'],_('delete'),class_="delete_icon action_button",onclick="return confirm('"+_('Confirm to delete this repository: %s') % repo['name']+"');")}
 
                ${h.end_form()}
 
              </td>
 
          </tr>
rhodecode/templates/index_base.html
Show inline comments
 
@@ -80,25 +80,25 @@
 
                      ${dt.quick_menu(repo['name'])}
 
                    </td>
 
                    ##REPO NAME AND ICONS
 
                    <td class="reponame">
 
                      ${dt.repo_name(repo['name'],repo['dbrepo']['repo_type'],repo['dbrepo']['private'],repo['dbrepo_fork'].get('repo_name'),pageargs.get('short_repo_names'))}
 
                    </td>
 
                    ##DESCRIPTION
 
                    <td><span class="tooltip" title="${h.tooltip(repo['description'])}">
 
                       ${h.truncate(repo['description'],60)}</span>
 
                    </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>
 
                        ${dt.revision(repo['name'],repo['rev'],repo['tip'],repo['author'],repo['last_msg'])}
 
                    </td>
 
                    ##
 
                    <td title="${repo['contact']}">${h.person(repo['contact'])}</td>
 
                    <td>
 
                      %if c.rhodecode_user.username != 'default':
 
                        <a title="${_('Subscribe to %s rss feed')%repo['name']}" class="rss_icon"  href="${h.url('rss_feed_home',repo_name=repo['name'],api_key=c.rhodecode_user.api_key)}"></a>
 
                      %else:
 
                        <a title="${_('Subscribe to %s rss feed')%repo['name']}" class="rss_icon"  href="${h.url('rss_feed_home',repo_name=repo['name'])}"></a>
0 comments (0 inline, 0 general)