{# Shared by the dataset's Thumbnails page and the admin tab: one row of webpageviewplus_thumbnail_status, in words. #} {% macro shows(row) -%} {% set shows = row.shows %} {% if not shows %} {{ _('Another view of this resource decides it.') }} {% else %} {% if shows.src %}{% endif %} {%- if shows.kind == 'thumbnail' -%}{{ _('The stored thumbnail') }} {%- elif shows.kind == 'screenshot' -%}{{ _('The screenshot') }} {%- elif shows.kind == 'logo' -%}{{ _("{service}'s logo").format(service=shows.service) }} {%- elif shows.kind == 'name' -%}{{ _('The name {service}').format(service=shows.service) }} {%- else -%}{{ _('The format label') }} {%- endif -%} {% endif %} {%- endmacro %} {% macro stored(row) -%} {% set kinds = { 'picked': _('A picked image'), 'page': _("The page's preview image"), 'service': _("The service's thumbnail"), 'office': _("The file's own preview"), 'first_page': _("The PDF's first page"), 'other': _('Another source'), } %} {% if row.thumbnail %} {{ kinds.get(row.thumbnail.kind, kinds.other) }}, {{ h.render_datetime(row.thumbnail.created, with_hours=True) }} {% if not row.thumbnail.in_use %}
{{ _('Not in use: the view no longer asks for it.') }}{% endif %} {% else %} {{ _('None') }} {% endif %} {% if row.no_auto_thumbnail %}
{{ _('Automatic thumbnails are off.') }}{% endif %} {%- endmacro %} {% macro screenshot(shot) -%} {% set reasons = { 'page_failed': _("the page didn't load"), 'unreachable': _("the page couldn't be reached"), 'backend_error': _('the screenshot service refused the request'), 'rate_limited': _("the screenshot service's allowance is used up for now"), 'no_image': _("the answer wasn't an image"), 'unsafe_backend': _("the screenshot service isn't set up safely"), } %} {% if not shot %} {{ _('Not taken for this view.') }} {%- elif shot.state == 'in_use' -%} {{ _('In use, taken {date}.').format(date=h.render_datetime(shot.taken, with_hours=True)) }} {%- elif shot.state == 'pending' -%} {{ _('Pending.') }} {%- elif shot.state == 'failed' -%} {{ _('The last attempt on {date} failed: {reason}.').format(date=h.render_datetime(shot.attempted), reason=reasons.get(shot.error, shot.error)) }} {%- elif shot.state == 'not_in_use' and shot.reason == 'frameable' -%} {{ _("This page can now be shown in a frame, so the screenshot isn't used.") }} {%- elif shot.state == 'not_in_use' and shot.reason == 'picked' -%} {{ _('You picked a thumbnail, so the screenshot isn\'t used.') }} {%- elif shot.state in ('not_in_use', 'private') -%} {{ _("This dataset is private, so screenshots aren't taken.") }} {%- elif shot.state == 'other_url' -%} {{ _('Of a previous page address, so not in use.') }} {%- else -%} {{ _("A screenshot is taken after you save, if this page can't be shown in a frame.") }} {%- endif -%} {% if shot and shot.button and shot.cooldown %}
{{ ungettext('You can take a new screenshot in {seconds} second.', 'You can take a new screenshot in {seconds} seconds.', shot.cooldown).format(seconds=shot.cooldown) }} {% endif %} {%- endmacro %}