# HG changeset patch # User Paul Boddie # Date 1329779155 -3600 # Node ID cdef4cbc9a6137c64babe76d38923fa8bde53f60 # Parent 2c22a63305b0917017440cd770324cfe4efd4e2d Fixed the appearance of alternative/opposite sort direction arrows so that they only apply to the selected column in each list of columns. Such arrows have also been made more prominent. Added a label to the sort control pop-up to say what it does. Tidied the write_sort_control function signature. diff -r 2c22a63305b0 -r cdef4cbc9a61 ImprovedTableParser.py --- a/ImprovedTableParser.py Mon Feb 20 21:59:32 2012 +0100 +++ b/ImprovedTableParser.py Tue Feb 21 00:05:55 2012 +0100 @@ -426,17 +426,25 @@ return 0 -def write_sort_control(request, columnnumber, fmt, write, sort_columns, column_types, columns, table_name, start=0): +def write_sort_control(request, columnnumber, columns, sort_columns, column_types, table_name, start=0): """ - Write a sort control in a pop-up element which provides a list of links - corresponding to modified sort criteria. + Using the 'request', write a sort control for the given 'columnnumber' in + the collection of 'columns', using the existing 'sort_columns' and + 'column_types' to construct labels and links that modify the sort criteria, + and using the given 'table_name' to parameterise the links. """ + fmt = request.formatter + write = request.write _ = request.getText write(fmt.div(1, css_class="sortcolumns")) + write(fmt.paragraph(1)) + write(fmt.text(_("Sort by columns..."))) + write(fmt.paragraph(0)) + # Start with the existing criteria without this column being involved. revised_sort_columns = [(column, fn, ascending) @@ -509,9 +517,9 @@ sortcolumns_revised = get_sort_column_output(revised_sort_columns) write_sort_link(write, request, fmt, table_name, sortcolumns_revised, u"%s %s" % (label, arrow), "removecolumn") - # Alternative sort direction. + # Alternative sort direction. - write_sort_link(write, request, fmt, table_name, sortcolumns_reverse, arrow_reverse, "altdirection") + write_sort_link(write, request, fmt, table_name, sortcolumns_reverse, arrow_reverse, "altdirection") write(fmt.listitem(0)) @@ -653,7 +661,7 @@ # Add sorting controls, if appropriate. if sortable: - write_sort_control(request, columnnumber, fmt, write, sort_columns, column_types, columns, table_name) + write_sort_control(request, columnnumber, columns, sort_columns, column_types, table_name) write(fmt.div(0)) write(fmt.table_cell(0)) diff -r 2c22a63305b0 -r cdef4cbc9a61 css/improvedtableparser.css --- a/css/improvedtableparser.css Mon Feb 20 21:59:32 2012 +0100 +++ b/css/improvedtableparser.css Tue Feb 21 00:05:55 2012 +0100 @@ -33,6 +33,10 @@ /* Column listings. */ +.sortcolumns p { + padding: 0.5em 0.5em 0 0.5em; +} + .sortcolumns ol { margin: 0.5em; padding: 0.25em 1.5em 0.25em 1.5em; @@ -90,10 +94,19 @@ display: block; } +a.altdirection, +.newsortcolumn { + color: #000; + padding: 0.5em; +} + +a.altdirection { + background-color: #fcc; +} + +a.altdirection:hover, .newsortcolumn { background-color: #f66; - color: #000; - padding: 0.5em; } .appendcolumn {