diff --git a/app.py b/app.py index f5397c5..d1fd420 100644 --- a/app.py +++ b/app.py @@ -166,20 +166,30 @@ def _build_news_query(args, *, count=False, limit=None, offset=None, lang="es", SELECT COALESCE(t.traduccion_id, NULL) AS traduccion_id, n.fecha, - COALESCE(t.titulo_trad, n.titulo) AS titulo, - COALESCE(t.resumen_trad, n.resumen) AS resumen, + n.titulo AS titulo_original, + n.resumen AS resumen_original, + t.titulo_trad AS titulo_traducido, + t.resumen_trad AS resumen_traducido, + COALESCE(t.titulo_trad, n.titulo) AS titulo, + COALESCE(t.resumen_trad, n.resumen) AS resumen, n.url, n.imagen_url, n.fuente_nombre, c.nombre AS categoria, p.nombre AS pais, co.nombre AS continente, - (t.titulo_trad IS NOT NULL OR t.resumen_trad IS NOT NULL) AS usa_trad + (t.titulo_trad IS NOT NULL OR t.resumen_trad IS NOT NULL) AS tiene_traduccion """ else: select_cols = """ SELECT - NULL::int AS traduccion_id, - n.fecha, n.titulo, n.resumen, + NULL::int AS traduccion_id, + n.fecha, + n.titulo AS titulo_original, + n.resumen AS resumen_original, + NULL::text AS titulo_traducido, + NULL::text AS resumen_traducido, + n.titulo AS titulo, + n.resumen AS resumen, n.url, n.imagen_url, n.fuente_nombre, c.nombre AS categoria, p.nombre AS pais, co.nombre AS continente, - FALSE AS usa_trad + FALSE AS tiene_traduccion """ order_clause = " ORDER BY n.fecha DESC NULLS LAST" diff --git a/static/style.css b/static/style.css index bfc869a..2957eb4 100644 --- a/static/style.css +++ b/static/style.css @@ -159,4 +159,39 @@ a { color: var(--secondary-color); text-decoration: none; font-weight: 500; } a: max-height: none; overflow: visible; } +/* Pestañas por noticia */ +.tabs { width: 100%; } +.tabs-header { display: flex; gap: 8px; margin-bottom: 8px; } +.tab-btn { + background: rgba(255,255,255,0.7); + border: 1px solid var(--border-color); + border-radius: 999px; + padding: 6px 12px; + font-weight: 600; + cursor: pointer; +} +.tab-btn.active { + background: var(--gradiente-principal); + color: #fff !important; + border-color: transparent; +} +.tab-btn[disabled] { + opacity: .45; + cursor: not-allowed; +} +.tab-panel { display: none; } +.tab-panel.active { display: block; } +.badge { + display: inline-block; + margin-left: 8px; + font-size: .75rem; + padding: 2px 8px; + border-radius: 999px; + background: #e8f0ff; + color: var(--secondary-color); + vertical-align: middle; +} +.badge-secondary { background: #f1f3f5; color: #555; } +.mini-link { margin-left: 8px; font-size: .8rem; } +.m0 { margin: 0 0 6px 0; } diff --git a/templates/_noticias_list.html b/templates/_noticias_list.html index 1f986c5..0e00215 100644 --- a/templates/_noticias_list.html +++ b/templates/_noticias_list.html @@ -1,56 +1,89 @@