$def with (page, work, edition, ocaid, work_title, star_ratings_stats, for_desktop=False)
$def icon_link(link_class, img_src, link_text, login_redirect=True, ga_data=None):
$ href = 'javascript:;'
$ ga_attr = 'data-ol-link-track=%s' % ga_data if ga_data else ''
$link_text
$ page_url = page.url()
$ view_type = 'desktop' if for_desktop else 'mobile'
$ book_title = edition.get('title', '') or (work.title if work else '')
$book_title
$if edition:
$if edition.subtitle:
$edition.subtitle
$if edition.edition_name:
$edition.edition_name
$ authors = (work or edition).get_authors()
$ author_names = (work or edition).author_names
$if authors:
$ is_librarian = ctx.user and ctx.user.is_librarian()
$:macros.BookByline([{'name': author.name, 'url': author.url(), 'birth_date': author.birth_date, 'death_date': author.death_date} for author in authors], attrs='itemprop="author"', show_years=is_librarian)
$elif author_names:
$:macros.BookByline([{'name': name} for name in author_names], attrs='itemprop="author"')
$:star_ratings_stats
$if not for_desktop:
$# On mobile, the 'Share' button appears next to the title and author
$ share_content = icon_link("share-modal-link", "/static/images/icons/share.svg", _("Share"), login_redirect=False, ga_data="ModalLinkClick|ShareIcon")
$ share_links = ctx.get('share_links')
$:macros.ShareModal(share_links, page_url, share_content)