LP1898775: Add basket to bucket in bootstrap
authorJane Sandberg <sandbergja@gmail.com>
Wed, 12 Oct 2022 23:38:20 +0000 (16:38 -0700)
committerChris Sharp <csharp@georgialibraries.org>
Mon, 17 Oct 2022 20:15:47 +0000 (16:15 -0400)
The bootstrap OPAC uses links, rather than <select> for the basket dropdown, so the
existing event listener couldn't get attached to the correct element.

To test:
1. Confirm that you are using the bootstrap OPAC.
2. In the staff client, select the traditional staff catalog.
3. Add several items to your basket.
4. Click the basket icon, and select 'Add Basket to Bucket'
5. Note that you get a 404 error.
6. Apply this patch.
7. Repeat steps 1-3.
8. Note that you can now select a bucket, and that the process completes successfully.

Signed-off-by: Jane Sandberg <sandbergja@gmail.com>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>

Open-ILS/web/js/ui/default/staff/cat/catalog/app.js

index ecd0936..3e82d65 100644 (file)
@@ -696,11 +696,18 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e
                     $(doc).find('#hold_usr_input').trigger($.Event('keydown', {which: 13}));
                 });
             });
+            // Add Cart to Record Bucket, in two flavors:
+            // First, the traditional TPAC, which uses a <select> menu
             $(doc).find('#select_basket_action').on('change', function() {
                 if (this.options[this.selectedIndex].value && this.options[this.selectedIndex].value == "add_cart_to_bucket") {
                     $scope.add_cart_to_record_bucket();
                 }
             });
+            // Second, the bootstrap OPAC, which uses a bunch of <a>s styled as a dropdown
+            $(doc).find('a[href="add_cart_to_bucket"]').on('click', function (event) {
+                event.preventDefault();
+                $scope.add_cart_to_record_bucket();
+            });
         }
 
     }