Primer commit del proyecto RSS
This commit is contained in:
commit
27c9515d29
1568 changed files with 252311 additions and 0 deletions
82
templates/noticias.html
Normal file
82
templates/noticias.html
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Últimas Noticias RSS</title>
|
||||
<script>
|
||||
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>Últimas Noticias Recopiladas</h1>
|
||||
<p><a href="/">← Volver a feeds</a></p>
|
||||
|
||||
<form method="get" action="/noticias">
|
||||
<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>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue