LP#1721575: Batch Actions In the Public Catalog
authorGalen Charlton <gmc@equinoxinitiative.org>
Mon, 14 May 2018 19:24:59 +0000 (15:24 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 15 Aug 2018 18:08:42 +0000 (14:08 -0400)
commitdeab49ceef1b036c7918c3103282e0be13710980
treed8e6d7d2fd92ff8732bd300febf3a507d50fff6a
parentfdd829da38d9b62e301538af968b727a7f19c330
LP#1721575: Batch Actions In the Public Catalog

The public catalog now displays checkboxes on the bibliographic and
metarecord constituents results pages. Selecting one or more titles
by using the checkboxes will dynamically add those title to the
temporary list, which is now renamed the basket.

Above the results lists there is now a bar with a select-all checkbox,
a link to the basket management page that also indicates the number of
of titles in the basket, and a link to remove from the basket titles that
are selected on the currently displayed results page.

The search bar now includes an icon of a basket and displays the number
of titles currently in the basket. Next to that icon is a menu of basket
actions.

The basket actions available are Place Hold, Print Title Details,
Email Title Details, Add Cart to Saved List, and Clear Cart. In the
web staff client, the basket actions also include Add Cart to Bucket.
When an action is selected from this menu, the user is given an
opportunity to confirm the action and to optionally empty the basket
when the action is complete. The action is applied to all titles
in the basket.

Clicking on the basket icon brings the user to a page listing the
titles in the basket. From there, the user can select specific records
to request, print, email, add to a list, or remove from the basket.

The list of actions on the record details page now provides separate
links for adding the title to a basket or to a permanent list.

The permanent list management page in the public catalog now also
includes batch print and email actions.

Additional information
++++++++++++++++++++++
* The checkboxes do not display on the metarecord results page, as
  metarecords currently cannot be put into baskets or lists.
* The checkboxes are displayed only if Javascript is enabled. However,
  users can still add items to the basket and perform batch actions on
  the basket and on lists.
* A template `config.tt2` setting, `ctx.max_basket_size`, can be used to
  set a soft limit on the number of titles that can be added to the
  basket. If this limit is reached, checkboxes to add more records to the
  basket are disabled unless existing titles in the basket are removed
  first. The default value for this setting is 500.

Developer notes
+++++++++++++++

This patch adds the the public catalog two routes that return JSON
rather than HTML:

* `GET /eg/opac/api/mylist/add?record=45`
* `GET /eg/opac/api/mylist/delete?record=45`

The JSON response is a hash containing a mylist key pointing to the list
of bib IDs of contents of the basket.

The record parameter can be repeated to allow adding or removing
records as an atomic operation. Note that this change also now available
to `/eg/opac/mylist/{add,delete}`

More generally, this adds a way for EGWeb context loaders to specify that
a response should be emitted as JSON rather than rendering an HTML
page using `Template::Toolkit`.

Specifically, if the context as munged by the context loader contains
a `json_response` key, the contents of that key will to provide a
JSON reponse. The `json_response_cookie` key, if present, can be used
to set a cookie as part of the response.

Template Toolkit processing is bypassed entirely when emitting a JSON
response, so the context loader would be entirely reponsible for
localization of strings in the response meant for direct human
consumption.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
37 files changed:
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Container.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.data.bre_format_title_fix.sql [new file with mode: 0644]
Open-ILS/src/templates/opac/advanced.tt2
Open-ILS/src/templates/opac/browse.tt2
Open-ILS/src/templates/opac/css/style.css.tt2
Open-ILS/src/templates/opac/mylist.tt2
Open-ILS/src/templates/opac/mylist/clear.tt2 [new file with mode: 0644]
Open-ILS/src/templates/opac/mylist/email.tt2 [new file with mode: 0644]
Open-ILS/src/templates/opac/mylist/print.tt2 [new file with mode: 0644]
Open-ILS/src/templates/opac/myopac/lists.tt2
Open-ILS/src/templates/opac/parts/anon_list.tt2
Open-ILS/src/templates/opac/parts/bookbag_actions.tt2
Open-ILS/src/templates/opac/parts/cart.tt2 [new file with mode: 0644]
Open-ILS/src/templates/opac/parts/config.tt2
Open-ILS/src/templates/opac/parts/css/colors.tt2
Open-ILS/src/templates/opac/parts/header.tt2
Open-ILS/src/templates/opac/parts/js.tt2
Open-ILS/src/templates/opac/parts/place_hold.tt2
Open-ILS/src/templates/opac/parts/record/summary.tt2
Open-ILS/src/templates/opac/parts/result/table.tt2
Open-ILS/src/templates/opac/parts/searchbar.tt2
Open-ILS/src/templates/opac/parts/topnav.tt2
Open-ILS/src/templates/opac/record/email.tt2
Open-ILS/src/templates/opac/record/print.tt2
Open-ILS/src/templates/opac/results.tt2
Open-ILS/src/templates/opac/temp_warn.tt2
Open-ILS/web/images/add-to-cart.png [new file with mode: 0644]
Open-ILS/web/images/cart-md.png [new file with mode: 0644]
Open-ILS/web/images/cart-sm.png [new file with mode: 0644]
Open-ILS/web/js/ui/default/opac/record_selectors.js [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/cat/catalog/app.js
docs/RELEASE_NOTES_NEXT/OPAC/Batch_Actions.adoc [new file with mode: 0644]