From 8326a5a85e4aaa03f64d8e04c90895bee3d17975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20A=2E=20S=C3=A1nchez=20L=C3=B3pez?= Date: Fri, 4 Jul 2014 09:48:20 +0000 Subject: [PATCH] Sort liaison statement list using js in the web client. See #1434 - Legacy-Id: 8050 --- ietf/templates/liaisons/overview.html | 13 +++++++++++++ static/css/liaisons.css | 18 +++++++++++------- static/images/sort-header-up-filled.png | Bin 0 -> 341 bytes static/js/jquery.tablesorter.min.js | 4 ++++ 4 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 static/images/sort-header-up-filled.png create mode 100644 static/js/jquery.tablesorter.min.js diff --git a/ietf/templates/liaisons/overview.html b/ietf/templates/liaisons/overview.html index 786930788..7953e1888 100644 --- a/ietf/templates/liaisons/overview.html +++ b/ietf/templates/liaisons/overview.html @@ -32,3 +32,16 @@ {% include "liaisons/liaison_table.html" %} {% endblock %} + +{% block js %} + + +{% endblock %} diff --git a/static/css/liaisons.css b/static/css/liaisons.css index 7fc9f1837..fab247b4e 100644 --- a/static/css/liaisons.css +++ b/static/css/liaisons.css @@ -89,15 +89,19 @@ span.fieldRequired { background-color: #ffcc66; } -th.sort a { - text-decoration: none; - color: white; - padding-right: 20px; - background: url(/images/sort-header-clear.png) no-repeat right center; +th.sort { + background-image: url(/images/sort-header-clear.png); + background-repeat: no-repeat; + background-position: right center; + cursor: pointer; } -th.sorted a { - background: url(/images/sort-header-filled.png) no-repeat right center; +th.headerSortUp { + background-image: url(/images/sort-header-up-filled.png); +} + +th.headerSortDown { + background-image: url(/images/sort-header-filled.png); } .noActionTaken, .actionTaken { padding: 2px 5px; } diff --git a/static/images/sort-header-up-filled.png b/static/images/sort-header-up-filled.png new file mode 100644 index 0000000000000000000000000000000000000000..2555053461f5f2e3b4846372ab0b2b60a292fb9c GIT binary patch literal 341 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^xl_H+M9WCijWi-X*q z7}lMWc?skwBzpw;GB8xBF)%c=FfjZA3N^f7U???UV0e|lz+g3lfkC`r&aOZkpafHr zx4R1i!>V3oBOs5nz$3Dlfq`2Xgc%uT&5-~K`gyuIhG?AMJJFDfL4k)^`2YU^_44IA zIJPa-vbdpnxUgl)p`ToK%uP`mu9XZ7JB)p{Wv53>>|7{y=~?QBrxLt{0j>`=Ie!yK zwT_uy!^n1ag4p2=b7le^!=PH?8c~vxSdwa$T$Bo=7>o=IO>_;+bPX&+3=OPIjjarf ov<-}`3=Cr0o=r#5kei>9nO2EggYNA(ZJ-7QPgg&ebxsLQ0JPp;oB#j- literal 0 HcmV?d00001 diff --git a/static/js/jquery.tablesorter.min.js b/static/js/jquery.tablesorter.min.js new file mode 100644 index 000000000..b8605df1e --- /dev/null +++ b/static/js/jquery.tablesorter.min.js @@ -0,0 +1,4 @@ + +(function($){$.extend({tablesorter:new +function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:true,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'/\.|\,/g',onRenderHeader:null,selectorHeaders:'thead th',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}if(table.tBodies.length==0)return;var rows=table.tBodies[0].rows;if(rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function checkHeaderOptionsSortingLocked(table,i){if((table.config.headers[i])&&(table.config.headers[i].lockedOrder))return table.config.headers[i].lockedOrder;return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i b["+i+"]) ? 1 : 0));";};function makeSortTextDesc(i){return"((b["+i+"] < a["+i+"]) ? -1 : ((b["+i+"] > a["+i+"]) ? 1 : 0));";};function makeSortNumeric(i){return"a["+i+"]-b["+i+"];";};function makeSortNumericDesc(i){return"b["+i+"]-a["+i+"];";};function sortText(a,b){if(table.config.sortLocaleCompare)return a.localeCompare(b);return((ab)?1:0));};function sortTextDesc(a,b){if(table.config.sortLocaleCompare)return b.localeCompare(a);return((ba)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){$this.trigger("sortStart");var $cell=$(this);var i=this.column;this.order=this.count++%2;if(this.lockedOrder)this.order=this.lockedOrder;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i