, extracted from watch-overview.html so the same markup can be
re-rendered on its own and pushed over Socket.IO (realtime row resync) - one renderer,
so the row can never drift from the server-rendered list.
It is: every update of a watch sends this row to the pages listing it (realtime/socket_server.py
send_watch_list_row()), and realtime.js puts it in place of the row on the page. So nothing in here may
depend on what only the page knows - the tick of the checkbox is put back by the page.
Rendered via {% include %} from the watch list loop, which inherits the full context:
watch, loop, is_checking_now(), queued_uuids, has_proxies, datastore, active_tag_uuid,
system_default_fetcher, ui_settings, favicons_enabled, fetcher_status_icons,
processor_descriptions, get_all_tags_for_watch(), any_has_restock_price_processor
#}
{%- set checking_now = is_checking_now(watch) -%}
{%- set history_n = watch.history_n -%}
{%- set favicon = watch.get_favicon_filename() -%}
{# Resolved once per row: each read re-validates the URL and, for a Jinja2 templated
URL, builds a fresh sandboxed environment - see validate_url.py #}
{%- set open_link = watch.open_link -%}
{%- set error_texts = watch.compile_error_texts(has_proxies=has_proxies) -%}
{%- set system_use_url_watchlist = datastore.data['settings']['application']['ui'].get('use_page_title_in_list') -%}
{%- set system_use_share = datastore.data['settings']['application']['ui'].get('use_share_watch') -%}
{# Class settings mirrored in changedetectionio/static/js/realtime.js for the frontend #}
{# loop.cycle('pure-table-odd', 'pure-table-even'),#}
{%- set row_classes = [
'processor-' ~ watch['processor'],
'has-error' if error_texts|length > 2 else '',
'paused' if watch.paused is defined and watch.paused != False else '',
'unviewed' if watch.has_unviewed else '',
'has-restock-info' if watch.has_restock_info else 'no-restock-info',
'has-favicon' if favicon else '',
'in-stock' if watch.has_restock_info and watch['restock']['in_stock'] else '',
'not-in-stock' if watch.has_restock_info and not watch['restock']['in_stock'] else '',
'queued' if watch.uuid in queued_uuids else '',
'checking-now' if checking_now else '',
'notification_muted' if watch.notification_muted else '',
'single-history' if history_n == 1 else '',
'multiple-history' if history_n >= 2 else '',
'use-html-title' if watch.shows_page_title_in_list else 'no-html-title',
] -%}
{# {{ loop.index+pagination.skip }}#}
{%- set pause_action = url_for('watchlist.toggle', op='pause', uuid=watch.uuid, tag=active_tag_uuid) -%}
{%- set mute_action = url_for('watchlist.toggle', op='mute', uuid=watch.uuid, tag=active_tag_uuid) -%}
{% if watch.shows_page_title_in_list %}
{{ watch.label }}
{% else %}
{{ watch.get('title') or watch.link }}
{% endif %}
{#- Each label carries its group's colours itself: the rules for them in the page's