Skip to content

Commit

Permalink
Merge pull request #8942 from jimchamp/8906/bug/fix-work-cover-carousel
Browse files Browse the repository at this point in the history
Fix work's `add-cover` carousel
  • Loading branch information
cdrini authored Mar 28, 2024
2 parents 74f6870 + 136727a commit 4043d67
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions openlibrary/plugins/openlibrary/js/carousel/Carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,18 @@ export class Carousel {
this.$container = $container;

//This loads in i18n strings from a hidden input element, generated in the books/custom_carousel.html template.
this.i18n = JSON.parse($('input[name="carousel-i18n-strings"]').attr('value'));
this.availabilityStatuses = {
open: {cls: 'cta-btn--available', cta: this.i18n['open']},
borrow_available: {cls: 'cta-btn--available', cta: this.i18n['borrow_available']},
borrow_unavailable: {cls: 'cta-btn--unavailable', cta: this.i18n['borrow_unavailable']},
error: {cls: 'cta-btn--missing', cta: this.i18n['error']},
// private: {cls: 'cta-btn--available', cta: 'Preview'}
};
const i18nInput = document.querySelector('input[name="carousel-i18n-strings"]')
if (i18nInput) {
this.i18n = JSON.parse(i18nInput.value);

this.availabilityStatuses = {
open: {cls: 'cta-btn--available', cta: this.i18n['open']},
borrow_available: {cls: 'cta-btn--available', cta: this.i18n['borrow_available']},
borrow_unavailable: {cls: 'cta-btn--unavailable', cta: this.i18n['borrow_unavailable']},
error: {cls: 'cta-btn--missing', cta: this.i18n['error']},
// private: {cls: 'cta-btn--available', cta: 'Preview'}
};
}
}

get slick() {
Expand Down

0 comments on commit 4043d67

Please sign in to comment.