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

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> {% extends "base.html" %}
<html lang="en">
<head> {% block body %}
{% include 'parts/head.html' %} <div class="container">
</head> <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> {% endfor %}
</tr>
<div class="container"> </tbody>
<div class="table-responsive"> </table>
<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>
</div> </div>
{% include 'parts/footer.html' %} </div>
</body> {% endblock body %}
</html>

View file

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

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">