Просмотр исходного кода

Add link to the frontpage snapshot

jherve 1 год назад
Родитель
Сommit
c05f653a97
2 измененных файлов с 7 добавлено и 3 удалено
  1. 6 2
      src/media_observer/storage.py
  2. 1 1
      templates/site_main_article_detail.html

+ 6 - 2
src/media_observer/storage.py

@@ -116,6 +116,7 @@ view_frontpages = View(
         "site_original_url",
         "timestamp",
         "timestamp_virtual",
+        "archive_snapshot_url",
     ],
     create_stmt="""
         SELECT
@@ -124,7 +125,8 @@ view_frontpages = View(
             si.name AS site_name,
             si.original_url AS site_original_url,
             fp.timestamp,
-            fp.timestamp_virtual
+            fp.timestamp_virtual,
+            fp.url_snapshot AS archive_snapshot_url
         FROM
             frontpages AS fp
         JOIN
@@ -182,6 +184,7 @@ view_articles_on_frontpage = View(
         "site_original_url",
         "timestamp",
         "timestamp_virtual",
+        "archive_snapshot_url",
         "article_id",
         "title",
         "title_id",
@@ -198,6 +201,7 @@ view_articles_on_frontpage = View(
             fpv.site_original_url,
             fpv."timestamp",
             fpv.timestamp_virtual,
+            fpv.archive_snapshot_url,
             av.id AS article_id,
             av.title,
             av.title_id,
@@ -353,7 +357,7 @@ class Storage(StorageAbc):
 
             return [
                 self._from_row(a, self._view_by_name["articles_on_frontpage_view"])
-                | {"time_diff": a[13]}
+                | {"time_diff": a[14]}
                 for a in main_articles
             ]
 

+ 1 - 1
templates/site_main_article_detail.html

@@ -59,7 +59,7 @@
     {%- endmacro -%}
 
     <a href="{{ url_for('index') }}">Homepage</a>
-    <h1>{{ ui.logo(focused["site_name"]) }}</h1>
+    <h1>{{ ui.logo(focused["site_name"]) }} <a href="{{ focused['archive_snapshot_url']}}"><img src="{{ url_for('static', path='/external-link.svg') }}" height="30px"></a></h1>
 
     <div id="article_browser">
         {{ articles_list_same_time(simultaneous_up, "up") }}