Changeset - eaf09acf6872
[Not reviewed]
beta
0 7 0
Marcin Kuzminski - 14 years ago 2011-12-17 20:31:54
marcin@python-works.com
added sorting to bookmarks tags and branches
7 files changed with 173 insertions and 32 deletions:
0 comments (0 inline, 0 general)
rhodecode/public/js/rhodecode.js
Show inline comments
 
@@ -646,6 +646,12 @@ var get_group_name = function(node){
 
	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 groupNameSort = function(a, b, desc,
 
    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
rhodecode/templates/bookmarks/bookmarks.html
Show inline comments
 
@@ -30,11 +30,49 @@
 
    </div>
 
</div>
 
<script type="text/javascript">
 
var nodes = YUQ('div.table tr td .logtags .tagtag a');
 
var target = 'q_filter_bookmarks';
 
var func = function(node){
 
    return node.parentNode.parentNode.parentNode.parentNode;
 
}
 
q_filter(target,nodes,func);
 

	
 
// main table sorting
 
var myColumnDefs = [
 
    {key:"name",label:"${_('Name')}",sortable:true},
 
    {key:"date",label:"${_('Date')}",sortable:true,
 
        sortOptions: { sortFunction: dateSort }},
 
    {key:"author",label:"${_('Author')}",sortable:true},
 
    {key:"revision",label:"${_('Revision')}",sortable:true,
 
        sortOptions: { sortFunction: revisionSort }},
 
];
 

	
 
var myDataSource = new YAHOO.util.DataSource(YUD.get("bookmarks_data"));
 

	
 
myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
 

	
 
myDataSource.responseSchema = {
 
    fields: [
 
        {key:"name"},
 
        {key:"date"},
 
        {key:"author"},
 
        {key:"revision"},
 
    ]
 
};
 

	
 
var myDataTable = new YAHOO.widget.DataTable("table_wrap", myColumnDefs, myDataSource,
 
        {
 
         sortedBy:{key:"name",dir:"asc"},
 
         MSG_SORTASC:"${_('Click to sort ascending')}",
 
         MSG_SORTDESC:"${_('Click to sort descending')}",
 
         MSG_EMPTY:"${_('No records found.')}",
 
         MSG_ERROR:"${_('Data error.')}",
 
         MSG_LOADING:"${_('Loading...')}",                
 
        }
 
);
 
myDataTable.subscribe('postRenderEvent',function(oArgs) {
 
    tooltip_activate();
 
    var func = function(node){
 
        return node.parentNode.parentNode.parentNode.parentNode.parentNode;
 
    }
 
    q_filter('q_filter_bookmarks',YUQ('div.table tr td .logbooks .bookbook a'),func);    
 
});         
 

	
 
</script>
 

	
 

	
 
</%def> 
 
\ No newline at end of file
rhodecode/templates/bookmarks/bookmarks_data.html
Show inline comments
 
%if c.repo_bookmarks:    
 
    <table class="table_disp">
 
%if c.repo_bookmarks:
 
   <div id="table_wrap" class="yui-skin-sam">    
 
    <table id="bookmarks_data">
 
      <thead>
 
    	<tr>
 
            <th class="left">${_('name')}</th>
 
            <th class="left">${_('date')}</th>
 
            <th class="left">${_('author')}</th>
 
            <th class="left">${_('revision')}</th>
 
            <th class="left">${_('Name')}</th>
 
            <th class="left">${_('Date')}</th>
 
            <th class="left">${_('Author')}</th>
 
            <th class="left">${_('Revision')}</th>
 
    	</tr>
 
      </thead>
 
		%for cnt,book in enumerate(c.repo_bookmarks.items()):
 
		<tr class="parity${cnt%2}">		
 
            <td>
 
@@ -24,6 +27,7 @@
 
		</tr>
 
		%endfor
 
    </table>
 
    </div>
 
%else:
 
	${_('There are no bookmarks yet')}
 
%endif    
 
\ No newline at end of file
rhodecode/templates/branches/branches.html
Show inline comments
 
@@ -30,11 +30,48 @@
 
    </div>
 
</div>
 
<script type="text/javascript">
 
var nodes = YUQ('div.table tr td .logtags .branchtag a');
 
var target = 'q_filter_branches';
 
var func = function(node){
 
    return node.parentNode.parentNode.parentNode.parentNode;
 
}
 
q_filter(target,nodes,func);
 

	
 
// main table sorting
 
var myColumnDefs = [
 
    {key:"name",label:"${_('Name')}",sortable:true},
 
    {key:"date",label:"${_('Date')}",sortable:true,
 
        sortOptions: { sortFunction: dateSort }},
 
    {key:"author",label:"${_('Author')}",sortable:true},
 
    {key:"revision",label:"${_('Revision')}",sortable:true,
 
        sortOptions: { sortFunction: revisionSort }},
 
];
 

	
 
var myDataSource = new YAHOO.util.DataSource(YUD.get("branches_data"));
 

	
 
myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
 

	
 
myDataSource.responseSchema = {
 
    fields: [
 
        {key:"name"},
 
        {key:"date"},
 
        {key:"author"},
 
        {key:"revision"},
 
    ]
 
};
 

	
 
var myDataTable = new YAHOO.widget.DataTable("table_wrap", myColumnDefs, myDataSource,
 
        {
 
         sortedBy:{key:"name",dir:"asc"},
 
         MSG_SORTASC:"${_('Click to sort ascending')}",
 
         MSG_SORTDESC:"${_('Click to sort descending')}",
 
         MSG_EMPTY:"${_('No records found.')}",
 
         MSG_ERROR:"${_('Data error.')}",
 
         MSG_LOADING:"${_('Loading...')}",                
 
        }
 
);
 
myDataTable.subscribe('postRenderEvent',function(oArgs) {
 
    tooltip_activate();
 
    var func = function(node){
 
        return node.parentNode.parentNode.parentNode.parentNode.parentNode;
 
    }
 
    q_filter('q_filter_branches',YUQ('div.table tr td .logtags .branchtag a'),func);    
 
});         
 

	
 
</script>
 

	
 
</%def>     
 
\ No newline at end of file
rhodecode/templates/branches/branches_data.html
Show inline comments
 
%if c.repo_branches:
 
    <table class="table_disp">
 
   <div id="table_wrap" class="yui-skin-sam">    
 
    <table id="branches_data">
 
      <thead>
 
        <tr>
 
            <th class="left">${_('name')}</th>
 
            <th class="left">${_('date')}</th>
 
            <th class="left">${_('author')}</th>
 
            <th class="left">${_('revision')}</th>
 
        </tr>
 
      </thead>
 
		%for cnt,branch in enumerate(c.repo_branches.items()):
 
		<tr class="parity${cnt%2}">
 
            <td>
 
@@ -43,6 +46,7 @@
 
          %endfor
 
        %endif
 
    </table>
 
    </div>
 
%else:
 
    ${_('There are no branches yet')}
 
%endif
 
\ No newline at end of file
rhodecode/templates/tags/tags.html
Show inline comments
 
@@ -30,11 +30,47 @@
 
    </div>
 
</div>
 
<script type="text/javascript">
 
var nodes = YUQ('div.table tr td .logtags .tagtag a');
 
var target = 'q_filter_tags';
 
var func = function(node){
 
    return node.parentNode.parentNode.parentNode.parentNode;
 
}
 
q_filter(target,nodes,func);
 

	
 
// main table sorting
 
var myColumnDefs = [
 
    {key:"name",label:"${_('Name')}",sortable:true},
 
    {key:"date",label:"${_('Date')}",sortable:true,
 
        sortOptions: { sortFunction: dateSort }},
 
    {key:"author",label:"${_('Author')}",sortable:true},
 
    {key:"revision",label:"${_('Revision')}",sortable:true,
 
        sortOptions: { sortFunction: revisionSort }},
 
];
 

	
 
var myDataSource = new YAHOO.util.DataSource(YUD.get("tags_data"));
 

	
 
myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
 

	
 
myDataSource.responseSchema = {
 
    fields: [
 
        {key:"name"},
 
        {key:"date"},
 
        {key:"author"},
 
        {key:"revision"},
 
    ]
 
};
 

	
 
var myDataTable = new YAHOO.widget.DataTable("table_wrap", myColumnDefs, myDataSource,
 
        {
 
         sortedBy:{key:"name",dir:"asc"},
 
         MSG_SORTASC:"${_('Click to sort ascending')}",
 
         MSG_SORTDESC:"${_('Click to sort descending')}",
 
         MSG_EMPTY:"${_('No records found.')}",
 
         MSG_ERROR:"${_('Data error.')}",
 
         MSG_LOADING:"${_('Loading...')}",                
 
        }
 
);
 
myDataTable.subscribe('postRenderEvent',function(oArgs) {
 
    tooltip_activate();
 
    var func = function(node){
 
        return node.parentNode.parentNode.parentNode.parentNode.parentNode;
 
    }
 
    q_filter('q_filter_tags',YUQ('div.table tr td .logtags .tagtag a'),func);    
 
});         
 

	
 
</script>
 
</%def> 
 
\ No newline at end of file
rhodecode/templates/tags/tags_data.html
Show inline comments
 
%if c.repo_tags:    
 
    <table class="table_disp">
 
%if c.repo_tags:
 
   <div id="table_wrap" class="yui-skin-sam">    
 
    <table id="tags_data">
 
      <thead>
 
    	<tr>
 
            <th class="left">${_('name')}</th>
 
            <th class="left">${_('date')}</th>
 
            <th class="left">${_('author')}</th>
 
            <th class="left">${_('revision')}</th>
 
            <th class="left">${_('Name')}</th>
 
            <th class="left">${_('Date')}</th>
 
            <th class="left">${_('Author')}</th>
 
            <th class="left">${_('Revision')}</th>
 
    	</tr>
 
      </thead>
 
		%for cnt,tag in enumerate(c.repo_tags.items()):
 
		<tr class="parity${cnt%2}">		
 
            <td>
 
@@ -22,9 +25,10 @@
 
                    <pre><a href="${h.url('files_home',repo_name=c.repo_name,revision=tag[1].raw_id)}">r${tag[1].revision}:${h.short_id(tag[1].raw_id)}</a></pre>
 
                </div>
 
            </td>
 
		</tr>	
 
		</tr>
 
		%endfor
 
    </table>
 
   </div>
 
%else:
 
	${_('There are no tags yet')}
 
%endif    
 
\ No newline at end of file
0 comments (0 inline, 0 general)