Bug 21588: Add expand/collapse all links to the "Acquisition details" subscriptions

In order to make the view cleaner, a librarian may need to expand or
collapse all the orders at once.

Test plan:
- Create a subscription
- Create several orders from this subscription (quantity > 1)
- Receive partially the orders
- Go to the subscription detail page, "Acquisition details" tab
=> Notice the 2 new links "Expand all" and "Collapse all"
Make sure they work as expected.

Also note that a bug has been fixed, when the page is loaded the tree is
now expanded.

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2019-05-09 12:27:15 -05:00 committed by Martin Renvoize
parent 3599e57bf6
commit a6d732f563
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -351,7 +351,10 @@
<caption>
<span class="actions">
<a href="#" id="hide_received_orders">Hide already received orders</a>
| <a href="#" id="show_all_orders">Show all orders</a></span>
| <a href="#" id="show_all_orders">Show all orders</a>
| <a href="#" id="expand_all">Expand all</a>
| <a href="#" id="collapse_all">Collapse all</a>
</span>
</caption>
<thead>
@ -498,9 +501,20 @@
[% IF orders_grouped.size %]
$(table).treetable({
expandable: true
expandable: true,
initialState: 'expanded',
});
$(table).treetable('expandAll');
$("#expand_all").click(function(e){
e.preventDefault();
$(table).treetable('expandAll');
});
$("#collapse_all").click(function(e){
e.preventDefault();
$(table).treetable('collapseAll');
});
[% END %]
$("#hide_received_orders").click(function(e){