cambios en la web
This commit is contained in:
parent
046a5ff369
commit
a9c1e16bdd
6 changed files with 283 additions and 131 deletions
|
|
@ -13,7 +13,11 @@
|
|||
<h3 style="margin:0 0 6px 0;">
|
||||
<a href="{{ noticia.url }}" target="_blank" rel="noopener noreferrer">{{ noticia.titulo }}</a>
|
||||
{% if use_tr %}
|
||||
<span class="badge" title="Mostrando traducciones por defecto" style="margin-left:8px;">Traducido</span>
|
||||
{% if noticia.usa_tr %}
|
||||
<span class="badge" title="Mostrando traducción">Traducido</span>
|
||||
{% else %}
|
||||
<span class="badge" title="Mostrando original">Original</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</h3>
|
||||
|
||||
|
|
@ -43,12 +47,7 @@
|
|||
|
||||
<div class="resumen-container">
|
||||
{% set resumen_txt = noticia.resumen | safe_html %}
|
||||
<div class="resumen-corto">
|
||||
{{ resumen_txt | truncate(280, True) }}
|
||||
</div>
|
||||
<div class="resumen-completo" style="display:none;">
|
||||
{{ resumen_txt }}
|
||||
</div>
|
||||
<div class="resumen clamp">{{ resumen_txt }}</div>
|
||||
{% if noticia.resumen and noticia.resumen|length > 280 %}
|
||||
<button class="ver-mas-btn" type="button">Ver más</button>
|
||||
{% endif %}
|
||||
|
|
@ -62,7 +61,6 @@
|
|||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{# Resumen y paginación #}
|
||||
{% if total_results and total_results > 0 %}
|
||||
<div style="text-align:center; margin-top:10px; color: var(--text-color-light);">
|
||||
{% set start_i = (page - 1) * per_page + 1 %}
|
||||
|
|
@ -75,12 +73,10 @@
|
|||
<nav class="pagination" aria-label="Paginación de noticias" style="margin-top:15px;">
|
||||
{% set current = page %}
|
||||
|
||||
{# Anterior #}
|
||||
{% if current > 1 %}
|
||||
<a href="#" class="page-link" data-page="{{ current - 1 }}">« Anterior</a>
|
||||
{% endif %}
|
||||
|
||||
{# Ventana de páginas (máx 5 alrededor) #}
|
||||
{% set start = 1 if current - 2 < 1 else current - 2 %}
|
||||
{% set end = total_pages if current + 2 > total_pages else current + 2 %}
|
||||
|
||||
|
|
@ -102,20 +98,19 @@
|
|||
<a href="#" class="page-link" data-page="{{ total_pages }}">{{ total_pages }}</a>
|
||||
{% endif %}
|
||||
|
||||
{# Siguiente #}
|
||||
{% if current < total_pages %}
|
||||
<a href="#" class="page-link" data-page="{{ current + 1 }}">Siguiente »</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
||||
{# Toggle "Ver más / Ver menos" con delegación; se liga una sola vez #}
|
||||
<script>
|
||||
(function () {
|
||||
if (window.__noticiasToggleBound) return;
|
||||
window.__noticiasToggleBound = true;
|
||||
|
||||
const container = document.getElementById('noticias-container') || document;
|
||||
|
||||
container.addEventListener('click', function (e) {
|
||||
const btn = e.target.closest('.ver-mas-btn');
|
||||
if (!btn) return;
|
||||
|
|
@ -123,14 +118,17 @@
|
|||
const wrap = btn.closest('.resumen-container');
|
||||
if (!wrap) return;
|
||||
|
||||
const corto = wrap.querySelector('.resumen-corto');
|
||||
const completo = wrap.querySelector('.resumen-completo');
|
||||
if (!corto || !completo) return;
|
||||
const resumen = wrap.querySelector('.resumen.clamp');
|
||||
if (!resumen) return;
|
||||
|
||||
const expanded = completo.style.display === 'block';
|
||||
completo.style.display = expanded ? 'none' : 'block';
|
||||
corto.style.display = expanded ? 'block' : 'none';
|
||||
btn.textContent = expanded ? 'Ver más' : 'Ver menos';
|
||||
const isExpanded = resumen.classList.contains('expanded');
|
||||
if (isExpanded) {
|
||||
resumen.classList.remove('expanded');
|
||||
btn.textContent = 'Ver más';
|
||||
} else {
|
||||
resumen.classList.add('expanded');
|
||||
btn.textContent = 'Ver menos';
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue