News Hauteur paramétrable

This commit is contained in:
Fred Tempez 2021-04-01 18:00:49 +02:00
parent 7389f3026d
commit faf64a0660
4 changed files with 23 additions and 5 deletions

View File

@ -60,6 +60,12 @@ class news extends common {
]; ];
public static $nbrCol = 1; public static $nbrCol = 1;
public static $ItemsHeight = [
'200px' => 'Petit',
'300px' => 'Moyen',
'400px' => 'Grand'
];
/** /**
* Mise à jour du module * Mise à jour du module
@ -178,6 +184,7 @@ class news extends common {
'feedsLabel' => $this->getInput('newsConfigFeedslabel',helper::FILTER_STRING_SHORT), 'feedsLabel' => $this->getInput('newsConfigFeedslabel',helper::FILTER_STRING_SHORT),
'itemsperPage' => $this->getInput('newsConfigItemsperPage', helper::FILTER_INT,true), 'itemsperPage' => $this->getInput('newsConfigItemsperPage', helper::FILTER_INT,true),
'itemsperCol' => $this->getInput('newsConfigItemsperCol', helper::FILTER_INT,true), 'itemsperCol' => $this->getInput('newsConfigItemsperCol', helper::FILTER_INT,true),
'itemsHeight' => $this->getInput('newsConfigItemsHeight',helper::FILTER_STRING_SHORT),
'version' => $this->getData(['module', $this->getUrl(0), 'config', 'version']) 'version' => $this->getData(['module', $this->getUrl(0), 'config', 'version'])
]]); ]]);
// Valeurs en sortie // Valeurs en sortie

View File

@ -39,19 +39,25 @@
</div> </div>
<!-- Block ajouté pour le sélecteur --> <!-- Block ajouté pour le sélecteur -->
<div class="row"> <div class="row">
<div class="col6"> <div class="col4">
<?php echo template::select('newsConfigItemsperCol', $module::$Columns, [ <?php echo template::select('newsConfigItemsperCol', $module::$Columns, [
'label' => 'Pagination', 'label' => 'Pagination',
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol']), 'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol']),
'help' => 'Nombre de colonnes par page' 'help' => 'Nombre de colonnes par page'
]); ?> ]); ?>
</div> </div>
<div class="col6"> <div class="col4">
<?php echo template::select('newsConfigItemsperPage', $module::$ItemsList, [ <?php echo template::select('newsConfigItemsperPage', $module::$ItemsList, [
'label' => 'Articles par page', 'label' => 'Articles par page',
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']) 'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
]); ?> ]); ?>
</div> </div>
<div class="col4">
<?php echo template::select('newsConfigItemsHeight', $module::$ItemsHeight, [
'label' => 'Hauteur',
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsHeight'])
]); ?>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -21,6 +21,10 @@
background-color: #ECEFF1; background-color: #ECEFF1;
padding:5px; padding:5px;
}*/ }*/
.newsContent {
overflow: hidden; /* les dépassements seront masqués */
}
.newsContent { .newsContent {
clear: left; clear: left;
@ -66,3 +70,4 @@
.col3 {width: 100%;} .col3 {width: 100%;}
.col4 {width: 100%;} .col4 {width: 100%;}
} }

View File

@ -1,11 +1,11 @@
<?php if($module::$news): ?> <?php if($module::$news): ?>
<div class="row"> <div class="row">
<?php foreach($module::$news as $newsId => $news): ?> <?php foreach($module::$news as $newsId => $news): ?>
<div class="col<?php echo $module::$nbrCol ;?>" > <div class="col<?php echo $module::$nbrCol ;?>" >
<h1 class="newsTitle" id="<?php echo $newsId;?>"> <h1 class="newsTitle" id="<?php echo $newsId;?>">
<?php echo $news['title']; ?> <?php echo $news['title']; ?>
</h1> </h1>
<div class="newsContent"> <div class="newsContent" style="height:<?php echo $this->getData(['module', $this->getUrl(0),'config', 'itemsHeight']); ?>;">
<?php echo $news['content']; ?> <?php echo $news['content']; ?>
</div> </div>
<div class="newsSignature"> <div class="newsSignature">