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 %}
<form action="/add" method="post"> <div class="p-2 mb-2 border border-dark rounded">
<label> <form action="/add" method="post">
<input type="text" name="feed_url" placeholder="Feed URL" class="form-control" aria-label="Feed url"> {# Feed URL #}
</label> <div class="row mb-3">
<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">
{% for hook in webhooks %} <option selected>Choose webhook...</option>
<option value="{{ hook.name }}">{{ hook.name }}</option> {% for hook in webhooks %}
{% endfor %} <option value="{{ hook.name }}">{{ hook.name }}</option>
</select> {% endfor %}
</div> </select>
</div>
<div class="form-text">You can add more feeds in the config file.</div>
</div>
<div class="input-group mb-3"> {# Submit button #}
<input type="submit" value="Add feed"> <div class="col-auto">
</div> <button type="submit" class="btn btn-primary">Add feed</button>
</form> </div>
</form>
</div>
{% endblock %} {% endblock %}

View File

@ -10,20 +10,28 @@
<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="container-fluid"> <div class="p-2 mb-2">
{% block content %}{% endblock %} <div class="container-fluid">
<footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top"> <div class="d-grid p-2">
<p class="col-md-4 mb-0 text-muted">Made by <a href="https://github.com/TheLovinator1">TheLovinator</a></p> {% block content %}{% endblock %}
<ul class="nav col-md-4 justify-content-end"> <footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top">
<li class="nav-item"><a href="mailto:tlovinator@gmail.com" class="nav-link px-2 text-muted">Email</a></li> <p class="col-md-4 mb-0 text-muted">Made by <a class="text-muted" href="https://github
<li class="nav-item"><a href="https://github.com/TheLovinator1/discord-rss-bot/issues" .com/TheLovinator1">TheLovinator</a>
class="nav-link px-2 text-muted">Send an issue</a></li> </p>
<li class="nav-item"><a href="https://github.com/TheLovinator1/discord-rss-bot/issues" <ul class="nav col-md-4 justify-content-end">
class="nav-link px-2 text-muted">Feature request</a></li> <li class="nav-item"><a href="mailto:tlovinator@gmail.com"
</ul> class="nav-link px-2 text-muted">Email</a>
</footer> </li>
<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>
<li class="nav-item"><a href="https://github.com/TheLovinator1/discord-rss-bot/issues"
class="nav-link px-2 text-muted">Feature request</a></li>
</ul>
</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"

View File

@ -1,43 +1,81 @@
{% 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">
{% if feed.url %} Subtitle: {{ feed.subtitle }} <br> {% endif %} <a class="text-muted" href="{{ feed.link }}"><h2>{{ feed.title }}</h2></a>
{% if feed.url %} {{ feed.url }} <br> {% endif %} {% if feed.url %} Subtitle: {{ feed.subtitle }} <br> {% endif %}
{% if feed.updated %} Updated: {{ feed.updated.strftime('%Y-%m-%d, %T') }} <br> {% endif %} {% if feed.url %} {{ feed.url }} <br> {% endif %}
{% if feed.version %} Version: {{ feed.version }} <br>{% endif %} {% if feed.updated %} Updated: {{ feed.updated.strftime('%Y-%m-%d, %T') }} <br> {% endif %}
{% if feed.user_title %} User title: {{ feed.user_title }} <br>{% endif %} {% if feed.version %} Version: {{ feed.version }} <br>{% endif %}
{% if feed.added %} Added on: {{ feed.added.strftime('%Y-%m-%d, %T') }} <br> {% endif %} {% if feed.user_title %} User title: {{ feed.user_title }} <br>{% endif %}
{% if feed.last_update %} Last update: {{ feed.last_update }} <br> {% endif %} {% if feed.added %} Added on: {{ feed.added.strftime('%Y-%m-%d, %T') }} <br> {% endif %}
{% if feed.last_exception %} Last exception: {{ feed.last_exception }} <br> {% endif %} {% if feed.last_update %} Last update: {{ feed.last_update }} <br> {% endif %}
{% if not feed.updates_enabled %} <span style="color: red"> Updates disabled! </span> <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 %}
</div>
<div class="p-2 mb-2 border border-dark rounded" style="background:#0F0F0F">
{% for entry in entries %}
{# Only add <hr> if the entry is not the first one #}
{% if loop.index > 1 %}
<hr>
{% endif %}
{% for entry in entries %} <a class="text-muted" href="{{ entry.link }}"><h2>{{ entry.title }}</h2></a>
{% if entry.read %} By {{ entry.author }} <br>
<span style="color: #868686"> <br>
{% else %}
<span>
{% endif %}
<hr>
<a href="{{ entry.link }}"><h2>{{ entry.title }}</h2></a>
By {{ entry.author }} <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 %}
Summary: {{ entry.summary }} <br>
{% if entry.read_modified %} Read modified: {{ entry.read_modified.strftime('%Y-%m-%d, %T') }} <br> {% endif %}
</span>
{% endfor %}
<form action="/check" method="post"> {% if entry.published %}
<button type="submit" name="feed_url" value="{{ feed.url }}"> {# Published: 2022-12-07, 08:10:22 #}
Send new entries to Discord. Published: {{ entry.published.strftime('%Y-%m-%d, %T') }} <br>
</button> {% endif %}
</form>
<form action="/remove" method="post"> {% if entry.updated %}
<button type="submit" name="feed_url" value="{{ feed.url }}"> {# Updated: 2022-12-07, 08:10:22 #}
Remove feed. Updated: {{ entry.updated.strftime('%Y-%m-%d, %T') }} <br>
</button> {% endif %}
</form>
{# 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 %}
<form action="/check" method="post">
<button type="submit" name="feed_url" value="{{ feed.url }}">
Send new entries to Discord.
</button>
</form>
<form action="/remove" method="post">
<button type="submit" name="feed_url" value="{{ feed.url }}">
Remove feed.
</button>
</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>