Actualización del 2025-08-16 a las 17:45:53
This commit is contained in:
parent
b26e9ad87f
commit
db6fa3d2c3
5 changed files with 232 additions and 165 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import re # <-- CORRECCIÓN: Se importa el módulo de expresiones regulares
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import logging
|
import logging
|
||||||
import feedparser
|
import feedparser
|
||||||
|
|
@ -14,8 +15,6 @@ def process_single_feed(feed_data):
|
||||||
"""
|
"""
|
||||||
feed_id = feed_data['id']
|
feed_id = feed_data['id']
|
||||||
feed_url = feed_data['url']
|
feed_url = feed_data['url']
|
||||||
# --- LÍNEA CLAVE ---
|
|
||||||
# Obtenemos el nombre del feed para usarlo como fuente de la noticia.
|
|
||||||
feed_nombre = feed_data.get('nombre', 'Fuente Desconocida')
|
feed_nombre = feed_data.get('nombre', 'Fuente Desconocida')
|
||||||
etag = feed_data.get('last_etag')
|
etag = feed_data.get('last_etag')
|
||||||
modified = feed_data.get('last_modified')
|
modified = feed_data.get('last_modified')
|
||||||
|
|
@ -55,9 +54,19 @@ def process_single_feed(feed_data):
|
||||||
|
|
||||||
noticia_id = hashlib.md5(link.encode()).hexdigest()
|
noticia_id = hashlib.md5(link.encode()).hexdigest()
|
||||||
titulo = entry.get("title", "Sin título")
|
titulo = entry.get("title", "Sin título")
|
||||||
resumen_html = entry.get("summary", "")
|
|
||||||
imagen_url = ""
|
|
||||||
|
|
||||||
|
# --- MEJORA: Se prioriza el contenido completo sobre el resumen para obtener más texto ---
|
||||||
|
resumen_html = ""
|
||||||
|
if hasattr(entry, 'content') and entry.content:
|
||||||
|
resumen_html = entry.content[0].value
|
||||||
|
elif hasattr(entry, 'summary'):
|
||||||
|
resumen_html = entry.summary
|
||||||
|
|
||||||
|
# --- CORRECCIÓN: Limpia los códigos de media personalizados y otros artefactos ---
|
||||||
|
if resumen_html:
|
||||||
|
resumen_html = re.sub(r'\[\[\{.*?\}\]\]', '', resumen_html)
|
||||||
|
|
||||||
|
imagen_url = ""
|
||||||
if "media_content" in entry and entry.media_content:
|
if "media_content" in entry and entry.media_content:
|
||||||
imagen_url = entry.media_content[0].get("url", "")
|
imagen_url = entry.media_content[0].get("url", "")
|
||||||
elif resumen_html:
|
elif resumen_html:
|
||||||
|
|
@ -67,14 +76,13 @@ def process_single_feed(feed_data):
|
||||||
imagen_url = img_tag['src']
|
imagen_url = img_tag['src']
|
||||||
|
|
||||||
resumen_texto_plano = BeautifulSoup(resumen_html, 'html.parser').get_text(separator=' ', strip=True)
|
resumen_texto_plano = BeautifulSoup(resumen_html, 'html.parser').get_text(separator=' ', strip=True)
|
||||||
|
|
||||||
fecha_publicacion = datetime.now()
|
fecha_publicacion = datetime.now()
|
||||||
if hasattr(entry, 'published_parsed') and entry.published_parsed:
|
if hasattr(entry, 'published_parsed') and entry.published_parsed:
|
||||||
fecha_publicacion = datetime(*entry.published_parsed[:6])
|
fecha_publicacion = datetime(*entry.published_parsed[:6])
|
||||||
elif hasattr(entry, 'updated_parsed') and entry.updated_parsed:
|
elif hasattr(entry, 'updated_parsed') and entry.updated_parsed:
|
||||||
fecha_publicacion = datetime(*entry.updated_parsed[:6])
|
fecha_publicacion = datetime(*entry.updated_parsed[:6])
|
||||||
|
|
||||||
# --- LÍNEA CLAVE ---
|
|
||||||
# Añadimos 'feed_nombre' a la tupla de datos que se guardará en la BD.
|
|
||||||
noticias_encontradas.append(
|
noticias_encontradas.append(
|
||||||
(noticia_id, titulo, resumen_texto_plano, link, fecha_publicacion,
|
(noticia_id, titulo, resumen_texto_plano, link, fecha_publicacion,
|
||||||
imagen_url, feed_nombre, feed_data['categoria_id'], feed_data['pais_id'])
|
imagen_url, feed_nombre, feed_data['categoria_id'], feed_data['pais_id'])
|
||||||
|
|
@ -92,4 +100,3 @@ def process_single_feed(feed_data):
|
||||||
logging.error(f"Excepción inesperada al procesar el feed {feed_url} (ID: {feed_id}): {e}", exc_info=True)
|
logging.error(f"Excepción inesperada al procesar el feed {feed_url} (ID: {feed_id}): {e}", exc_info=True)
|
||||||
|
|
||||||
return feed_id, noticias_encontradas, new_etag, new_modified, success
|
return feed_id, noticias_encontradas, new_etag, new_modified, success
|
||||||
|
|
||||||
|
|
|
||||||
171
static/style.css
Normal file
171
static/style.css
Normal file
|
|
@ -0,0 +1,171 @@
|
||||||
|
/* --- Variables Globales de Diseño --- */
|
||||||
|
:root {
|
||||||
|
--primary-color: #6a11cb;
|
||||||
|
--secondary-color: #2575fc;
|
||||||
|
--gradiente-principal: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
|
||||||
|
--error-color: #f72585;
|
||||||
|
--text-color: #2c3e50;
|
||||||
|
--text-color-light: #576475;
|
||||||
|
--card-bg: rgba(255, 255, 255, 0.75);
|
||||||
|
--border-color: rgba(200, 200, 220, 0.4);
|
||||||
|
--shadow-color: rgba(67, 97, 238, 0.15);
|
||||||
|
--border-radius-md: 12px;
|
||||||
|
--border-radius-sm: 8px;
|
||||||
|
--transition-speed: 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- Estilos Base --- */
|
||||||
|
* { box-sizing: border-box; }
|
||||||
|
body {
|
||||||
|
font-family: 'Poppins', 'Segoe UI', Tahoma, sans-serif;
|
||||||
|
margin: 0;
|
||||||
|
padding: 20px 0;
|
||||||
|
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
||||||
|
color: var(--text-color);
|
||||||
|
line-height: 1.6;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- Contenedor Principal con Efecto Vidrio --- */
|
||||||
|
.container {
|
||||||
|
max-width: 900px;
|
||||||
|
margin: 30px auto;
|
||||||
|
padding: 30px 40px;
|
||||||
|
background: var(--card-bg);
|
||||||
|
border-radius: 20px;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||||
|
box-shadow: 0 8px 32px 0 var(--shadow-color);
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
|
-webkit-backdrop-filter: blur(12px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- Encabezados y Títulos --- */
|
||||||
|
header { text-align: center; margin-bottom: 40px; border-bottom: 1px solid var(--border-color); padding-bottom: 30px; }
|
||||||
|
h1 { font-size: 2.8rem; font-weight: 700; margin: 0 0 5px 0; background: var(--gradiente-principal); -webkit-background-clip: text; -webkit-text-fill-color: transparent; display: inline-block; }
|
||||||
|
h2 { font-size: 1.8rem; font-weight: 600; color: var(--primary-color); margin-bottom: 20px; }
|
||||||
|
.subtitle { color: var(--text-color-light); font-size: 1.1rem; margin-top: 5px; }
|
||||||
|
|
||||||
|
/* --- Formularios y Controles --- */
|
||||||
|
.form-section, .card { margin-bottom: 30px; background: rgba(255, 255, 255, 0.6); padding: 25px; border-radius: var(--border-radius-md); border: 1px solid var(--border-color); }
|
||||||
|
label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--text-color); font-size: 0.9rem; }
|
||||||
|
select, input[type="text"], input[type="url"], input[type="file"], textarea { width: 100%; padding: 12px 15px; border: 1px solid var(--border-color); background-color: #f8f9fa; border-radius: var(--border-radius-sm); font-size: 1rem; font-family: 'Poppins', sans-serif; transition: all var(--transition-speed) ease; }
|
||||||
|
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--shadow-color); background-color: white; }
|
||||||
|
|
||||||
|
/* --- Botones y Enlaces --- */
|
||||||
|
.btn, button { padding: 12px 25px; background: var(--gradiente-principal); color: white !important; border: none; border-radius: var(--border-radius-sm); font-size: 1rem; font-weight: 600; cursor: pointer; transition: all var(--transition-speed) ease; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); text-decoration: none; display: inline-block; text-align: center; }
|
||||||
|
.btn:hover, button:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2); text-decoration: none; }
|
||||||
|
.btn-secondary { background: #34495e; } .btn-secondary:hover { background: #2c3e50; }
|
||||||
|
.btn-info { background: #17a2b8; } .btn-info:hover { background: #138496; }
|
||||||
|
.btn-danger { background: #dc3545; } .btn-danger:hover { background: #c82333; }
|
||||||
|
.btn-small { padding: 6px 14px; font-size: 0.9rem; }
|
||||||
|
a { color: var(--secondary-color); text-decoration: none; font-weight: 500; } a:hover { text-decoration: underline; }
|
||||||
|
.top-link { display: inline-block; margin-bottom: 25px; font-weight: 500; color: var(--primary-color); }
|
||||||
|
.top-link:hover { text-decoration: underline; }
|
||||||
|
|
||||||
|
/* --- Estilos para la lista de noticias --- */
|
||||||
|
.noticias-list { list-style: none; padding: 0; margin: 0; }
|
||||||
|
.noticia-item { display: flex; gap: 20px; padding: 20px 10px; border-bottom: 1px solid var(--border-color); transition: background-color 0.2s ease; }
|
||||||
|
.noticia-item:last-child { border-bottom: none; }
|
||||||
|
.noticia-item:hover { background-color: rgba(255,255,255,0.4); }
|
||||||
|
.noticia-imagen img { width: 150px; height: 100px; border-radius: var(--border-radius-sm); object-fit: cover; }
|
||||||
|
.noticia-texto h3 { margin: 0 0 5px 0; }
|
||||||
|
.noticia-texto h3 a { color: var(--text-color); font-weight: 600; }
|
||||||
|
.noticia-texto h3 a:hover { color: var(--primary-color); }
|
||||||
|
.noticia-meta { font-size: 0.8rem; color: var(--text-color-light); margin-bottom: 8px; }
|
||||||
|
|
||||||
|
/* --- Alertas y Mensajes Flash --- */
|
||||||
|
.flash-messages { list-style: none; padding: 0; margin-bottom: 20px; }
|
||||||
|
.flash-messages li { padding: 15px 20px; border-radius: var(--border-radius-sm); border-left: 5px solid; }
|
||||||
|
.flash-messages .error { background-color: #fff0f3; color: #d90429; border-color: var(--error-color); }
|
||||||
|
.flash-messages .success { background-color: #e6fcf5; color: #00b894; border-color: #00b894; }
|
||||||
|
.flash-messages .warning { background-color: #fffbeb; color: #f39c12; border-color: #f39c12; }
|
||||||
|
|
||||||
|
/* --- Estilos para Dashboard y Paginación --- */
|
||||||
|
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 40px; }
|
||||||
|
.stat-card { background: rgba(255, 255, 255, 0.8); padding: 20px; border-radius: var(--border-radius-md); text-align: center; border: 1px solid var(--border-color); transition: all 0.3s ease; }
|
||||||
|
.stat-card:hover { transform: translateY(-5px); box-shadow: 0 4px 15px rgba(0,0,0,0.08); }
|
||||||
|
.stat-card .stat-number { font-size: 2.5rem; font-weight: 600; background: var(--gradiente-principal); -webkit-background-clip: text; -webkit-text-fill-color: transparent; line-height: 1.2; }
|
||||||
|
.stat-card .stat-label { font-size: 0.9rem; color: var(--text-color-light); font-weight: 500; margin-top: 5px; }
|
||||||
|
.pagination { display: flex; justify-content: center; align-items: center; gap: 5px; margin: 30px 0; flex-wrap: wrap; }
|
||||||
|
.page-link { display: inline-block; padding: 8px 14px; background: rgba(255, 255, 255, 0.6); border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); color: var(--primary-color); text-decoration: none; transition: all 0.2s ease; }
|
||||||
|
.page-link:hover { background: white; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
|
||||||
|
.page-link.active { background: var(--gradiente-principal); color: white; border-color: transparent; cursor: default; }
|
||||||
|
.feed-detail-card { padding: 0; }
|
||||||
|
.feed-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; background: rgba(233, 236, 239, 0.5); padding: 15px 25px; border-bottom: 1px solid var(--border-color); }
|
||||||
|
.feed-header h2 { margin: 0; font-size: 1.4rem; }
|
||||||
|
.feed-body { padding: 25px; }
|
||||||
|
.feed-body dl { display: grid; grid-template-columns: 120px 1fr; gap: 10px 20px; }
|
||||||
|
.feed-body dt { font-weight: 600; color: var(--text-color-light); }
|
||||||
|
.feed-body dd { margin: 0; word-break: break-all; }
|
||||||
|
|
||||||
|
/* --- Estilos para la Navegación Principal --- */
|
||||||
|
.main-nav {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: 15px;
|
||||||
|
margin-top: 25px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
padding-top: 15px;
|
||||||
|
}
|
||||||
|
.nav-link {
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--text-color);
|
||||||
|
text-decoration: none;
|
||||||
|
padding: 8px 15px;
|
||||||
|
border-radius: var(--border-radius-sm);
|
||||||
|
transition: all var(--transition-speed);
|
||||||
|
}
|
||||||
|
.nav-link:hover {
|
||||||
|
background-color: rgba(255,255,255,0.6);
|
||||||
|
text-decoration: none;
|
||||||
|
color: var(--primary-color);
|
||||||
|
}
|
||||||
|
.nav-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- Responsividad --- */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.container { padding: 20px; margin: 15px; }
|
||||||
|
h1 { font-size: 2rem; }
|
||||||
|
.noticia-item { flex-direction: column; }
|
||||||
|
.feed-body dl { grid-template-columns: 100px 1fr; }
|
||||||
|
.main-nav { flex-direction: column; gap: 10px; }
|
||||||
|
.nav-actions { margin-left: 0; margin-top: 10px; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- Estilos para el botón Ver Más --- */
|
||||||
|
.resumen-container {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.ver-mas-btn {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
color: var(--primary-color);
|
||||||
|
font-weight: bold;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 5px 0;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
.ver-mas-btn:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- Estilos para la fila principal del formulario de filtros --- */
|
||||||
|
.filter-main-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
gap: 15px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.filter-search-box {
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
.filter-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
@ -11,11 +11,9 @@
|
||||||
<div class="noticia-meta">
|
<div class="noticia-meta">
|
||||||
<span><i class="far fa-calendar-alt"></i> {{ noticia.fecha.strftime('%d-%m-%Y %H:%M') if noticia.fecha else 'N/D' }}</span>
|
<span><i class="far fa-calendar-alt"></i> {{ noticia.fecha.strftime('%d-%m-%Y %H:%M') if noticia.fecha else 'N/D' }}</span>
|
||||||
|
|
||||||
<!-- INICIO DE LA MODIFICACIÓN: Se añade la fuente de la noticia -->
|
|
||||||
{% if noticia.fuente_nombre %}
|
{% if noticia.fuente_nombre %}
|
||||||
| <span><i class="fas fa-newspaper"></i> <strong>{{ noticia.fuente_nombre }}</strong></span>
|
| <span><i class="fas fa-newspaper"></i> <strong>{{ noticia.fuente_nombre }}</strong></span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<!-- FIN DE LA MODIFICACIÓN -->
|
|
||||||
|
|
||||||
{% if noticia.categoria %}
|
{% if noticia.categoria %}
|
||||||
| <span><i class="fas fa-tag"></i> {{ noticia.categoria }}</span>
|
| <span><i class="fas fa-tag"></i> {{ noticia.categoria }}</span>
|
||||||
|
|
@ -25,8 +23,19 @@
|
||||||
| <span><i class="fas fa-globe-americas"></i> {{ noticia.pais }}</span>
|
| <span><i class="fas fa-globe-americas"></i> {{ noticia.pais }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<p>{{ noticia.resumen | safe_html | truncate(280) }}</p>
|
|
||||||
</div>
|
<div class="resumen-container">
|
||||||
|
<div class="resumen-corto">
|
||||||
|
{{ noticia.resumen | safe_html | truncate(280, True) }}
|
||||||
|
</div>
|
||||||
|
<div class="resumen-completo" style="display: none;">
|
||||||
|
{{ noticia.resumen | safe_html }}
|
||||||
|
</div>
|
||||||
|
{% if noticia.resumen|length > 280 %}
|
||||||
|
<button class="ver-mas-btn">Ver más</button>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li class="text-center p-4">
|
<li class="text-center p-4">
|
||||||
|
|
@ -34,4 +43,3 @@
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,157 +10,15 @@
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
|
||||||
|
|
||||||
<style>
|
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||||
/* --- Variables Globales de Diseño --- */
|
|
||||||
:root {
|
|
||||||
--primary-color: #6a11cb;
|
|
||||||
--secondary-color: #2575fc;
|
|
||||||
--gradiente-principal: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
|
|
||||||
--error-color: #f72585;
|
|
||||||
--text-color: #2c3e50;
|
|
||||||
--text-color-light: #576475;
|
|
||||||
--card-bg: rgba(255, 255, 255, 0.75);
|
|
||||||
--border-color: rgba(200, 200, 220, 0.4);
|
|
||||||
--shadow-color: rgba(67, 97, 238, 0.15);
|
|
||||||
--border-radius-md: 12px;
|
|
||||||
--border-radius-sm: 8px;
|
|
||||||
--transition-speed: 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --- Estilos Base --- */
|
|
||||||
* { box-sizing: border-box; }
|
|
||||||
body {
|
|
||||||
font-family: 'Poppins', 'Segoe UI', Tahoma, sans-serif;
|
|
||||||
margin: 0;
|
|
||||||
padding: 20px 0;
|
|
||||||
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
|
||||||
color: var(--text-color);
|
|
||||||
line-height: 1.6;
|
|
||||||
font-weight: 400;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --- Contenedor Principal con Efecto Vidrio --- */
|
|
||||||
.container {
|
|
||||||
max-width: 900px;
|
|
||||||
margin: 30px auto;
|
|
||||||
padding: 30px 40px;
|
|
||||||
background: var(--card-bg);
|
|
||||||
border-radius: 20px;
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
||||||
box-shadow: 0 8px 32px 0 var(--shadow-color);
|
|
||||||
backdrop-filter: blur(12px);
|
|
||||||
-webkit-backdrop-filter: blur(12px);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --- Encabezados y Títulos --- */
|
|
||||||
header { text-align: center; margin-bottom: 40px; border-bottom: 1px solid var(--border-color); padding-bottom: 30px; }
|
|
||||||
h1 { font-size: 2.8rem; font-weight: 700; margin: 0 0 5px 0; background: var(--gradiente-principal); -webkit-background-clip: text; -webkit-text-fill-color: transparent; display: inline-block; }
|
|
||||||
h2 { font-size: 1.8rem; font-weight: 600; color: var(--primary-color); margin-bottom: 20px; }
|
|
||||||
.subtitle { color: var(--text-color-light); font-size: 1.1rem; margin-top: 5px; }
|
|
||||||
|
|
||||||
/* --- Formularios y Controles --- */
|
|
||||||
.form-section, .card { margin-bottom: 30px; background: rgba(255, 255, 255, 0.6); padding: 25px; border-radius: var(--border-radius-md); border: 1px solid var(--border-color); }
|
|
||||||
label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--text-color); font-size: 0.9rem; }
|
|
||||||
select, input[type="text"], input[type="url"], input[type="file"], textarea { width: 100%; padding: 12px 15px; border: 1px solid var(--border-color); background-color: #f8f9fa; border-radius: var(--border-radius-sm); font-size: 1rem; font-family: 'Poppins', sans-serif; transition: all var(--transition-speed) ease; }
|
|
||||||
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--shadow-color); background-color: white; }
|
|
||||||
|
|
||||||
/* --- Botones y Enlaces --- */
|
|
||||||
.btn, button { padding: 12px 25px; background: var(--gradiente-principal); color: white !important; border: none; border-radius: var(--border-radius-sm); font-size: 1rem; font-weight: 600; cursor: pointer; transition: all var(--transition-speed) ease; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); text-decoration: none; display: inline-block; text-align: center; }
|
|
||||||
.btn:hover, button:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2); text-decoration: none; }
|
|
||||||
.btn-secondary { background: #34495e; } .btn-secondary:hover { background: #2c3e50; }
|
|
||||||
.btn-info { background: #17a2b8; } .btn-info:hover { background: #138496; }
|
|
||||||
.btn-danger { background: #dc3545; } .btn-danger:hover { background: #c82333; }
|
|
||||||
.btn-small { padding: 6px 14px; font-size: 0.9rem; }
|
|
||||||
a { color: var(--secondary-color); text-decoration: none; font-weight: 500; } a:hover { text-decoration: underline; }
|
|
||||||
.top-link { display: inline-block; margin-bottom: 25px; font-weight: 500; color: var(--primary-color); }
|
|
||||||
.top-link:hover { text-decoration: underline; }
|
|
||||||
|
|
||||||
/* --- Estilos para la lista de noticias --- */
|
|
||||||
.noticias-list { list-style: none; padding: 0; margin: 0; }
|
|
||||||
.noticia-item { display: flex; gap: 20px; padding: 20px 10px; border-bottom: 1px solid var(--border-color); transition: background-color 0.2s ease; }
|
|
||||||
.noticia-item:last-child { border-bottom: none; }
|
|
||||||
.noticia-item:hover { background-color: rgba(255,255,255,0.4); }
|
|
||||||
.noticia-imagen img { width: 150px; height: 100px; border-radius: var(--border-radius-sm); object-fit: cover; }
|
|
||||||
.noticia-texto h3 { margin: 0 0 5px 0; }
|
|
||||||
.noticia-texto h3 a { color: var(--text-color); font-weight: 600; }
|
|
||||||
.noticia-texto h3 a:hover { color: var(--primary-color); }
|
|
||||||
.noticia-meta { font-size: 0.8rem; color: var(--text-color-light); margin-bottom: 8px; }
|
|
||||||
|
|
||||||
/* --- Alertas y Mensajes Flash --- */
|
|
||||||
.flash-messages { list-style: none; padding: 0; margin-bottom: 20px; }
|
|
||||||
.flash-messages li { padding: 15px 20px; border-radius: var(--border-radius-sm); border-left: 5px solid; }
|
|
||||||
.flash-messages .error { background-color: #fff0f3; color: #d90429; border-color: var(--error-color); }
|
|
||||||
.flash-messages .success { background-color: #e6fcf5; color: #00b894; border-color: #00b894; }
|
|
||||||
.flash-messages .warning { background-color: #fffbeb; color: #f39c12; border-color: #f39c12; }
|
|
||||||
|
|
||||||
/* --- Estilos para Dashboard y Paginación --- */
|
|
||||||
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 40px; }
|
|
||||||
.stat-card { background: rgba(255, 255, 255, 0.8); padding: 20px; border-radius: var(--border-radius-md); text-align: center; border: 1px solid var(--border-color); transition: all 0.3s ease; }
|
|
||||||
.stat-card:hover { transform: translateY(-5px); box-shadow: 0 4px 15px rgba(0,0,0,0.08); }
|
|
||||||
.stat-card .stat-number { font-size: 2.5rem; font-weight: 600; background: var(--gradiente-principal); -webkit-background-clip: text; -webkit-text-fill-color: transparent; line-height: 1.2; }
|
|
||||||
.stat-card .stat-label { font-size: 0.9rem; color: var(--text-color-light); font-weight: 500; margin-top: 5px; }
|
|
||||||
.pagination { display: flex; justify-content: center; align-items: center; gap: 5px; margin: 30px 0; flex-wrap: wrap; }
|
|
||||||
.page-link { display: inline-block; padding: 8px 14px; background: rgba(255, 255, 255, 0.6); border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); color: var(--primary-color); text-decoration: none; transition: all 0.2s ease; }
|
|
||||||
.page-link:hover { background: white; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
|
|
||||||
.page-link.active { background: var(--gradiente-principal); color: white; border-color: transparent; cursor: default; }
|
|
||||||
.feed-detail-card { padding: 0; }
|
|
||||||
.feed-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; background: rgba(233, 236, 239, 0.5); padding: 15px 25px; border-bottom: 1px solid var(--border-color); }
|
|
||||||
.feed-header h2 { margin: 0; font-size: 1.4rem; }
|
|
||||||
.feed-body { padding: 25px; }
|
|
||||||
.feed-body dl { display: grid; grid-template-columns: 120px 1fr; gap: 10px 20px; }
|
|
||||||
.feed-body dt { font-weight: 600; color: var(--text-color-light); }
|
|
||||||
.feed-body dd { margin: 0; word-break: break-all; }
|
|
||||||
|
|
||||||
/* --- Estilos para la Navegación Principal --- */
|
|
||||||
.main-nav {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
gap: 15px;
|
|
||||||
margin-top: 25px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
padding-top: 15px;
|
|
||||||
}
|
|
||||||
.nav-link {
|
|
||||||
font-weight: 500;
|
|
||||||
color: var(--text-color);
|
|
||||||
text-decoration: none;
|
|
||||||
padding: 8px 15px;
|
|
||||||
border-radius: var(--border-radius-sm);
|
|
||||||
transition: all var(--transition-speed);
|
|
||||||
}
|
|
||||||
.nav-link:hover {
|
|
||||||
background-color: rgba(255,255,255,0.6);
|
|
||||||
text-decoration: none;
|
|
||||||
color: var(--primary-color);
|
|
||||||
}
|
|
||||||
.nav-actions {
|
|
||||||
display: flex;
|
|
||||||
gap: 10px;
|
|
||||||
margin-left: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --- Responsividad --- */
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.container { padding: 20px; margin: 15px; }
|
|
||||||
h1 { font-size: 2rem; }
|
|
||||||
.noticia-item { flex-direction: column; }
|
|
||||||
.feed-body dl { grid-template-columns: 100px 1fr; }
|
|
||||||
.main-nav { flex-direction: column; gap: 10px; }
|
|
||||||
.nav-actions { margin-left: 0; margin-top: 10px; }
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<!-- SECCIÓN DE CABECERA Y NAVEGACIÓN -->
|
|
||||||
<header>
|
<header>
|
||||||
<a href="{{ url_for('home') }}" style="text-decoration:none;">
|
<a href="{{ url_for('home') }}" style="text-decoration:none;">
|
||||||
<h1>Agregador de Noticias</h1>
|
<h1>Noticias</h1>
|
||||||
</a>
|
</a>
|
||||||
<p class="subtitle">Tu centro de información personalizado</p>
|
|
||||||
|
|
||||||
<!-- NAVEGACIÓN SIMPLIFICADA -->
|
|
||||||
<nav class="main-nav">
|
<nav class="main-nav">
|
||||||
<a href="{{ url_for('home') }}" class="nav-link">Noticias</a>
|
<a href="{{ url_for('home') }}" class="nav-link">Noticias</a>
|
||||||
<a href="{{ url_for('dashboard') }}" class="nav-link">Dashboard</a>
|
<a href="{{ url_for('dashboard') }}" class="nav-link">Dashboard</a>
|
||||||
|
|
@ -181,6 +39,25 @@
|
||||||
|
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.addEventListener('click', function(event) {
|
||||||
|
if (event.target.classList.contains('ver-mas-btn')) {
|
||||||
|
const container = event.target.closest('.resumen-container');
|
||||||
|
const corto = container.querySelector('.resumen-corto');
|
||||||
|
const completo = container.querySelector('.resumen-completo');
|
||||||
|
|
||||||
|
if (completo.style.display === 'none') {
|
||||||
|
corto.style.display = 'none';
|
||||||
|
completo.style.display = 'block';
|
||||||
|
event.target.textContent = 'Ver menos';
|
||||||
|
} else {
|
||||||
|
corto.style.display = 'block';
|
||||||
|
completo.style.display = 'none';
|
||||||
|
event.target.textContent = 'Ver más';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,18 @@
|
||||||
<h2><i class="fas fa-filter" style="color: var(--secondary-color); margin-right: 10px;"></i>Filtrar Noticias</h2>
|
<h2><i class="fas fa-filter" style="color: var(--secondary-color); margin-right: 10px;"></i>Filtrar Noticias</h2>
|
||||||
<form method="get" action="{{ url_for('home') }}" id="filter-form">
|
<form method="get" action="{{ url_for('home') }}" id="filter-form">
|
||||||
|
|
||||||
<div style="margin-bottom: 20px;">
|
<div class="filter-main-row">
|
||||||
<label for="q">Buscar por palabra clave</label>
|
|
||||||
<input type="search" name="q" id="q" placeholder="Ej: Trump, California, IA..." value="{{ q or '' }}">
|
<div class="filter-search-box">
|
||||||
|
<label for="q">Buscar por palabra clave</label>
|
||||||
|
<input type="search" name="q" id="q" placeholder="Ej: Trump, California, IA..." value="{{ q or '' }}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="filter-actions">
|
||||||
|
<button type="submit" class="btn"><i class="fas fa-search"></i> Filtrar</button>
|
||||||
|
<a href="{{ url_for('home') }}" class="btn btn-secondary"><i class="fas fa-eraser"></i> Limpiar</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px; align-items: flex-end; border-top: 1px solid var(--border-color); padding-top: 20px;">
|
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px; align-items: flex-end; border-top: 1px solid var(--border-color); padding-top: 20px;">
|
||||||
<div>
|
<div>
|
||||||
|
|
@ -45,10 +54,6 @@
|
||||||
<label for="fecha">Fecha</label>
|
<label for="fecha">Fecha</label>
|
||||||
<input type="date" name="fecha" id="fecha" value="{{ fecha_filtro or '' }}">
|
<input type="date" name="fecha" id="fecha" value="{{ fecha_filtro or '' }}">
|
||||||
</div>
|
</div>
|
||||||
<div style="display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px;">
|
|
||||||
<button type="submit" class="btn"><i class="fas fa-search"></i> Filtrar</button>
|
|
||||||
<a href="{{ url_for('home') }}" class="btn btn-secondary"><i class="fas fa-eraser"></i> Limpiar</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -108,4 +113,3 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue