Exemplo n.º 1
0
 def render_download_options(self,
                             edition: Edition,
                             extra_args: list = None):
     return render_template(
         self.get_template_path('download_options'),
         self.get_best_identifier(edition),
         *(extra_args or []),
     )
Exemplo n.º 2
0
    def render_download_options(self,
                                edition: Edition,
                                extra_args: list = None):
        if edition.is_access_restricted() or not edition.ia_metadata:
            return ''

        formats = {
            'pdf': edition.get_ia_download_link('.pdf'),
            'epub': edition.get_ia_download_link('.epub'),
            'mobi': edition.get_ia_download_link('.mobi'),
            'txt': edition.get_ia_download_link('_djvu.txt'),
        }

        if any(formats.values()):
            return render_template(
                self.get_template_path('download_options'),
                formats,
                edition.url('/daisy'),
            )
        else:
            return ''
Exemplo n.º 3
0
 def render_read_button(self, ed_or_solr: Union[Edition, dict]):
     return render_template(self.get_template_path('read_button'),
                            self.get_best_identifier(ed_or_solr))