Merge branch 'responsive_gallery' into dev10

This commit is contained in:
Fred Tempez 2020-04-16 22:36:08 +02:00
parent 48d3edac4f
commit 69e5d127cd
4 changed files with 62 additions and 37 deletions

View File

@ -17,8 +17,27 @@
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
padding: 10px; padding: 6px;
background: rgba(0, 0, 0, .6); background: rgba(0, 0, 0, .6);
color: #FFF; color: #FFF;
text-align: center; text-align: center;
} }
.galleryRow {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.colPicture {
width : 16em;
max-width: 50%;
margin: 0.5em;
}
@media (max-width: 432px) {
.colPicture {
width: 90%;
max-width: 90%;
margin: 0.5em;
}
}

View File

@ -8,26 +8,19 @@
]); ?> ]); ?>
</div> </div>
</div> </div>
<?php $i = 1; ?> <div class="row galleryRow">
<?php $picturesNb = count($module::$pictures); ?>
<?php foreach($module::$pictures as $picture => $legend): ?> <?php foreach($module::$pictures as $picture => $legend): ?>
<?php if($i % 4 === 1): ?> <div class="colPicture">
<div class="row"> <a
<?php endif; ?> href="<?php echo helper::baseUrl(false) . $picture; ?>"
<div class="col3"> class="galleryGalleryPicture"
<a style="background-image:url('<?php echo helper::baseUrl(false) . $module::$thumbs[$picture]; ?>')"
href="<?php echo helper::baseUrl(false) . $picture; ?>" data-caption="<?php echo $legend; ?>"
class="galleryGalleryPicture" >
style="background-image:url('<?php echo helper::baseUrl(false) . $module::$thumbs[$picture]; ?>')" <?php if($legend): ?>
data-caption="<?php echo $legend; ?>" <div class="galleryGalleryName"><?php echo $legend; ?></div>
> <?php endif; ?>
<?php if($legend): ?> </a>
<div class="galleryGalleryName"><?php echo $legend; ?></div> </div>
<?php endif; ?> <?php endforeach; ?>
</a> </div>
</div>
<?php if($i % 4 === 0 OR $i === $picturesNb): ?>
</div>
<?php endif; ?>
<?php $i++; ?>
<?php endforeach; ?>

View File

@ -1,7 +1,7 @@
.galleryPicture { .galleryPicture {
display: block; display: block;
border: 1px solid #DDD; border: 1px solid #DDD;
height: 200px; height: 150px;
background-size: cover; background-size: cover;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
@ -17,8 +17,27 @@
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
padding: 10px; padding: 6px;
background: rgba(0, 0, 0, .6); background: rgba(0, 0, 0, .6);
color: #FFF; color: #FFF;
text-align: center; text-align: center;
} }
.galleryRow {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.colPicture {
width : 16em;
max-width: 50%;
margin: 0.5em;
}
@media (max-width: 432px) {
.colPicture {
width: 90%;
max-width: 90%;
margin: 0.5em;
}
}

View File

@ -1,11 +1,8 @@
<?php if($module::$galleries): ?> <?php if($module::$galleries): ?>
<?php $i = 1; ?> <div class="row galleryRow">
<?php $galleriesNb = count($module::$galleries); ?>
<?php foreach($module::$galleries as $galleryId => $gallery): ?> <?php foreach($module::$galleries as $galleryId => $gallery): ?>
<?php if($i % 2 === 1): ?>
<div class="row"> <div class="colPicture" div="pos<?php echo $gallery['config']['position']; ?>" >
<?php endif; ?>
<div class="col6" div="pos<?php echo $gallery['config']['position']; ?>" >
<a <a
href="<?php echo helper::baseUrl() . $this->getUrl(0); ?>/<?php echo $galleryId; ?>" href="<?php echo helper::baseUrl() . $this->getUrl(0); ?>/<?php echo $galleryId; ?>"
class="galleryPicture" class="galleryPicture"
@ -14,11 +11,8 @@
<div class="galleryName"><?php echo $gallery['config']['name']; ?></div> <div class="galleryName"><?php echo $gallery['config']['name']; ?></div>
</a> </a>
</div> </div>
<?php if($i % 2 === 0 OR $i === $galleriesNb): ?>
</div>
<?php endif; ?>
<?php $i++; ?>
<?php endforeach; ?> <?php endforeach; ?>
</div>
<?php else: ?> <?php else: ?>
<?php echo template::speech('Aucune galerie.'); ?> <?php echo template::speech('Aucune galerie.'); ?>
<?php endif; ?> <?php endif; ?>