Cambio de rutas: ahora portada muestra noticias y gestión de feeds pasa a /feeds. Mejoras en navegación y backup.

This commit is contained in:
jlimolina 2025-05-26 17:50:55 +02:00
parent b3dc6a4ac2
commit d7cabbb2c6
5 changed files with 222 additions and 61 deletions

50
templates/edit_feed.html Normal file
View file

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>Editar Feed RSS</title>
</head>
<body>
<h1>Editar Feed</h1>
<form method="post">
<label>
Nombre del feed:<br>
<input name="nombre" placeholder="Nombre" value="{{ feed['nombre'] }}" required>
</label>
<br><br>
<label>
URL del RSS:<br>
<input name="url" placeholder="URL" value="{{ feed['url'] }}" required>
</label>
<br><br>
<label>
Categoría:<br>
<select name="categoria_id" required>
<option value="">— Elige categoría —</option>
{% for cat in categorias %}
<option value="{{ cat.id }}" {% if cat.id == feed['categoria_id'] %}selected{% endif %}>{{ cat.nombre }}</option>
{% endfor %}
</select>
</label>
<br><br>
<label>
País:<br>
<select name="pais_id" required>
<option value="">— Elige país —</option>
{% for p in paises %}
<option value="{{ p.id }}" {% if p.id == feed['pais_id'] %}selected{% endif %}>{{ p.nombre }}</option>
{% endfor %}
</select>
</label>
<br><br>
<label>
<input type="checkbox" name="activo" {% if feed['activo'] %}checked{% endif %}>
Activo
</label>
<br><br>
<button type="submit">Guardar cambios</button>
<a href="{{ url_for('index') }}">Cancelar</a>
</form>
</body>
</html>

View file

@ -2,7 +2,7 @@
<html lang="es">
<head>
<meta charset="utf-8">
<title>Mis Feeds RSS</title>
<title>Gestión de Feeds RSS</title>
<script>
// Script para filtrar países según continente elegido
function filtrarPaisesPorContinente() {
@ -27,8 +27,13 @@
</script>
</head>
<body>
<h1>Feeds configurados</h1>
<p><a href="/noticias">📄 Ver últimas noticias</a></p>
<h1>Gestión de Feeds RSS</h1>
<p><a href="/">← Volver a últimas noticias</a></p>
<!-- Enlace de backup de feeds -->
<p>
<a href="/backup_feeds" target="_blank">⬇️ Descargar backup de feeds (CSV)</a>
</p>
<h2>Añadir un nuevo feed</h2>
<form action="/add" method="post">
@ -66,11 +71,17 @@
— Categoría: {{ cat_nom or 'N/A' }}
— País: {{ pais_nom or 'N/A' }}
— Activo: {{ 'Sí' if activo else 'No' }}
<!-- Enlace de edición de feed -->
| <a href="/edit/{{ id }}">Editar</a>
<!-- Enlace para eliminar feed con confirmación -->
| <a href="/delete/{{ id }}" onclick="return confirm('¿Seguro que quieres eliminar este feed?');">Eliminar</a>
</li>
{% else %}
<li>No hay feeds aún.</li>
{% endfor %}
</ul>
<p><a href="/">← Volver a últimas noticias</a></p>
</body>
</html>

View file

@ -27,9 +27,11 @@
</head>
<body>
<h1>Últimas Noticias Recopiladas</h1>
<p><a href="/">← Volver a feeds</a></p>
<form method="get" action="/noticias">
<!-- 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 %}
@ -45,7 +47,7 @@
<select name="pais_id" id="pais_id">
<option value="">— País —</option>
{% for pid, pnom, contid in paises %}
<option value="{{ pid }}"
<option value="{{ pid }}"
{% if pais_id == pid %}selected{% endif %}
{% if cont_id and contid != cont_id %}style="display:none"{% endif %}>
{{ pnom }}
@ -77,6 +79,8 @@
<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>