Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rm encrypted daisy, add previews #6192

Merged
merged 5 commits into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion openlibrary/macros/BookPreview.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
$# :param str ocaid:

<a class="cta-btn cta-btn--shell cta-btn--preview"
data-iframe-src="https://archive.org/embed/$ocaid"
data-iframe-src="https://archive.org/details/$ocaid?view=theater&wrapper=false"
data-iframe-link="https://archive.org/details/$ocaid"
data-ol-link-track="CTAClick|Preview" href="#bookPreview">$_('Preview')</a>

Expand Down
22 changes: 8 additions & 14 deletions openlibrary/macros/LoanStatus.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
$def with (doc, work_key=None, listen=True, daisy=True, allow_expensive_availability_check=False, secondary_action=False, check_sponsorship=False, sponsorship_help=False, check_loan_status=False, user_lists=None, post='')
$def with (doc, work_key=None, listen=True, allow_expensive_availability_check=False, secondary_action=False, check_sponsorship=False, sponsorship_help=False, check_loan_status=False, user_lists=None, post='')
$# Takes following parameters:
$# * doc - Can be a Work, Edition, or solr dict.
$# * listen whether to display listen button
$# * daisy whether to display daisy print-disabled link
$# * allow_expensive_availability_check whether to check the groundtruth availability if can't get availability from specified fields
$# * secondary_action whether to display the preview/search inside button
$# * check_sponsorship whether to check if the book is eligible for sponsorship
Expand Down Expand Up @@ -104,6 +103,8 @@
<a href="$work_key" class="cta-btn cta-btn--missing" title="$_('This book is currently checked out, please check back later.')"
data-ol-link-track="CTAClick|CheckedOut">$_('Checked Out')</a>
</div>
$if secondary_action:
$:macros.BookPreview(ocaid, linkback=not no_index)

$elif ('eligibility' in doc) or (check_sponsorship and not ocaid and not availability.get('is_lendable')):
$ sponsorship = doc.get('eligibility') if 'eligibility' in doc else qualifies_for_sponsorship(doc, donate_only=True)
Expand All @@ -117,27 +118,20 @@
$_("We don't have this book yet. Can you donate it to the Lending Library?")
<a href="https://openlibrary.org/bookdrive" target="_blank">$_('Learn More')</a>
</p>
$else:
<div class="cta-button-group">
<a href="$work_key" class="cta-btn cta-btn--missing" data-ol-link-track="CTAClick|NotInLibrary">$_('Not in Library')</a>
</div>

$elif ocaid and availability.get('is_previewable') and book_provider.short_name == 'ia':
$:macros.BookPreview(ocaid, linkback=not no_index)
$if secondary_action:
$:macros.BookSearchInside(ocaid)

$else:
<div class="cta-button-group">
<a href="$work_key" class="cta-btn cta-btn--missing"
data-ol-link-track="CTAClick|NotInLibrary">$_('Not in Library')</a>
</div>

$if ocaid and secondary_action and availability.get('is_printdisabled') and book_provider.short_name == 'ia':
$:macros.BookPreview(ocaid, linkback=not no_index)
$:macros.BookSearchInside(ocaid)

$:post

$if ocaid and daisy and book_provider.short_name == 'ia':
$ url = doc.get('url') or doc.get('key') + '/-'
$:macros.daisy('%s/daisy' % url, protected=availability.get('is_printdisabled'))

$if query_param('debug'):
$ loanstatus_end_time = time() - loanstatus_start_time
<p>get_waiting_loan_for(ocaid) took $("%.2f" % waiting_loan_total_time) seconds</p>
Expand Down
12 changes: 0 additions & 12 deletions openlibrary/macros/daisy.html

This file was deleted.

2 changes: 1 addition & 1 deletion openlibrary/templates/books/custom_carousel.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</a>
</div>
<div class="book-cta">
$:macros.LoanStatus(book, work_key=work_key, listen=False, daisy=False)
$:macros.LoanStatus(book, work_key=work_key, listen=False)
</div>
</div>

Expand Down