76 lines
2.6 KiB
HTML
76 lines
2.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="es">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Mis Feeds RSS</title>
|
|
<script>
|
|
// Script para filtrar países según continente elegido
|
|
function filtrarPaisesPorContinente() {
|
|
const continenteId = document.getElementById('continente_id').value;
|
|
const paises = JSON.parse(document.getElementById('paises-data').textContent);
|
|
const selectPais = document.getElementById('pais_id');
|
|
selectPais.innerHTML = '';
|
|
// Opción N/A siempre presente
|
|
const optionNA = document.createElement('option');
|
|
optionNA.value = '';
|
|
optionNA.textContent = '— N/A —';
|
|
selectPais.appendChild(optionNA);
|
|
paises.forEach(([id, nombre, contId]) => {
|
|
if (!continenteId || contId == continenteId) {
|
|
const opt = document.createElement('option');
|
|
opt.value = id;
|
|
opt.textContent = nombre;
|
|
selectPais.appendChild(opt);
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<h1>Feeds configurados</h1>
|
|
<p><a href="/noticias">📄 Ver últimas noticias</a></p>
|
|
|
|
<h2>Añadir un nuevo feed</h2>
|
|
<form action="/add" method="post">
|
|
<input name="nombre" placeholder="Nombre del feed" required>
|
|
<input name="url" placeholder="URL del RSS" required>
|
|
<select name="categoria_id" required>
|
|
<option value="">— Elige categoría —</option>
|
|
{% for cid, cnom in categorias %}
|
|
<option value="{{ cid }}">{{ cnom }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
<select name="continente_id" id="continente_id" onchange="filtrarPaisesPorContinente()">
|
|
<option value="">— Elige continente —</option>
|
|
{% for coid, conom in continentes %}
|
|
<option value="{{ coid }}">{{ conom }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
<select name="pais_id" id="pais_id">
|
|
<option value="">— N/A —</option>
|
|
{% for pid, pnom, contid in paises %}
|
|
<option value="{{ pid }}">{{ pnom }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
<button type="submit">Añadir</button>
|
|
<!-- Datos en JSON para el filtro dinámico de países -->
|
|
<script type="application/json" id="paises-data">{{ paises|tojson }}</script>
|
|
</form>
|
|
|
|
<h2>Lista de Feeds</h2>
|
|
<ul>
|
|
{% for id, nombre, url, categoria_id, pais_id, activo, cat_nom, pais_nom in feeds %}
|
|
<li>
|
|
<strong>{{ nombre }}</strong>
|
|
(<a href="{{ url }}" target="_blank">{{ url }}</a>)
|
|
— Categoría: {{ cat_nom or 'N/A' }}
|
|
— País: {{ pais_nom or 'N/A' }}
|
|
— Activo: {{ 'Sí' if activo else 'No' }}
|
|
</li>
|
|
{% else %}
|
|
<li>No hay feeds aún.</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</body>
|
|
</html>
|
|
|