Improve HTML

This commit is contained in:
2022-12-07 13:10:36 +01:00
parent 53d87b29b1
commit b60257f9e9
5 changed files with 133 additions and 70 deletions

View File

@ -1,24 +1,36 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block title %}Index{% endblock %} {% block title %}Index{% endblock %}
{% block content %} {% block content %}
<div class="p-2 mb-2 border border-dark rounded">
<form action="/add" method="post"> <form action="/add" method="post">
<label> {# Feed URL #}
<input type="text" name="feed_url" placeholder="Feed URL" class="form-control" aria-label="Feed url"> <div class="row mb-3">
</label> <label for="feed_url" class="col-sm-2 col-form-label">Feed URL</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="feed_url"
placeholder="https://www.reddit.com/r/FreeGameFindings.rss">
</div>
</div>
<div class="input-group mb-3"> {# Webhook dropdown #}
<label for="webhook_dropdown" class="input-group-text">Webhook</label> <div class="row mb-3">
<select class="form-select" aria-label="Default webhook" id="webhook_dropdown" <label for="webhook_dropdown" class="col-sm-2">Which webhook should we send entries to?</label>
name="webhook_dropdown"> <div class="col-sm-10">
<option selected>Choose...</option> <select class="col-auto form-select" id="webhook_dropdown" name="webhook_dropdown">
<option selected>Choose webhook...</option>
{% for hook in webhooks %} {% for hook in webhooks %}
<option value="{{ hook.name }}">{{ hook.name }}</option> <option value="{{ hook.name }}">{{ hook.name }}</option>
{% endfor %} {% endfor %}
</select> </select>
</div> </div>
<div class="form-text">You can add more feeds in the config file.</div>
<div class="input-group mb-3">
<input type="submit" value="Add feed">
</div> </div>
{# Submit button #}
<div class="col-auto">
<button type="submit" class="btn btn-primary">Add feed</button>
</div>
</form> </form>
</div>
{% endblock %} {% endblock %}

View File

@ -10,14 +10,20 @@
<title>RSS - {% block title %}{% endblock %}</title> <title>RSS - {% block title %}{% endblock %}</title>
{% endblock %} {% endblock %}
</head> </head>
<body class="bg-dark text-white"> <body class="text-white-50" style="background: #111111;">
{% include "nav.html" %} {% include "nav.html" %}
<div class="p-2 mb-2">
<div class="container-fluid"> <div class="container-fluid">
<div class="d-grid p-2">
{% block content %}{% endblock %} {% block content %}{% endblock %}
<footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top"> <footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top">
<p class="col-md-4 mb-0 text-muted">Made by <a href="https://github.com/TheLovinator1">TheLovinator</a></p> <p class="col-md-4 mb-0 text-muted">Made by <a class="text-muted" href="https://github
.com/TheLovinator1">TheLovinator</a>
</p>
<ul class="nav col-md-4 justify-content-end"> <ul class="nav col-md-4 justify-content-end">
<li class="nav-item"><a href="mailto:tlovinator@gmail.com" class="nav-link px-2 text-muted">Email</a></li> <li class="nav-item"><a href="mailto:tlovinator@gmail.com"
class="nav-link px-2 text-muted">Email</a>
</li>
<li class="nav-item"><a href="https://github.com/TheLovinator1/discord-rss-bot/issues" <li class="nav-item"><a href="https://github.com/TheLovinator1/discord-rss-bot/issues"
class="nav-link px-2 text-muted">Send an issue</a></li> class="nav-link px-2 text-muted">Send an issue</a></li>
<li class="nav-item"><a href="https://github.com/TheLovinator1/discord-rss-bot/issues" <li class="nav-item"><a href="https://github.com/TheLovinator1/discord-rss-bot/issues"
@ -25,6 +31,8 @@
</ul> </ul>
</footer> </footer>
</div> </div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4"
crossorigin="anonymous"> crossorigin="anonymous">

View File

@ -1,7 +1,8 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block title %}Feed{% endblock %} {% block title %}Feed{% endblock %}
{% block content %} {% block content %}
<a href="{{ feed.link }}"><h2>{{ feed.title }}</h2></a> <div class="p-2 mb-2">
<a class="text-muted" href="{{ feed.link }}"><h2>{{ feed.title }}</h2></a>
{% if feed.url %} Subtitle: {{ feed.subtitle }} <br> {% endif %} {% if feed.url %} Subtitle: {{ feed.subtitle }} <br> {% endif %}
{% if feed.url %} {{ feed.url }} <br> {% endif %} {% if feed.url %} {{ feed.url }} <br> {% endif %}
{% if feed.updated %} Updated: {{ feed.updated.strftime('%Y-%m-%d, %T') }} <br> {% endif %} {% if feed.updated %} Updated: {{ feed.updated.strftime('%Y-%m-%d, %T') }} <br> {% endif %}
@ -11,22 +12,58 @@
{% if feed.last_update %} Last update: {{ feed.last_update }} <br> {% endif %} {% if feed.last_update %} Last update: {{ feed.last_update }} <br> {% endif %}
{% if feed.last_exception %} Last exception: {{ feed.last_exception }} <br> {% endif %} {% if feed.last_exception %} Last exception: {{ feed.last_exception }} <br> {% endif %}
{% if not feed.updates_enabled %} <span style="color: red"> Updates disabled! </span> <br>{% endif %} {% if not feed.updates_enabled %} <span style="color: red"> Updates disabled! </span> <br>{% endif %}
</div>
<div class="p-2 mb-2 border border-dark rounded" style="background:#0F0F0F">
{% for entry in entries %} {% for entry in entries %}
{% if entry.read %} {# Only add <hr> if the entry is not the first one #}
<span style="color: #868686"> {% if loop.index > 1 %}
{% else %}
<span>
{% endif %}
<hr> <hr>
<a href="{{ entry.link }}"><h2>{{ entry.title }}</h2></a> {% endif %}
<a class="text-muted" href="{{ entry.link }}"><h2>{{ entry.title }}</h2></a>
By {{ entry.author }} <br> By {{ entry.author }} <br>
<br> <br>
{% if entry.published %} Published: {{ entry.published.strftime('%Y-%m-%d, %T') }} <br> {% endif %}
{% if entry.updated %} Updated: {{ entry.updated.strftime('%Y-%m-%d, %T') }} <br> {% endif %} {% if entry.published %}
Summary: {{ entry.summary }} <br> {# Published: 2022-12-07, 08:10:22 #}
{% if entry.read_modified %} Read modified: {{ entry.read_modified.strftime('%Y-%m-%d, %T') }} <br> {% endif %} Published: {{ entry.published.strftime('%Y-%m-%d, %T') }} <br>
</span> {% endif %}
{% if entry.updated %}
{# Updated: 2022-12-07, 08:10:22 #}
Updated: {{ entry.updated.strftime('%Y-%m-%d, %T') }} <br>
{% endif %}
{# Add a button to get the summary #}
<p>
{% if entry.summary %}
<a class="btn btn-primary" data-bs-toggle="collapse" href="#collapse_summary_{{ loop.index }}"
role="button">Summary</a>
{% endif %}
{% if entry.content %}
<a class="btn btn-primary" data-bs-toggle="collapse" href="#collapse_content_{{ loop.index }}"
role="button">Content</a>
{% endif %}
</p>
{% if entry.summary %}
{# This is hidden by default, it is only visible if we click the button from above #}
<div class="collapse" id="collapse_summary_{{ loop.index }}">
<div class="card card-body text-muted border border-dark" style="background: #111111;">
{{ entry.summary | safe }}
</div>
</div>
{% endif %}
{% if entry.content %}
{# This is hidden by default, it is only visible if we click the button from above #}
<div class="collapse" id="collapse_content_{{ loop.index }}">
<div class="card card-body text-muted border border-dark" style="background: #111111;">
{{ entry.content[0].value | safe }}
</div>
</div>
{% endif %}
{# Read modified: 2022-12-07, 08:25:25 #}
{% if entry.read_modified %} Read modified: {{ entry.read_modified.strftime('%Y-%m-%d, %T') }}
{% endif %}
{% endfor %} {% endfor %}
<form action="/check" method="post"> <form action="/check" method="post">
@ -40,4 +77,5 @@
Remove feed. Remove feed.
</button> </button>
</form> </form>
</div>
{% endblock %} {% endblock %}

View File

@ -9,10 +9,15 @@
<!-- Check if any feeds --> <!-- Check if any feeds -->
{% if feeds %} {% if feeds %}
{% for feed in feeds %} {% for feed in feeds %}
<p><a href="/feed/{{ feed.url }}">{{ feed.url }}</a></p> <p><a class="text-muted" href="/feed/{{ feed.url }}">{{ feed.url }}</a></p>
{% if feed.last_exception %}
<li class="text-danger">
Last exception: {{ feed.last_exception.type_name }}: {{ feed.last_exception.value_str }}
</li>
{% endif %}
{% endfor %} {% endfor %}
{% else %} {% else %}
<p>No feeds yet</p> <p>No feeds yet. Add one <a class="text-muted" href="/add">here</a>.</p>
{% endif %} {% endif %}
</ul> </ul>

View File

@ -1,4 +1,4 @@
<nav class="navbar navbar-expand-md navbar-dark bg-dark bg-gradient"> <nav class="navbar navbar-expand-md navbar-dark p-2 mb-3 border-bottom border-warning" style="background: #0F0F0F">
<div class="container-fluid"> <div class="container-fluid">
<button class="navbar-toggler ms-auto" type="button" data-bs-toggle="collapse" data-bs-target="#collapseNavbar"> <button class="navbar-toggler ms-auto" type="button" data-bs-toggle="collapse" data-bs-target="#collapseNavbar">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>