Añadida restauración de feeds desde CSV, mejoras en UI, y campo descripción en feeds
This commit is contained in:
parent
d7cabbb2c6
commit
4ca48836c9
6 changed files with 298 additions and 182 deletions
|
|
@ -1,8 +1,82 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Últimas Noticias RSS</title>
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Últimas Noticias RSS{% endblock %}
|
||||
{% block content %}
|
||||
<h1>Últimas Noticias Recopiladas</h1>
|
||||
<a href="/feeds" class="top-link">⚙️ Gestionar feeds RSS</a>
|
||||
|
||||
<div class="card">
|
||||
<form method="get" action="">
|
||||
<div style="display: flex; flex-wrap: wrap; gap: 12px;">
|
||||
<div style="flex:1;">
|
||||
<label for="categoria_id">Categoría</label>
|
||||
<select name="categoria_id" id="categoria_id">
|
||||
<option value="">— Categoría —</option>
|
||||
{% for cid, cnom in categorias %}
|
||||
<option value="{{ cid }}" {% if cat_id == cid %}selected{% endif %}>{{ cnom }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div style="flex:1;">
|
||||
<label for="continente_id">Continente</label>
|
||||
<select name="continente_id" id="continente_id" onchange="filtrarPaisesPorContinente()">
|
||||
<option value="">— Continente —</option>
|
||||
{% for coid, conom in continentes %}
|
||||
<option value="{{ coid }}" {% if cont_id == coid %}selected{% endif %}>{{ conom }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div style="flex:1;">
|
||||
<label for="pais_id">País</label>
|
||||
<select name="pais_id" id="pais_id">
|
||||
<option value="">— País —</option>
|
||||
{% for pid, pnom, contid in paises %}
|
||||
<option value="{{ pid }}"
|
||||
{% if pais_id == pid %}selected{% endif %}
|
||||
{% if cont_id and contid != cont_id %}style="display:none"{% endif %}>
|
||||
{{ pnom }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div style="align-self: flex-end;">
|
||||
<button class="btn" type="submit">Filtrar</button>
|
||||
</div>
|
||||
</div>
|
||||
<script type="application/json" id="paises-data">{{ paises|tojson }}</script>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2 style="margin-top:0;">Noticias recientes</h2>
|
||||
<ul style="list-style:none; padding:0;">
|
||||
{% for fecha, titulo, resumen, url, imagen_url, cat_nom, pais_nom, cont_nom in noticias %}
|
||||
<li style="margin-bottom: 2em; border-bottom: 1px solid #eee; padding-bottom: 1em;">
|
||||
<div style="display: flex; gap:18px;">
|
||||
{% if imagen_url %}
|
||||
<div>
|
||||
<img src="{{ imagen_url }}" alt="img" style="max-width:160px; max-height:100px; border-radius:6px;">
|
||||
</div>
|
||||
{% endif %}
|
||||
<div style="flex:1;">
|
||||
<div style="color:#64748b; font-size:0.97em;"><b>{{ fecha }}</b></div>
|
||||
<a href="{{ url }}" target="_blank"><strong>{{ titulo }}</strong></a><br>
|
||||
<span>{{ resumen|safe }}</span><br>
|
||||
<small style="color:#64748b;">
|
||||
Categoría: {{ cat_nom or 'N/A' }} |
|
||||
País: {{ pais_nom or 'N/A' }} |
|
||||
Continente: {{ cont_nom or 'N/A' }}
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{% else %}
|
||||
<li>No hay noticias que mostrar con estos filtros.</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<a href="/feeds" class="top-link">← Volver a gestión de feeds</a>
|
||||
|
||||
<script>
|
||||
function filtrarPaisesPorContinente() {
|
||||
const continenteId = document.getElementById('continente_id').value;
|
||||
|
|
@ -12,7 +86,7 @@
|
|||
// Opción N/A siempre presente
|
||||
const optionNA = document.createElement('option');
|
||||
optionNA.value = '';
|
||||
optionNA.textContent = '— N/A —';
|
||||
optionNA.textContent = '— País —';
|
||||
selectPais.appendChild(optionNA);
|
||||
paises.forEach(([id, nombre, contId]) => {
|
||||
if (!continenteId || contId == continenteId) {
|
||||
|
|
@ -24,63 +98,5 @@
|
|||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Últimas Noticias Recopiladas</h1>
|
||||
|
||||
<!-- Enlace de gestión de feeds -->
|
||||
<p><a href="/feeds">⚙️ Gestionar feeds RSS</a></p>
|
||||
|
||||
<form method="get" action="">
|
||||
<select name="categoria_id">
|
||||
<option value="">— Categoría —</option>
|
||||
{% for cid, cnom in categorias %}
|
||||
<option value="{{ cid }}" {% if cat_id == cid %}selected{% endif %}>{{ cnom }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<select name="continente_id" id="continente_id" onchange="filtrarPaisesPorContinente()">
|
||||
<option value="">— Continente —</option>
|
||||
{% for coid, conom in continentes %}
|
||||
<option value="{{ coid }}" {% if cont_id == coid %}selected{% endif %}>{{ conom }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<select name="pais_id" id="pais_id">
|
||||
<option value="">— País —</option>
|
||||
{% for pid, pnom, contid in paises %}
|
||||
<option value="{{ pid }}"
|
||||
{% if pais_id == pid %}selected{% endif %}
|
||||
{% if cont_id and contid != cont_id %}style="display:none"{% endif %}>
|
||||
{{ pnom }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<button type="submit">Filtrar</button>
|
||||
<script type="application/json" id="paises-data">{{ paises|tojson }}</script>
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
|
||||
<ul>
|
||||
{% for fecha, titulo, resumen, url, imagen_url, cat_nom, pais_nom, cont_nom in noticias %}
|
||||
<li style="margin-bottom: 2em;">
|
||||
<small><b>{{ fecha }}</b></small><br>
|
||||
<a href="{{ url }}" target="_blank"><strong>{{ titulo }}</strong></a><br>
|
||||
{% if imagen_url %}
|
||||
<img src="{{ imagen_url }}" alt="img" style="max-width:200px; max-height:120px;"><br>
|
||||
{% endif %}
|
||||
<span>{{ resumen|safe }}</span><br>
|
||||
<small>
|
||||
Categoría: {{ cat_nom or 'N/A' }} |
|
||||
País: {{ pais_nom or 'N/A' }} |
|
||||
Continente: {{ cont_nom or 'N/A' }}
|
||||
</small>
|
||||
</li>
|
||||
{% else %}
|
||||
<li>No hay noticias que mostrar con estos filtros.</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<p><a href="/feeds">← Volver a gestión de feeds</a></p>
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue