1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 04:38:27 +01:00

Fixes #4750 - News image placeholder. Adds another news-grid layout.

This commit is contained in:
Cameron 2022-04-06 12:09:58 -07:00
parent af0a6a5924
commit 02a7e08902
4 changed files with 46 additions and 5 deletions

View File

@ -4564,7 +4564,7 @@ class e_parse
{
$path = $tp->replaceConstants($file, 'abs');
}
elseif (!empty($parm['legacy'])) // Search legacy path for image in a specific folder. No path, only file name provided.
elseif(!empty($parm['legacy']) && !empty($file)) // Search legacy path for image in a specific folder. No path, only file name provided.
{
$legacyPath = rtrim($parm['legacy'], '/') . '/' . $file;

View File

@ -9,7 +9,7 @@
*/
$NEWS_GRID_TEMPLATE['col-md-6']['start'] = '<div class="row news-grid-default news-menu-grid">';
$NEWS_GRID_TEMPLATE['col-md-6']['start'] = '<div class="row news-grid-default news-menu-grid gx-3">';
$NEWS_GRID_TEMPLATE['col-md-6']['featured'] = '<div class="row featured">
<div class="col-sm-12">
@ -67,7 +67,35 @@
$NEWS_GRID_TEMPLATE['col-md-3']['end'] = $NEWS_GRID_TEMPLATE['col-md-6']['end'];
// ---------------- col-lg-4 Bootstrap 5 only ---------------
$NEWS_GRID_TEMPLATE['col-lg-4']['start'] = $NEWS_GRID_TEMPLATE['col-md-6']['start'];
$NEWS_GRID_TEMPLATE['col-lg-4']['featured'] = $NEWS_GRID_TEMPLATE['col-md-6']['featured'];
$NEWS_GRID_TEMPLATE['col-lg-4']['end'] = $NEWS_GRID_TEMPLATE['col-md-6']['end'];
$NEWS_GRID_TEMPLATE['col-lg-4']['item'] = '{SETIMAGE: w=412&h=250&crop=1}
<div class="item col-lg-4 mb-5">
<div class="card h-100 shadow border-0">
{NEWS_IMAGE: type=tag&class=card-img-top&placeholder=1}
<div class="card-body p-4">
<div class="badge bg-primary bg-gradient rounded-pill mb-2">{NEWS_CATEGORY_NAME}</div>
<a class="text-decoration-none link-dark stretched-link" href="{NEWS_URL}">
<h5 class="card-title mb-3">{NEWS_TITLE}</h5></a>
<p class="card-text mb-0">{NEWS_SUMMARY}</p>
</div>
<div class="card-footer p-4 pt-0 bg-transparent border-top-0">
<div class="d-flex align-items-end justify-content-between">
<div class="d-flex align-items-center">
{NEWS_AUTHOR_AVATAR: class=rounded-circle me-3&w=40&h=40&crop=1}
<div class="small">
<div class="fw-bold">{NEWS_AUTHOR}</div>
<div class="text-muted">{NEWS_DATE=short}</div>
</div>
</div>
</div>
</div>
</div>
</div>
';
// ------------------ media-list -----------------
@ -109,6 +137,3 @@

View File

@ -2446,6 +2446,21 @@ EXPECTED;
}
// news image scenario with empty value.
$srcPath = '';
$imgParms = array(
'class' => 'news-image',
'alt' => 'placeholder image',
'style' => 'display:block',
'placeholder' => 1,
'legacy' => '{e_IMAGE}newspost_images',
'w' => 400,
'h' => 325
);
$result = $this->tp->toImage($srcPath, $imgParms);
$expected = '<img class="news-image" src="/thumb.php?src=&amp;w=400&amp;h=325" alt="placeholder image" width="400" height="325" style="display:block" />';
$this->assertSame($expected, $result);
}
public function testThumbSrcSet()

View File

@ -1839,6 +1839,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
try
{
/** @var e_shortcode $sc */
$sc = $this->make($plug.'_shortcodes');
}
catch (Exception $e)