Fossil SCM
Add arrows to cue active sorting on /brlist web page
Commit
7aa10e3c72c738ee84c5b9418ba60a25d79a729e
Parent
54d53deb1650212…
1 file changed
+16
-6
+16
-6
| --- src/report.c | ||
| +++ src/report.c | ||
| @@ -957,16 +957,26 @@ | ||
| 957 | 957 | @ this.sortIndex = column; |
| 958 | 958 | @ var newRows = new Array(); |
| 959 | 959 | @ for (j = 0; j < this.tbody[0].rows.length; j++) { |
| 960 | 960 | @ newRows[j] = this.tbody[0].rows[j]; |
| 961 | 961 | @ } |
| 962 | + @ var arrow = "\u25B4"; | |
| 963 | + @ var arrowdiv = this.sortRow.getElementsByClassName("sortarrow"); | |
| 964 | + @ while(arrowdiv[0]) { | |
| 965 | + @ if( arrowdiv[0].innerHTML=="\u25B4" ){ | |
| 966 | + @ arrow = "\u25BE" | |
| 967 | + @ } | |
| 968 | + @ arrowdiv[0].parentNode.removeChild(arrowdiv[0]); | |
| 969 | + @ } | |
| 962 | 970 | @ if( this.sortIndex==this.prevColumn ){ |
| 963 | 971 | @ newRows.reverse(); |
| 964 | 972 | @ }else{ |
| 965 | 973 | @ newRows.sort(sortFn); |
| 966 | 974 | @ this.prevColumn = this.sortIndex; |
| 975 | + @ arrow = "\u25B4" | |
| 967 | 976 | @ } |
| 977 | + @ cell.innerHTML += "<div class='sortarrow' style='float:right'>" + arrow + "</div>"; | |
| 968 | 978 | @ for (i=0;i<newRows.length;i++) { |
| 969 | 979 | @ this.tbody[0].appendChild(newRows[i]); |
| 970 | 980 | @ } |
| 971 | 981 | @ } |
| 972 | 982 | @ this.sortText = function(a,b) { |
| @@ -998,20 +1008,20 @@ | ||
| 998 | 1008 | @ var x = tableEl.getElementsByTagName('thead'); |
| 999 | 1009 | @ if(!(this.tbody && this.tbody[0].rows && this.tbody[0].rows.length>0)){ |
| 1000 | 1010 | @ return; |
| 1001 | 1011 | @ } |
| 1002 | 1012 | @ if(x && x[0].rows && x[0].rows.length > 0) { |
| 1003 | - @ var sortRow = x[0].rows[0]; | |
| 1013 | + @ this.sortRow = x[0].rows[0]; | |
| 1004 | 1014 | @ } else { |
| 1005 | 1015 | @ return; |
| 1006 | 1016 | @ } |
| 1007 | - @ for (var i=0; i<sortRow.cells.length; i++) { | |
| 1017 | + @ for (var i=0; i<this.sortRow.cells.length; i++) { | |
| 1008 | 1018 | @ if( columnTypes[i]=='x' ) continue; |
| 1009 | - @ sortRow.cells[i].sTable = this; | |
| 1010 | - @ sortRow.cells[i].style.cursor = "pointer"; | |
| 1011 | - @ sortRow.cells[i].sortType = columnTypes[i] || 't'; | |
| 1012 | - @ sortRow.cells[i].onclick = function () { | |
| 1019 | + @ this.sortRow.cells[i].sTable = this; | |
| 1020 | + @ this.sortRow.cells[i].style.cursor = "pointer"; | |
| 1021 | + @ this.sortRow.cells[i].sortType = columnTypes[i] || 't'; | |
| 1022 | + @ this.sortRow.cells[i].onclick = function () { | |
| 1013 | 1023 | @ this.sTable.sort(this); |
| 1014 | 1024 | @ return false; |
| 1015 | 1025 | @ } |
| 1016 | 1026 | @ } |
| 1017 | 1027 | @ } |
| 1018 | 1028 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -957,16 +957,26 @@ | |
| 957 | @ this.sortIndex = column; |
| 958 | @ var newRows = new Array(); |
| 959 | @ for (j = 0; j < this.tbody[0].rows.length; j++) { |
| 960 | @ newRows[j] = this.tbody[0].rows[j]; |
| 961 | @ } |
| 962 | @ if( this.sortIndex==this.prevColumn ){ |
| 963 | @ newRows.reverse(); |
| 964 | @ }else{ |
| 965 | @ newRows.sort(sortFn); |
| 966 | @ this.prevColumn = this.sortIndex; |
| 967 | @ } |
| 968 | @ for (i=0;i<newRows.length;i++) { |
| 969 | @ this.tbody[0].appendChild(newRows[i]); |
| 970 | @ } |
| 971 | @ } |
| 972 | @ this.sortText = function(a,b) { |
| @@ -998,20 +1008,20 @@ | |
| 998 | @ var x = tableEl.getElementsByTagName('thead'); |
| 999 | @ if(!(this.tbody && this.tbody[0].rows && this.tbody[0].rows.length>0)){ |
| 1000 | @ return; |
| 1001 | @ } |
| 1002 | @ if(x && x[0].rows && x[0].rows.length > 0) { |
| 1003 | @ var sortRow = x[0].rows[0]; |
| 1004 | @ } else { |
| 1005 | @ return; |
| 1006 | @ } |
| 1007 | @ for (var i=0; i<sortRow.cells.length; i++) { |
| 1008 | @ if( columnTypes[i]=='x' ) continue; |
| 1009 | @ sortRow.cells[i].sTable = this; |
| 1010 | @ sortRow.cells[i].style.cursor = "pointer"; |
| 1011 | @ sortRow.cells[i].sortType = columnTypes[i] || 't'; |
| 1012 | @ sortRow.cells[i].onclick = function () { |
| 1013 | @ this.sTable.sort(this); |
| 1014 | @ return false; |
| 1015 | @ } |
| 1016 | @ } |
| 1017 | @ } |
| 1018 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -957,16 +957,26 @@ | |
| 957 | @ this.sortIndex = column; |
| 958 | @ var newRows = new Array(); |
| 959 | @ for (j = 0; j < this.tbody[0].rows.length; j++) { |
| 960 | @ newRows[j] = this.tbody[0].rows[j]; |
| 961 | @ } |
| 962 | @ var arrow = "\u25B4"; |
| 963 | @ var arrowdiv = this.sortRow.getElementsByClassName("sortarrow"); |
| 964 | @ while(arrowdiv[0]) { |
| 965 | @ if( arrowdiv[0].innerHTML=="\u25B4" ){ |
| 966 | @ arrow = "\u25BE" |
| 967 | @ } |
| 968 | @ arrowdiv[0].parentNode.removeChild(arrowdiv[0]); |
| 969 | @ } |
| 970 | @ if( this.sortIndex==this.prevColumn ){ |
| 971 | @ newRows.reverse(); |
| 972 | @ }else{ |
| 973 | @ newRows.sort(sortFn); |
| 974 | @ this.prevColumn = this.sortIndex; |
| 975 | @ arrow = "\u25B4" |
| 976 | @ } |
| 977 | @ cell.innerHTML += "<div class='sortarrow' style='float:right'>" + arrow + "</div>"; |
| 978 | @ for (i=0;i<newRows.length;i++) { |
| 979 | @ this.tbody[0].appendChild(newRows[i]); |
| 980 | @ } |
| 981 | @ } |
| 982 | @ this.sortText = function(a,b) { |
| @@ -998,20 +1008,20 @@ | |
| 1008 | @ var x = tableEl.getElementsByTagName('thead'); |
| 1009 | @ if(!(this.tbody && this.tbody[0].rows && this.tbody[0].rows.length>0)){ |
| 1010 | @ return; |
| 1011 | @ } |
| 1012 | @ if(x && x[0].rows && x[0].rows.length > 0) { |
| 1013 | @ this.sortRow = x[0].rows[0]; |
| 1014 | @ } else { |
| 1015 | @ return; |
| 1016 | @ } |
| 1017 | @ for (var i=0; i<this.sortRow.cells.length; i++) { |
| 1018 | @ if( columnTypes[i]=='x' ) continue; |
| 1019 | @ this.sortRow.cells[i].sTable = this; |
| 1020 | @ this.sortRow.cells[i].style.cursor = "pointer"; |
| 1021 | @ this.sortRow.cells[i].sortType = columnTypes[i] || 't'; |
| 1022 | @ this.sortRow.cells[i].onclick = function () { |
| 1023 | @ this.sTable.sort(this); |
| 1024 | @ return false; |
| 1025 | @ } |
| 1026 | @ } |
| 1027 | @ } |
| 1028 |