Browse Source

Remove useless web pages and use a better title

jherve 1 year ago
parent
commit
13f3f424e5
4 changed files with 5 additions and 43 deletions
  1. 3 10
      src/media_observer/web.py
  2. 0 14
      templates/admin/index.html
  3. 2 3
      templates/index.html
  4. 0 16
      templates/site_detail.html

+ 3 - 10
src/media_observer/web.py

@@ -82,7 +82,9 @@ async def get_similarity_search(storage: Storage = Depends(get_db)):
 async def index(request: Request, storage: Storage = Depends(get_db)):
     sites = await storage.list_sites()
     return templates.TemplateResponse(
-        request=request, name="index.html", context={"sites": sites}
+        request=request,
+        name="index.html",
+        context={"page_title": "Observatoire des médias", "sites": sites},
     )
 
 
@@ -166,12 +168,3 @@ async def site_main_article_snapshot(
             ),
         },
     )
-
-
-@app.get("/admin", response_class=HTMLResponse)
-async def admin_index(request: Request):
-    return templates.TemplateResponse(
-        request=request,
-        name="admin/index.html",
-        context={"collections": media_collection},
-    )

+ 0 - 14
templates/admin/index.html

@@ -1,14 +0,0 @@
-<html>
-<head>
-    <meta name="viewport" content="width=device-width, initial-scale=1" />
-    <title>Hello</title>
-    <link href="{{ url_for('static', path='/style.css') }}" rel="stylesheet">
-</head>
-<body class="admin">
-    <h1>Main admin page</h1>
-
-    {% for name, coll in collections.items() %}
-        <h2>{{ name }}</h2>
-    {% endfor %}
-</body>
-</html>

+ 2 - 3
templates/index.html

@@ -3,12 +3,11 @@
 <html>
 <head>
     <meta name="viewport" content="width=device-width, initial-scale=1" />
-    <title>Hello</title>
+    <title>{{ page_title }}</title>
     <link href="{{ url_for('static', path='/style.css') }}" rel="stylesheet">
 </head>
 <body>
-    <a href="{{ url_for('admin_index') }}">Admin page</a>
-    <h1>Hello World !</h1>
+    <h1>{{ page_title }}</h1>
 
     <ul>
         {% for s in sites %}

+ 0 - 16
templates/site_detail.html

@@ -1,16 +0,0 @@
-<html>
-<head>
-    <meta name="viewport" content="width=device-width, initial-scale=1" />
-    <title>Hello</title>
-    <link href="{{ url_for('static', path='/style.css') }}" rel="stylesheet">
-</head>
-<body>
-    <a href="{{ url_for('index') }}">Homepage</a>
-    <h1>Site {{ site_id }}</h1>
-
-    {% for a in main_articles %}
-        <h2>{{ a["title"] }}</h2>
-        <p>{{ a["timestamp_virtual"] }}</p>
-    {% endfor %}
-</body>
-</html>