Fossil SCM

Add arrows to cue active sorting on /brlist web page

baruch 2015-01-05 15:25 trunk
Commit 7aa10e3c72c738ee84c5b9418ba60a25d79a729e
1 file changed +16 -6
+16 -6
--- src/report.c
+++ src/report.c
@@ -957,16 +957,26 @@
957957
@ this.sortIndex = column;
958958
@ var newRows = new Array();
959959
@ for (j = 0; j < this.tbody[0].rows.length; j++) {
960960
@ newRows[j] = this.tbody[0].rows[j];
961961
@ }
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
+ @ }
962970
@ if( this.sortIndex==this.prevColumn ){
963971
@ newRows.reverse();
964972
@ }else{
965973
@ newRows.sort(sortFn);
966974
@ this.prevColumn = this.sortIndex;
975
+ @ arrow = "\u25B4"
967976
@ }
977
+ @ cell.innerHTML += "<div class='sortarrow' style='float:right'>" + arrow + "</div>";
968978
@ for (i=0;i<newRows.length;i++) {
969979
@ this.tbody[0].appendChild(newRows[i]);
970980
@ }
971981
@ }
972982
@ this.sortText = function(a,b) {
@@ -998,20 +1008,20 @@
9981008
@ var x = tableEl.getElementsByTagName('thead');
9991009
@ if(!(this.tbody && this.tbody[0].rows && this.tbody[0].rows.length>0)){
10001010
@ return;
10011011
@ }
10021012
@ if(x && x[0].rows && x[0].rows.length > 0) {
1003
- @ var sortRow = x[0].rows[0];
1013
+ @ this.sortRow = x[0].rows[0];
10041014
@ } else {
10051015
@ return;
10061016
@ }
1007
- @ for (var i=0; i<sortRow.cells.length; i++) {
1017
+ @ for (var i=0; i<this.sortRow.cells.length; i++) {
10081018
@ 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 () {
10131023
@ this.sTable.sort(this);
10141024
@ return false;
10151025
@ }
10161026
@ }
10171027
@ }
10181028
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button