Cambio de deseño na paxina de Erro 404.

This commit is contained in:
Laegnur 2024-11-14 18:42:06 +01:00
parent edc87ea5fb
commit 0996d18920
Signed by: laegnur
GPG key ID: F8FE83A0B2D932A3
6 changed files with 719 additions and 73 deletions

View file

@ -1,25 +1,34 @@
<?php namespace ProcessWire; <?php namespace ProcessWire;
/** @var Page $page API variable */ /** @var Page $page */
/** @var Pages $pages */
/** @var Config $config */
/** @var Sanitizer $sanitizer API variable */
/** @var WireInput $input API variable */
/** @var User $user API variable */
/** @var Languages $languages API variable */
/** @var SiteConfig $configuracion */
/** @var HomePage $inicio */
$atopar = $sanitizer->text($input->get('q')); $atopar = $sanitizer->text($input->get('q'));
$menu = ''; $menu = '';
$contido = '';
if($configuracion['mantemento']['activo'] && !$user->isLoggedin()) if($configuracion['mantemento']['activo'] && !$user->isLoggedin())
{ {
$session->redirect($inicio->url); $menu = renderMenu($inicio->and($pages->get('/noticias')->and($pages->get('/contacto'))));
} }
else else
{ {
$menu = renderMenu($inicio->children); $menu = renderMenu($inicio->and($inicio->children));
} }
?>
$contido .= renderMigasPan($page) . "\n"; <main id="contido" class="completo">
$contido .= '<article id="' . $page->name .'" class="container">' . "\n"; <nav id="migas" aria-label="<?=_x("Breadcrumb", "Breadcrumb");?>">
$contido .= '<h2 class="visually-hidden">' . ucfirst($page->title) . '</h2>' . "\n"; <?=renderMigasPan($page);?>
</nav>
<?php
if($atopar) if($atopar)
{ {
$input->whitelist('q', $atopar); $input->whitelist('q', $atopar);
@ -36,38 +45,58 @@ if($atopar)
if($cnt) if($cnt)
{ {
$contido .= '<h3>Resultados para: ' . $atopar . '</h3>' . "\n"; ?>
$contido .= '<p>' . sprintf(_n(_x('Found %d page', 'found 1 page'), <article id="<?=$page->name;?>">
_x('Found %d pages', 'found multiple pages'), $cnt), $cnt) . '</p>' . "\n"; <h1 class="visually-hidden"><?=ucfirst($page->title);?></h1>
$contido .= '<section>' . "\n"; <h2>Resultados para: <?=$atopar;?></h2>
$contido .= '<h4 class="accesibilidade-oculto">' . _x("Search results", "search results") . '</h4>' . "\n"; <p><?=sprintf(_n(_x('Found %d page', 'found 1 page'),_x('Found %d pages', 'found multiple pages'), $cnt), $cnt);?></p>
$contido .= '<ul class="lista">'."\n"; <section>
foreach($matches as $paxina) <h3 class="accesibilidade-oculto"><?=_x("Search results", "search results");?></h3>
{ <ul class="lista">
$contido .= '<li class="info">' . "\n"; <?php foreach($matches as $paxina): ?>
$contido .= '<a href="' . $paxina->url . '"><i class="icon-play"></i> ' . $paxina->title . '</a>' . "\n"; <li class="info">
$contido .= '</li>' . "\n"; <a href="<?=$paxina->url;?>"><i class="icon-play"></i> <?=$paxina->title;?></a>
} </li>
$contido .= '</ul>'."\n"; <?php endforeach;?>
$contido .= '</section>'; </ul>
</section>
</article>
<?php
} }
else else
{ {
$contido .= '<h3>' . _x('Sitemap', 'sitemap') . '</h3>' . "\n"; ?>
$contido .= '<p>' . _x('Sorry, no results were found', 'no results found') . '.</p>' . "\n"; <article id="<?=$page->name;?>" class="destacado">
$contido .= '<section>' . "\n"; <h1 class="visually-hidden"><?=ucfirst($page->title);?></h1>
$contido .= '<h4 class="accesibilidade-oculto">' . _x('Sitemap', 'sitemap') . '</h4>' . "\n"; <h2><?=_x('Sitemap', 'sitemap');?></h3>
$contido .= renderMapaDoSitio($inicio, 3, 'mapa-sitio'); <p><?=_x('Sorry, no results were found', 'no results found');?>.</p>
$contido .= '</section>'; <section>
<h3 class="accesibilidade-oculto"><?=_x('Sitemap', 'sitemap');?></h3>
<nav id="mapa-sitio">
<?=renderMapaDoSitio($inicio, 3);?>
</nav>
</section>
</article>
<?php
} }
} }
else else
{ {
$contido .= '<h3>' . _x('Sitemap', 'sitemap') . '</h3>' . "\n"; ?>
$contido .= '<p>' . _x('Sorry, no results were found', 'no results found') . '.</p>' . "\n"; <article id="<?=$page->name;?>" class="destacado">
$contido .= '<section>' . "\n"; <h1 class="visually-hidden"><?=ucfirst($page->title);?></h1>
$contido .= '<h4 class="accesibilidade-oculto">' . _x('Sitemap', 'sitemap') . '</h4>' . "\n"; <h2><?=_x('Sitemap', 'sitemap');?></h3>
$contido .= renderMapaDoSitio($inicio, 3, 'mapa-sitio'); <p><?=_x('Sorry, no results were found', 'no results found');?>.</p>
$contido .= '</section>'; <section>
<h3 class="accesibilidade-oculto"><?=_x('Sitemap', 'sitemap');?></h3>
<nav id="mapa-sitio">
<?=renderMapaDoSitio($inicio, 3);?>
</nav>
</section>
</article>
<?php
} }
$contido .= '</article>' . "\n"; ?>
</main>
<?php

View file

@ -35,6 +35,7 @@ $etiquetas = pages()->get('/noticias/etiquetas/')->children();
<?=renderCategoriasEtiquetas($etiquetas);?> <?=renderCategoriasEtiquetas($etiquetas);?>
</aside> </aside>
<div> <div>
<h2 class="visually-hidden"><?=_x('Posts', 'posts');?></h2>
<?php <?php
if($page->numChildren) if($page->numChildren)
{ {

View file

@ -1,3 +1,13 @@
<?php namespace ProcessWire; <?php namespace ProcessWire;
/** @var Page $page */
/** @var Pages $pages */
/** @var Config $config */
/** @var Sanitizer $sanitizer API variable */
/** @var WireInput $input API variable */
/** @var User $user API variable */
/** @var Languages $languages API variable */
/** @var SiteConfig $configuracion */
/** @var HomePage $inicio */
$session->redirect($pages->get('/es/noticias/')->url); $session->redirect($pages->get('/es/noticias/')->url);

View file

@ -1,7 +1,14 @@
:root :root
{ {
--separacion: 1rem;
--contido-max: 60rem;
--destacado-max: 75rem;
--destacado: calc((var(--destacado-max) - var(--contido-max)) / 2);
--titulos: ui-rounded, 'Hiragino Maru Gothic ProN', Quicksand, Comfortaa, Manjari, 'Arial Rounded MT', 'Arial Rounded MT Bold', Calibri, source-sans-pro, sans-serif; --titulos: ui-rounded, 'Hiragino Maru Gothic ProN', Quicksand, Comfortaa, Manjari, 'Arial Rounded MT', 'Arial Rounded MT Bold', Calibri, source-sans-pro, sans-serif;
--corpo: Avenir, Montserrat, Corbel, 'URW Gothic', source-sans-pro, sans-serif; --corpo: Avenir, Montserrat, Corbel, 'URW Gothic', source-sans-pro, sans-serif;
--color-accent: #005399;
--color-accent-tint: #FFF;
} }
*, *::before, *::after *, *::before, *::after
@ -151,7 +158,15 @@ p,
figcaption figcaption
{ {
max-width: 65ch; max-width: 65ch;
}
p
{
margin: 0 0 var(--separacion);
}
figcaption
{
margin-inline: auto; margin-inline: auto;
} }
@ -220,6 +235,7 @@ ol
{ {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap;
margin: 0; margin: 0;
@ -1095,6 +1111,117 @@ section.noticias img
width: 100%; width: 100%;
} }
nav#mapa-sitio
{
text-align: left;
}
nav#mapa-sitio ul
{
display: block;
margin: 0 0 0 var(--separacion);
padding: 0;
list-style: none;
}
nav#mapa-sitio ul > li
{
display: flex;
flex-direction: row;
align-items: flex-start;
margin: 0 0 calc(var(--separacion) / 2);
position: relative;
}
nav#mapa-sitio ul > li:before
{
left: calc(-1 * var(--separacion) / 2);
position: absolute;
top: 1rem;
height: 1px;
width: calc(var(--separacion) / 2);
background: rgb(var(--cor_10));
content: "";
}
nav#mapa-sitio ul > li:first-child:before
{
left: calc(-1 * var(--separacion));
width: var(--separacion);
}
nav#mapa-sitio ul li:after
{
bottom: 0;
left: calc((var(--separacion) / 2) - var(--separacion));
position: absolute;
top: calc(-1 * var(--separacion));
width: 1px;
background: rgb(var(--cor_10));
content: "";
}
nav#mapa-sitio ul li:first-child:after
{
top: 1rem;
}
nav#mapa-sitio ul li:last-child:after
{
bottom: auto;
height: calc(var(--separacion) + 1em);
}
nav#mapa-sitio ul li:only-child:after
{
display: none;
}
nav#mapa-sitio small
{
position: relative;
font-size: 0.8rem;
line-height: 1.5rem;
}
nav#mapa-sitio a
{
display: block;
width: 200px;
padding: 0.5rem;
border-radius: 3px;
line-height: 1.5rem;
text-decoration: none;
transition: background-color 0.4s;
}
nav#mapa-sitio a,
nav#mapa-sitio a:visited
{
color: rgb(var(--cor_60));
background: rgb(var(--cor_30));
}
footer#pe footer#pe
{ {
padding-block: 1.5rem; padding-block: 1.5rem;
@ -1197,6 +1324,8 @@ footer#pe p#desenrolo
.centrado, .centrado,
.align_center .align_center
{ {
margin-inline: auto;
text-align: center; text-align: center;
} }
@ -1252,6 +1381,43 @@ footer#pe p#desenrolo
color: rgb(var(--cor_60)); color: rgb(var(--cor_60));
} }
@media only screen and (max-width: 576px)
{
nav#mapa-sitio > ul > li ul li
{
flex-direction: column;
}
nav#mapa-sitio > ul > li ul li ul
{
margin-top: calc(var(--separacion)/2);
}
nav#mapa-sitio > ul > li > ul li:after
{
left: calc(-1 * var(--separacion)/2);
}
nav#mapa-sitio > ul > li > ul > li li:first-child:before
{
left: calc(-1 * var(--separacion)/2);
width: calc(var(--separacion)/2);
}
nav#mapa-sitio > ul > li > ul > li li:first-child:after
{
top: calc(-1 * var(--separacion)/2);
}
nav#mapa-sitio > ul > li > ul > li li:only-child:after
{
display: block;
height: calc(var(--separacion)/2 + 1em);
}
}
@media (min-width: 640px) @media (min-width: 640px)
{ {
section[id^="reixa-"], section[id^="reixa-"],
@ -1391,6 +1557,43 @@ footer#pe p#desenrolo
} }
} }
@media only screen and (max-width: 768px)
{
nav#mapa-sitio > ul > li > ul > li ul li
{
flex-direction: column;
}
nav#mapa-sitio > ul > li > ul > li ul li ul
{
margin-top: calc(var(--separacion)/2);
}
nav#mapa-sitio > ul > li > ul > li > ul li:after
{
left: calc(-1 * var(--separacion)/2);
}
nav#mapa-sitio > ul > li > ul > li > ul > li li:first-child:before
{
left: calc(-1 * var(--separacion)/2);
width: calc(var(--separacion)/2);
}
nav#mapa-sitio > ul > li > ul > li > ul > li li:first-child:after
{
top: calc(-1 * var(--separacion)/2);
}
nav#mapa-sitio > ul > li > ul > li > ul > li li:only-child:after
{
display: block;
height: calc(var(--separacion)/2 + 1em);
}
}
@media (min-width: 1024px) @media (min-width: 1024px)
{ {
@ -1495,4 +1698,413 @@ footer#pe p#desenrolo
{ {
from {transform:scale(0)} from {transform:scale(0)}
to {transform:scale(1)} to {transform:scale(1)}
} }
/**/
/*
#mapa-sitio
{
clear: both;
width: 100%;
margin-top: 3em;
}
#mapa-sitio #home
{
position: absolute;
margin-top: -3em;
margin-bottom: 0;
min-width: 11.5em;
width: 100%;
}
#mapa-sitio #home:before
{
display: none;
}
#mapa-sitio ul
{
display: flex;
flex-wrap: wrap;
list-style: none;
position: relative;
}
#mapa-sitio li
{
flex: 1;
flex-basis: 11.5em;
padding-right: 1.25em;
position: relative;
}
#mapa-sitio > ul > li
{
margin-top: 3em;
}
#mapa-sitio li a
{
margin: 0;
padding: .875em .9375em .9375em .9375em;
display: block;
font-size: .9375em;
font-weight: bold;
color: #000;
background: #c3eafb;
text-shadow: 0 0 10px rgba(0,0,0,.1);
border: 2px solid #b5d9ea;
box-shadow: 0px 2px 1px rgba(0,0,0,0.15);
text-decoration: none;
}
#mapa-sitio li a:hover
{
border-color: #97bdcf;
background-color: #e2f4fd;
}
#mapa-sitio ul ul
{
display: block;
}
#mapa-sitio ul ul li
{
padding-top: .6875em;
padding-right: 0;
}
#mapa-sitio ul ul li a
{
border-color: #b8da83;
background-color: #cee3ac;
}
#mapa-sitio ul ul li a:hover
{
border-color: #94b75f;
background-color: #e7f1d7;
}
#mapa-sitio ul ul li:first-child
{
padding-top: 2em;
}
#mapa-sitio ul ul ul
{
margin-top: .6em;
padding-top: .6em;
padding-bottom: .625em;
}
#mapa-sitio ul ul ul li
{
padding-top: .3125em;
padding-bottom: .3125em;
}
#mapa-sitio ul ul ul li a
{
width: 90%;
margin-right: 0;
margin-left: auto;
padding: .75em;
border-color: #e3ca4b;
font-size: .75em;
background-color: #fff7aa;
}
#mapa-sitio ul ul ul li a:hover
{
border-color: #d1b62c;
background-color: #fffce5;
}
#mapa-sitio ul ul ul li:first-child
{
padding-top: 1em;
}
#mapa-sitio ul ul ul li a:link:after,
#mapa-sitio ul ul ul li a:visited:after
{
font-size: .75em;
}
#mapa-sitio ul ul ul ul
{
margin-top: 0;
padding-top: .3125em;
padding-bottom: .3125em;
}
#mapa-sitio ul ul ul ul li a
{
width: 80%;
padding: .75em ;
background-color: #de003a;
}
#mapa-sitio ul ul ul ul li a:hover
{
background-color: #c20035;
}
#mapa-sitio ul ul ul ul li a:link:after,
#mapa-sitio ul ul ul ul li a:visited:after
{
display: none;
}
#mapa-sitio ul:before,
#mapa-sitio ul:after,
#mapa-sitio ul li:before,
#mapa-sitio ul li:after
{
display: block;
position: absolute;
z-index: -1;
border-width: 0;
border-color: #e3e3e3;
border-style: solid;
content: '';
}
#mapa-sitio > ul > li:before
{
top: -1.375em;
right: calc(50% + .625em);
height: 1.375em;
width: calc(100% - 2px);
border-top-width: 2px;
border-right-width: 2px;
}
#mapa-sitio > ul > li:first-child + li:before
{
top: -5em;
height: 5em;
border-top-width: 0;
}
#mapa-sitio ul ul li:after
{
top: 0;
right: 1px;
width: 50%;
height: .6875em;
border-left-width: 2px;
}
#mapa-sitio ul ul li:first-child:before
{
top: .6875em;
right: 1px;
width: 50%;
height: 1.3125em;
border-left-width: 2px;
}
#mapa-sitio > ul > li:last-child:after
{
border-bottom-width: 0;
}
#mapa-sitio ul ul ul li:before
{
top: -50%;
left: 0;
width: calc(50% - 5px) !important;
height: calc(100% - 2px);
border-left-width: 2px;
border-bottom-width: 2px;
}
#mapa-sitio ul ul ul li:first-child:before
{
top: -1px;
height: 2.125em;
border-top-width: 2px;
}
#mapa-sitio ul ul ul:before
{
top: -10px;
right: 1px;
width: 50%;
height: 1.25em;
border-left-width: 2px;
}
#mapa-sitio ul ul ul li:after
{
border-width: 0;
}
#mapa-sitio ul ul ul ul li:before,
#mapa-sitio ul ul ul ul li:first-child:before
{
display: none;
}
#mapa-sitio ul ul ul ul:before
{
top: -2.5em;
left: 0;
width: 1px;
height: calc(100% + 2.5em);
border-left-width: 2px;
}
#mapa-herramientas
{
float: right;
max-width: 48%;
margin-top: 0;
margin-bottom: -.25em;
margin-right: 1.25em;
list-style-type: none;
}
#mapa-herramientas li
{
display: inline-block;
padding: 0 0 .625em .625em;
}
#mapa-herramientas li:first-child
{
}
#mapa-herramientas li a
{
display: block;
padding: .75em 1em;
border: 2px solid #e3ca4b;
box-shadow: 0px 2px 0 rgba(0,0,0,0.15);
color: #000;
font-size: .75em;
font-weight: 700;
text-align: left;
text-decoration: none;
text-shadow: 0 0 10px rgba(0,0,0,.15);
background-color: #fff7aa;
}
#mapa-herramientas li a:hover
{
border-color: #d1b62c;
background-color: #fffce5;
}
#mapa-herramientas li a:link:after,
#mapa-herramientas li a:visited:after
{
margin-top: .25em;
color: #ccae14;
font-size: .75em;
font-weight: 600;
}
@media (max-width: 64opx)
{
#mapa-sitio ul
{
display: block;
}
#mapa-sitio li
{
width: 100%;
padding-right: 0;
}
#mapa-sitio #home
{
position: relative;
width: 100%;
margin-bottom: -1em;
margin-top: 0;
}
#mapa-herramientas
{
display: block;
float: none;
width: 100%;
max-width: 100%;
margin-bottom: 2.5em;
text-align: right;
}
}
@media (min-width: 640px)
{
#mapa-sitio > ul > li
{
max-width: 33%;
}
}
@media (min-width: 1024px)
{
#mapa-sitio > ul > li
{
max-width: 20%;
}
}
*/

View file

@ -283,6 +283,36 @@ function renderMigasPan($paxina, $separador = '<i class="icon-chevrons-right"></
return $paxinacion; return $paxinacion;
} }
/**
* @param array|PageArray $paxinas
* @param int $profundidade How many levels of navigation below current should it go?
* @param string $class CSS class name for containing <ul>
* @return string
*
*/
function renderMapaDoSitio($paxinas, $profundidade = 0)
{
$saida = '';
if($paxinas instanceof Page) $paxinas = array($paxinas);
$saida .= '<ul>';
foreach($paxinas as $paxina)
{
$saida .= '<li>';
$saida .= '<a href="' . $paxina->url . '">' . ucwords($paxina->title) . '</a>';
if($paxina->hasChildren() && $profundidade)
{
$saida .= renderMapaDoSitio($paxina->children(), $profundidade-1);
}
$saida .= "</li>";
}
$saida .= '</ul>';
return $saida;
}
/** /**
* @param string $titulo * @param string $titulo
* @param string $texto * @param string $texto
@ -680,38 +710,7 @@ function renderArtigos($publicacion, $locale, $resumen = true)
/** Rehacer */ /** Rehacer */
/**
* @param array|PageArray $paxinas
* @param int $maxDepth How many levels of navigation below current should it go?
* @param string $fieldNames Any extra field names to display (separate multiple fields with a space)
* @param string $class CSS class name for containing <ul>
* @return string
*
*/
function renderMapaDoSitio($paxinas, $profundidade = 0, $clase = 'nav')
{
$saida = '';
$actual = wire('page');
if($paxinas instanceof Page) $paxinas = array($paxinas);
foreach($paxinas as $paxina)
{
$saida .= '<li class="'. (($paxina->id == $actual->id) ? ' active' : '') . '">';
$saida .= "<a href='$paxina->url'>$paxina->title</a>";
if($paxina->hasChildren() && $profundidade)
{
if($clase == 'nav') $clase = 'nav nav-tree';
$saida .= renderMapaDoSitio($paxina->children, $profundidade-1, $clase);
}
$saida .= "</li>";
}
if($saida) $saida = '<ul class="' . $clase . '">' . $saida . '</ul>';
return $saida;
}
/** /**
* @param array|PageArray $seccion * @param array|PageArray $seccion

View file

@ -48,11 +48,6 @@ if($input->get->logout == true)
--cor_60: <?=$configuracion['cor_fondo']?>; --cor_60: <?=$configuracion['cor_fondo']?>;
--cor_30: <?=$configuracion['cor_principal']?>; --cor_30: <?=$configuracion['cor_principal']?>;
--cor_10: <?=$configuracion['cor_secundario']?>; --cor_10: <?=$configuracion['cor_secundario']?>;
--separacion: 1rem;
--contido-max: 60rem;
--destacado-max: 75rem;
--destacado: calc((var(--destacado-max) - var(--contido-max)) / 2);
} }
</style> </style>
<script src="<?=$config->urls->templates?>js/swiper-bundle.min.js"></script> <script src="<?=$config->urls->templates?>js/swiper-bundle.min.js"></script>