New frontent and article grouping #1

Merged
mdivecky merged 16 commits from new-frontend into main 2023-08-17 11:32:35 +02:00
6 changed files with 145 additions and 155 deletions
Showing only changes of commit 41575bf4a9 - Show all commits

15
.editorconfig Normal file
View file

@ -0,0 +1,15 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.{html,py}]
indent_style = tab
indent_size = 4
[*.html]
indent_style = tab
indent_size = 2

View file

@ -1,42 +1,23 @@
<!DOCTYPE html>
<html lang="en" class="h100">
{% extends "base.html" %}
<head>
{% include 'parts/head.html' %}
<style>
html {
position: relative;
min-height: 100%;
}
body {
margin-bottom: 60px; /* Margin bottom by footer height */
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
}
</style>
</head>
<body class="d-flex flex-column h-100">
<!-- Begin page content -->
<main class="flex-shrink-0">
<div class="container">
<h1 class="mt-5">Headliner</h1>
<p class="lead">Headliner is monitoring rss feeds of czech news websites for changes in article headlines. Just
because it might be interesting.</p>
<p>See <a href="https://git.nolog.cz/mdivecky/headline">the source code</a>, but be aware that it's not too nice.
Feel free to improve it.</p>
<p>If you want to access the raw data collected by this tool, you can <a href="https://git.nolog.cz/NoLog.cz/headline-exports">download the full archive from our git</a></p>
</div>
</main>
{% include 'parts/footer.html' %}
</body>
</html>
{% block body %}
<main class="flex-shrink-0">
<div class="container">
<h1 class="mt-5">Headliner</h1>
<p class="lead">
Headliner is monitoring rss feeds of czech news websites for changes in
article headlines. Just because it might be interesting.
</p>
<p>
See <a href="https://git.nolog.cz/mdivecky/headline">the source code</a>,
but be aware that it's not too nice. Feel free to improve it.
</p>
<p>
If you want to access the raw data collected by this tool, you can
<a href="https://git.nolog.cz/NoLog.cz/headline-exports"
>download the full archive from our git</a
>
</p>
</div>
</main>
{% endblock body %}

25
view/templates/base.html Normal file
View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Headliner</title>
<link
rel="shortcut icon"
href="{{ url_for('static', filename='favicon.ico') }}"
/>
<link
rel="stylesheet"
href="{{ url_for('static', filename='main.css') }}"
/>
<script
defer
data-domain="headline.beta.nolog.cz"
src="https://plausible.nolog.cz/js/plausible.js"
></script>
</head>
<body>
{% block body %}{% endblock %}
{% include 'parts/footer.html' %}
</body>
</html>

View file

@ -1,35 +1,27 @@
<!DOCTYPE html>
<html lang="en">
{% extends "base.html" %}
<head>
{% include 'parts/head.html' %}
</head>
{% block body %}
<div class="container">
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Name</th>
<th>RSS/Atom URL</th>
<th>Unique tag</th>
</tr>
</thead>
<tbody>
{% for feed in feeds %}
<tr>
<td>{{ feed.feed_name }}</td>
<td>{{ feed.rss_source | urlize(target="_blank") }}</td>
<td>{{ feed.unique_tag }}</td>
<body>
<div class="container">
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Name</th>
<th>RSS/Atom URL</th>
<th>Unique tag</th>
</tr>
</thead>
<tbody>
{% for feed in feeds %}
<tr>
<td>{{ feed.feed_name }}</td>
<td>{{ feed.rss_source | urlize(target="_blank") }}</td>
<td>{{ feed.unique_tag }}</td>
{% endfor %}
</tbody>
</table>
</div>
{% endfor %}
</tr>
</tbody>
</table>
</div>
{% include 'parts/footer.html' %}
</body>
</html>
</div>
{% endblock body %}

View file

@ -1,80 +1,64 @@
<!DOCTYPE html>
<html lang="en">
{% extends "base.html" %}
<head>
{% include 'parts/head.html' %}
<style>
/* Longer name hidden by default */
span.long {
display: none;
}
/* On hover, hide the short name */
.expanded:hover span.short {
display: none;
}
/* On hover, display the longer name. */
.expanded:hover span.long {
display: block;
}
</style>
</head>
<body>
<div class="container">
{% block body %}
<div class="container">
<form>
<div class="d-flex">
<input class="m-2 form-control" type="text" id="search" name="search" value="{{ search|e }}" />
<input class="m-2 btn btn-primary" type="submit" formenctype="application/x-www-form-urlencoded" formmethod="get" value="Hledat" />
<input
class="m-2 form-control"
type="text"
id="search"
name="search"
value="{{ search|e }}"
/>
<input
class="m-2 btn btn-primary"
type="submit"
formenctype="application/x-www-form-urlencoded"
formmethod="get"
value="Hledat"
/>
</div>
</form>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Detection time</th>
<th>Source</th>
<th>Diff</th>
<th>Original</th>
<th>Changed</th>
</tr>
</thead>
<tbody>
{% for diff in diffs %}
<tr>
<td>{{ diff.diff_time }}</td>
<td><a href='{{ diff.article_url }}' target="_blank">{{ diff.feed_name }}</a></td>
<td>{{ diff.diff_html|safe }}</td>
<td class="expanded">
<span class="short">{{ diff.title_orig|truncate(15) }} </span>
<span class="long">{{ diff.title_orig }} </span>
</td>
<td class="expanded">
<span class="short">{{ diff.title_new|truncate(15) }} </span>
<span class="long">{{ diff.title_new}} </span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="container text-center">
<div class="row">
<div class="col">
{{ pagination.links }}
</div>
<div class="col">
{{ pagination.info }}
</div>
</div>
</div>
</div>
{% include 'parts/footer.html' %}
</body>
</html>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Detection time</th>
<th>Source</th>
<th>Diff</th>
<th>Original</th>
<th>Changed</th>
</tr>
</thead>
<tbody>
{% for diff in diffs %}
<tr>
<td>{{ diff.diff_time }}</td>
<td>
<a href="{{ diff.article_url }}" target="_blank"
>{{ diff.feed_name }}</a
>
</td>
<td>{{ diff.diff_html|safe }}</td>
<td class="expanded">
<span class="short">{{ diff.title_orig|truncate(15) }} </span>
<span class="long">{{ diff.title_orig }} </span>
</td>
<td class="expanded">
<span class="short">{{ diff.title_new|truncate(15) }} </span>
<span class="long">{{ diff.title_new}} </span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="container text-center">
<div class="row">
<div class="col">{{ pagination.links }}</div>
<div class="col">{{ pagination.info }}</div>
</div>
</div>
</div>
{% endblock body %}

View file

@ -1,7 +0,0 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Headliner</title>
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='main.css') }}">
<script defer data-domain="headline.beta.nolog.cz" src="https://plausible.nolog.cz/js/plausible.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">