Bug 8028 - Make table collapsing on parcel.pl sticky
The tables on parcel.pl default to show only the first five items in the table, and librarians must click the a link to display all the items. Every time the page is reloaded, the table gets re-collapsed, and the librarian must again click the link. Parcel.pl should remember which way the table is set and keep it that way until it is changed again. This is accomplished by adding two cookies for this page, one for each table. This cookie stores the state of the table ( collapsed, or uncollapsed ) and sets each table to the correct state on each page load. Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Works as expected. But a "funny" behaviour, if I have only 1 item (or < 6): All 1 items are displayed. Click here to show only the first 5 items. and Only the first 5 items are displayed. Click here to show all 1 items.
This commit is contained in:
parent
699e2955ff
commit
1bfbf707de
|
|
@ -51,8 +51,8 @@
|
|||
|
||||
rowCountPending = $("#pendingt tbody.filterclass tr").length;
|
||||
rowCountReceived = $("#receivedt tbody.filterclass tr").length;
|
||||
if (rowCountPending > rowsToCollapse) { pendingCollapse(); }
|
||||
if (rowCountReceived > rowsToCollapse) { receivedCollapse(); }
|
||||
if (rowCountPending > rowsToCollapse && $.cookie("pendingKeepExpanded") != 1 ) { pendingCollapse(); }
|
||||
if (rowCountReceived > rowsToCollapse && $.cookie("receivedKeepExpanded") != 1 ) { receivedCollapse(); } else { receivedExpand(); }
|
||||
});
|
||||
|
||||
// Case-insensitive version of jquery's contains function
|
||||
|
|
@ -68,6 +68,7 @@
|
|||
|
||||
// Collapse pending items table
|
||||
function pendingCollapse() {
|
||||
$.cookie("pendingKeepExpanded", 0, { path: "/", expires: 9999 });
|
||||
$("#pendingcollapserow").remove();
|
||||
$("#pendingt tr").show();
|
||||
$("#pendingt tbody.filterclass tr:gt(" + (rowsToCollapse-1) + ")").hide();
|
||||
|
|
@ -77,6 +78,7 @@
|
|||
|
||||
// Expend pending items table
|
||||
function pendingExpand() {
|
||||
$.cookie("pendingKeepExpanded", 1, { path: "/", expires: 9999 });
|
||||
$("#pendingcollapserow").remove();
|
||||
$("#pendingt tr").show();
|
||||
$("#pendingt tbody.filterclass tr.orderfound").remove();
|
||||
|
|
@ -85,6 +87,7 @@
|
|||
|
||||
// Collapse already received items table
|
||||
function receivedCollapse() {
|
||||
$.cookie("receivedKeepExpanded", 0, { path: "/", expires: 9999 });
|
||||
$("#receivedcollapserow").remove();
|
||||
$("#receivedt tbody.filterclass tr:gt(" + (rowsToCollapse-1) + ")").hide();
|
||||
$("#receivedt").before("<p id=\"receivedcollapserow\">" + _("Only the first ") + rowsToCollapse + _(" items are displayed.") + "<a href=\"javascript:receivedExpand();\">" + _("Click here to show all ") + rowCountReceived + _(" items") + "<\/a>.<\/p>");
|
||||
|
|
@ -92,6 +95,7 @@
|
|||
|
||||
// Expand already received items table
|
||||
function receivedExpand() {
|
||||
$.cookie("receivedKeepExpanded", 1, { path: "/", expires: 9999 });
|
||||
$("#receivedcollapserow").remove();
|
||||
$("#receivedt tr").show();
|
||||
$("#receivedt").before("<p id=\"receivedcollapserow\">" + _("All ") + rowCountReceived + _(" items are displayed.") + "<a href=\"javascript:receivedCollapse();\">" + _("Click here to show only the first ") + rowsToCollapse + _(" items") + "<\/a>.<\/p>");
|
||||
|
|
|
|||
Loading…
Reference in New Issue