Skip to content

Commit

Permalink
Merge pull request #7071 from ztjhz/7009/feat/display-vendors-beneath…
Browse files Browse the repository at this point in the history
…-omnibar-on-mobile-book-page-views

Display vendor beneath omnibar on mobile book page views
  • Loading branch information
jimchamp authored Nov 7, 2022
2 parents f42a0e5 + f75f20c commit 628ca04
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion openlibrary/macros/databarWork.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ <h3 class="header">

$if isbn_10 and not asin:
$ asin = isbn_10
<div class="panel">
<div class="panel desktop-vendor">
<div class="btn-notice">
$:macros.WorldcatLink(isbn=isbn_13 or isbn_10, oclc_numbers=oclc_numbers, referer=page.url(relative=False))

Expand Down
26 changes: 26 additions & 0 deletions openlibrary/templates/type/edition/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,32 @@
</div>
</div>

$ prices = page.key.startswith('/books/')

$ oclc_numbers = (page.oclc_numbers and page.oclc_numbers[0]) or ""
$ isbn_13 = page.get_isbn13()
$ isbn_10 = page.get_isbn10()

$ asin = None
$if page.get('identifiers'):
$if page.identifiers.get('amazon'):
$ asin = page.identifiers.amazon[0]

$if isbn_10 and not asin:
$ asin = isbn_10
<div class="Tools">
<div class="panel mobile-vendor">
<div class="btn-notice">
$:macros.WorldcatLink(isbn=isbn_13 or isbn_10, oclc_numbers=oclc_numbers, referer=page.url(relative=False))

<div class="cta-section">
<p class="cta-section-title">$_('Buy this book')</p>
$:macros.AffiliateLinks(page, {'isbn': isbn_13, 'asin': asin, 'prices': prices})
</div>
</div>
</div>
</div>

$ seen = set()
$if previews and any([len(e.languages) for e in previews]):
<p class="preview-languages">
Expand Down
11 changes: 11 additions & 0 deletions static/css/components/read-panel.less
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
font-size: 12px;
}

.mobile-vendor {
display: none;
}

.read-options,
.Tools .btn-notice {
line-height: 1.5em;
Expand Down Expand Up @@ -122,6 +126,13 @@
.mobile-book-header{
display: inline;
}

.mobile-vendor {
display: inline;
}
.desktop-vendor {
display: none;
}
}
// For the button at the top
@import (less) "components/buttonCta.less";
Expand Down

0 comments on commit 628ca04

Please sign in to comment.