From 2e76f680d118ea52ffe19412eae74a669cb19a61 Mon Sep 17 00:00:00 2001 From: Sean Warren Date: Fri, 6 Dec 2024 16:46:20 -0500 Subject: [PATCH 1/5] added accessRestrict prop to the AddToCartButton Co-authored-by: Shaun Ellis --- app/javascript/components/AddToCartButton.vue | 8 +++++++- app/javascript/test/addToCartButton.spec.js | 2 +- spec/features/catalog_view_spec.rb | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/javascript/components/AddToCartButton.vue b/app/javascript/components/AddToCartButton.vue index 0cbc6a9e..d24ad6ac 100644 --- a/app/javascript/components/AddToCartButton.vue +++ b/app/javascript/components/AddToCartButton.vue @@ -33,6 +33,11 @@ export default { type: Object, default: () => { {} }, required: false, + }, + accessRestrict: { + type: String, + default: "", + required: false, } }, methods: { @@ -47,7 +52,8 @@ export default { title: this.title, containers: this.containers, location: this.location, - formParams: this.formParams + formParams: this.formParams, + accessRestrict: this.accessRestrict } }, items: { diff --git a/app/javascript/test/addToCartButton.spec.js b/app/javascript/test/addToCartButton.spec.js index aa99911e..ef46fc8a 100644 --- a/app/javascript/test/addToCartButton.spec.js +++ b/app/javascript/test/addToCartButton.spec.js @@ -20,6 +20,6 @@ describe('AddToCartButton.vue', () => { }) const button = getByRole('button') await fireEvent.click(button) - expect(addItemToCart).toHaveBeenCalledWith(expect.anything(), { callnumber: 'AC101', containers: '', formParams: undefined, title: 'Title' }) + expect(addItemToCart).toHaveBeenCalledWith(expect.anything(), { accessRestrict: '', callnumber: 'AC101', containers: '', formParams: undefined, title: 'Title' }) }) }) diff --git a/spec/features/catalog_view_spec.rb b/spec/features/catalog_view_spec.rb index d1046c83..da557bd5 100644 --- a/spec/features/catalog_view_spec.rb +++ b/spec/features/catalog_view_spec.rb @@ -69,7 +69,7 @@ expect(page).to have_selector "td", text: /MC148_c00002/ expect(page).to have_selector "td", text: /Box 1/ expect(page).to have_selector "button[type='submit']", text: /Request 1 Item/ - + byebug # Click the remove item button find("#item-MC148_c00002 > td > button").click end From d86c207d6a206420c3dc84249a2c5ef4a766c0aa Mon Sep 17 00:00:00 2001 From: Sean Warren Date: Tue, 10 Dec 2024 12:15:03 -0500 Subject: [PATCH 2/5] When an item is restricted it now alerts the user in the request cart Co-authored-by: Shaun Ellis --- app/javascript/components/AddToCartButton.vue | 8 ++++---- app/javascript/components/RequestCart.vue | 8 +++++++- app/models/solr_document.rb | 4 ++++ app/views/catalog/_show_tab_panes.html.erb | 1 + spec/features/catalog_view_spec.rb | 8 +++++++- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/app/javascript/components/AddToCartButton.vue b/app/javascript/components/AddToCartButton.vue index d24ad6ac..4c9c388f 100644 --- a/app/javascript/components/AddToCartButton.vue +++ b/app/javascript/components/AddToCartButton.vue @@ -34,9 +34,9 @@ export default { default: () => { {} }, required: false, }, - accessRestrict: { - type: String, - default: "", + restricted: { + type: Boolean, + default: false, required: false, } }, @@ -53,7 +53,7 @@ export default { containers: this.containers, location: this.location, formParams: this.formParams, - accessRestrict: this.accessRestrict + restricted: this.restricted } }, items: { diff --git a/app/javascript/components/RequestCart.vue b/app/javascript/components/RequestCart.vue index be970697..fd6ee07f 100644 --- a/app/javascript/components/RequestCart.vue +++ b/app/javascript/components/RequestCart.vue @@ -78,7 +78,13 @@ - + + + Item may need to be reviewed by staff for access. + + + + View this item at the