##// END OF EJS Templates
added sorting to bookmarks tags and branches
marcink -
r1782:eaf09acf beta
parent child Browse files
Show More
@@ -646,6 +646,12 b' var get_group_name = function(node){'
646 var name = node.firstElementChild.children[1].innerHTML;
646 var name = node.firstElementChild.children[1].innerHTML;
647 return name
647 return name
648 }
648 }
649 var get_date = function(node){
650 console.log(node.firstElementChild)
651 var date_ = node.firstElementChild.innerHTML;
652 return date_
653 }
654
649 var revisionSort = function(a, b, desc, field) {
655 var revisionSort = function(a, b, desc, field) {
650
656
651 var a_ = fromHTML(a.getData(field));
657 var a_ = fromHTML(a.getData(field));
@@ -692,4 +698,16 b' var groupNameSort = function(a, b, desc,'
692 var comp = YAHOO.util.Sort.compare;
698 var comp = YAHOO.util.Sort.compare;
693 var compState = comp(a_, b_, desc);
699 var compState = comp(a_, b_, desc);
694 return compState;
700 return compState;
701 };
702 var dateSort = function(a, b, desc, field) {
703 var a_ = fromHTML(a.getData(field));
704 var b_ = fromHTML(b.getData(field));
705
706 // extract name from table
707 a_ = get_date(a_)
708 b_ = get_date(b_)
709
710 var comp = YAHOO.util.Sort.compare;
711 var compState = comp(a_, b_, desc);
712 return compState;
695 }; No newline at end of file
713 };
@@ -30,11 +30,49 b''
30 </div>
30 </div>
31 </div>
31 </div>
32 <script type="text/javascript">
32 <script type="text/javascript">
33 var nodes = YUQ('div.table tr td .logtags .tagtag a');
33
34 var target = 'q_filter_bookmarks';
34 // main table sorting
35 var func = function(node){
35 var myColumnDefs = [
36 return node.parentNode.parentNode.parentNode.parentNode;
36 {key:"name",label:"${_('Name')}",sortable:true},
37 }
37 {key:"date",label:"${_('Date')}",sortable:true,
38 q_filter(target,nodes,func);
38 sortOptions: { sortFunction: dateSort }},
39 {key:"author",label:"${_('Author')}",sortable:true},
40 {key:"revision",label:"${_('Revision')}",sortable:true,
41 sortOptions: { sortFunction: revisionSort }},
42 ];
43
44 var myDataSource = new YAHOO.util.DataSource(YUD.get("bookmarks_data"));
45
46 myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
47
48 myDataSource.responseSchema = {
49 fields: [
50 {key:"name"},
51 {key:"date"},
52 {key:"author"},
53 {key:"revision"},
54 ]
55 };
56
57 var myDataTable = new YAHOO.widget.DataTable("table_wrap", myColumnDefs, myDataSource,
58 {
59 sortedBy:{key:"name",dir:"asc"},
60 MSG_SORTASC:"${_('Click to sort ascending')}",
61 MSG_SORTDESC:"${_('Click to sort descending')}",
62 MSG_EMPTY:"${_('No records found.')}",
63 MSG_ERROR:"${_('Data error.')}",
64 MSG_LOADING:"${_('Loading...')}",
65 }
66 );
67 myDataTable.subscribe('postRenderEvent',function(oArgs) {
68 tooltip_activate();
69 var func = function(node){
70 return node.parentNode.parentNode.parentNode.parentNode.parentNode;
71 }
72 q_filter('q_filter_bookmarks',YUQ('div.table tr td .logbooks .bookbook a'),func);
73 });
74
39 </script>
75 </script>
76
77
40 </%def> No newline at end of file
78 </%def>
@@ -1,11 +1,14 b''
1 %if c.repo_bookmarks:
1 %if c.repo_bookmarks:
2 <table class="table_disp">
2 <div id="table_wrap" class="yui-skin-sam">
3 <table id="bookmarks_data">
4 <thead>
3 <tr>
5 <tr>
4 <th class="left">${_('name')}</th>
6 <th class="left">${_('Name')}</th>
5 <th class="left">${_('date')}</th>
7 <th class="left">${_('Date')}</th>
6 <th class="left">${_('author')}</th>
8 <th class="left">${_('Author')}</th>
7 <th class="left">${_('revision')}</th>
9 <th class="left">${_('Revision')}</th>
8 </tr>
10 </tr>
11 </thead>
9 %for cnt,book in enumerate(c.repo_bookmarks.items()):
12 %for cnt,book in enumerate(c.repo_bookmarks.items()):
10 <tr class="parity${cnt%2}">
13 <tr class="parity${cnt%2}">
11 <td>
14 <td>
@@ -24,6 +27,7 b''
24 </tr>
27 </tr>
25 %endfor
28 %endfor
26 </table>
29 </table>
30 </div>
27 %else:
31 %else:
28 ${_('There are no bookmarks yet')}
32 ${_('There are no bookmarks yet')}
29 %endif No newline at end of file
33 %endif
@@ -30,11 +30,48 b''
30 </div>
30 </div>
31 </div>
31 </div>
32 <script type="text/javascript">
32 <script type="text/javascript">
33 var nodes = YUQ('div.table tr td .logtags .branchtag a');
33
34 var target = 'q_filter_branches';
34 // main table sorting
35 var func = function(node){
35 var myColumnDefs = [
36 return node.parentNode.parentNode.parentNode.parentNode;
36 {key:"name",label:"${_('Name')}",sortable:true},
37 }
37 {key:"date",label:"${_('Date')}",sortable:true,
38 q_filter(target,nodes,func);
38 sortOptions: { sortFunction: dateSort }},
39 {key:"author",label:"${_('Author')}",sortable:true},
40 {key:"revision",label:"${_('Revision')}",sortable:true,
41 sortOptions: { sortFunction: revisionSort }},
42 ];
43
44 var myDataSource = new YAHOO.util.DataSource(YUD.get("branches_data"));
45
46 myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
47
48 myDataSource.responseSchema = {
49 fields: [
50 {key:"name"},
51 {key:"date"},
52 {key:"author"},
53 {key:"revision"},
54 ]
55 };
56
57 var myDataTable = new YAHOO.widget.DataTable("table_wrap", myColumnDefs, myDataSource,
58 {
59 sortedBy:{key:"name",dir:"asc"},
60 MSG_SORTASC:"${_('Click to sort ascending')}",
61 MSG_SORTDESC:"${_('Click to sort descending')}",
62 MSG_EMPTY:"${_('No records found.')}",
63 MSG_ERROR:"${_('Data error.')}",
64 MSG_LOADING:"${_('Loading...')}",
65 }
66 );
67 myDataTable.subscribe('postRenderEvent',function(oArgs) {
68 tooltip_activate();
69 var func = function(node){
70 return node.parentNode.parentNode.parentNode.parentNode.parentNode;
71 }
72 q_filter('q_filter_branches',YUQ('div.table tr td .logtags .branchtag a'),func);
73 });
74
39 </script>
75 </script>
76
40 </%def> No newline at end of file
77 </%def>
@@ -1,11 +1,14 b''
1 %if c.repo_branches:
1 %if c.repo_branches:
2 <table class="table_disp">
2 <div id="table_wrap" class="yui-skin-sam">
3 <table id="branches_data">
4 <thead>
3 <tr>
5 <tr>
4 <th class="left">${_('name')}</th>
6 <th class="left">${_('name')}</th>
5 <th class="left">${_('date')}</th>
7 <th class="left">${_('date')}</th>
6 <th class="left">${_('author')}</th>
8 <th class="left">${_('author')}</th>
7 <th class="left">${_('revision')}</th>
9 <th class="left">${_('revision')}</th>
8 </tr>
10 </tr>
11 </thead>
9 %for cnt,branch in enumerate(c.repo_branches.items()):
12 %for cnt,branch in enumerate(c.repo_branches.items()):
10 <tr class="parity${cnt%2}">
13 <tr class="parity${cnt%2}">
11 <td>
14 <td>
@@ -43,6 +46,7 b''
43 %endfor
46 %endfor
44 %endif
47 %endif
45 </table>
48 </table>
49 </div>
46 %else:
50 %else:
47 ${_('There are no branches yet')}
51 ${_('There are no branches yet')}
48 %endif No newline at end of file
52 %endif
@@ -30,11 +30,47 b''
30 </div>
30 </div>
31 </div>
31 </div>
32 <script type="text/javascript">
32 <script type="text/javascript">
33 var nodes = YUQ('div.table tr td .logtags .tagtag a');
33
34 var target = 'q_filter_tags';
34 // main table sorting
35 var func = function(node){
35 var myColumnDefs = [
36 return node.parentNode.parentNode.parentNode.parentNode;
36 {key:"name",label:"${_('Name')}",sortable:true},
37 }
37 {key:"date",label:"${_('Date')}",sortable:true,
38 q_filter(target,nodes,func);
38 sortOptions: { sortFunction: dateSort }},
39 {key:"author",label:"${_('Author')}",sortable:true},
40 {key:"revision",label:"${_('Revision')}",sortable:true,
41 sortOptions: { sortFunction: revisionSort }},
42 ];
43
44 var myDataSource = new YAHOO.util.DataSource(YUD.get("tags_data"));
45
46 myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
47
48 myDataSource.responseSchema = {
49 fields: [
50 {key:"name"},
51 {key:"date"},
52 {key:"author"},
53 {key:"revision"},
54 ]
55 };
56
57 var myDataTable = new YAHOO.widget.DataTable("table_wrap", myColumnDefs, myDataSource,
58 {
59 sortedBy:{key:"name",dir:"asc"},
60 MSG_SORTASC:"${_('Click to sort ascending')}",
61 MSG_SORTDESC:"${_('Click to sort descending')}",
62 MSG_EMPTY:"${_('No records found.')}",
63 MSG_ERROR:"${_('Data error.')}",
64 MSG_LOADING:"${_('Loading...')}",
65 }
66 );
67 myDataTable.subscribe('postRenderEvent',function(oArgs) {
68 tooltip_activate();
69 var func = function(node){
70 return node.parentNode.parentNode.parentNode.parentNode.parentNode;
71 }
72 q_filter('q_filter_tags',YUQ('div.table tr td .logtags .tagtag a'),func);
73 });
74
39 </script>
75 </script>
40 </%def> No newline at end of file
76 </%def>
@@ -1,11 +1,14 b''
1 %if c.repo_tags:
1 %if c.repo_tags:
2 <table class="table_disp">
2 <div id="table_wrap" class="yui-skin-sam">
3 <table id="tags_data">
4 <thead>
3 <tr>
5 <tr>
4 <th class="left">${_('name')}</th>
6 <th class="left">${_('Name')}</th>
5 <th class="left">${_('date')}</th>
7 <th class="left">${_('Date')}</th>
6 <th class="left">${_('author')}</th>
8 <th class="left">${_('Author')}</th>
7 <th class="left">${_('revision')}</th>
9 <th class="left">${_('Revision')}</th>
8 </tr>
10 </tr>
11 </thead>
9 %for cnt,tag in enumerate(c.repo_tags.items()):
12 %for cnt,tag in enumerate(c.repo_tags.items()):
10 <tr class="parity${cnt%2}">
13 <tr class="parity${cnt%2}">
11 <td>
14 <td>
@@ -22,9 +25,10 b''
22 <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>
25 <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>
23 </div>
26 </div>
24 </td>
27 </td>
25 </tr>
28 </tr>
26 %endfor
29 %endfor
27 </table>
30 </table>
31 </div>
28 %else:
32 %else:
29 ${_('There are no tags yet')}
33 ${_('There are no tags yet')}
30 %endif No newline at end of file
34 %endif
General Comments 0
You need to be logged in to leave comments. Login now