- Removes mailpoet_padded class from the last element in a column
This commit is contained in:
@@ -19,7 +19,7 @@ class Footer {
|
||||
}
|
||||
$template = '
|
||||
<tr>
|
||||
<td class="mailpoet_padded_header_footer mailpoet_footer" bgcolor="' . $element['styles']['block']['backgroundColor'] . '"
|
||||
<td class="mailpoet_header_footer_padded mailpoet_footer" bgcolor="' . $element['styles']['block']['backgroundColor'] . '"
|
||||
style="' . StylesHelper::getBlockStyles($element) . StylesHelper::getStyles($element['styles'], 'text') . '">
|
||||
' . $DOM->html() . '
|
||||
</td>
|
||||
|
@@ -19,7 +19,7 @@ class Header {
|
||||
}
|
||||
$template = '
|
||||
<tr>
|
||||
<td class="mailpoet_padded_header_footer mailpoet_header" bgcolor="' . $element['styles']['block']['backgroundColor'] . '"
|
||||
<td class="mailpoet_header_footer_padded mailpoet_header" bgcolor="' . $element['styles']['block']['backgroundColor'] . '"
|
||||
style="' . StylesHelper::getBlockStyles($element) . StylesHelper::getStyles($element['styles'], 'text') . '">
|
||||
' . $DOM->html() . '
|
||||
</td>
|
||||
|
@@ -10,7 +10,8 @@ class Renderer {
|
||||
$template = ($columns_count === 1) ?
|
||||
$this->getOneColumnTemplate($styles, $class) :
|
||||
$this->getMultipleColumnsTemplate($styles, $width, $alignment, $class);
|
||||
$result = array_map(function ($content) use ($template) {
|
||||
$result = array_map(function($content) use ($template) {
|
||||
$content = self::removePaddingFromLastElement($content);
|
||||
return $template['content_start'] . $content . $template['content_end'];
|
||||
}, $columns_data);
|
||||
$result = implode('', $result);
|
||||
@@ -75,4 +76,8 @@ class Renderer {
|
||||
</tr>';
|
||||
return $template;
|
||||
}
|
||||
|
||||
function removePaddingFromLastElement($element) {
|
||||
return preg_replace('/mailpoet_padded(?!.*mailpoet_padded)/ism', '', $element);
|
||||
}
|
||||
}
|
@@ -40,7 +40,7 @@
|
||||
padding-right: 20px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
.mailpoet_padded_header_footer {
|
||||
.mailpoet_header_footer_padded {
|
||||
padding: 10px 20px;
|
||||
}
|
||||
@media screen and (max-width: 599px) and (-webkit-min-device-pixel-ratio: 1) {
|
||||
|
@@ -105,6 +105,26 @@ class NewsletterRendererCest {
|
||||
expect($rendered_column_content)->equals($column_content);
|
||||
}
|
||||
|
||||
function itRemovesPaddingFromLastColumnElement() {
|
||||
$column_content = array('
|
||||
<tr><td class="mailpoet_padded"></td></tr>
|
||||
<tr><td class="mailpoet_padded"></td></tr>
|
||||
<tr><td class="mailpoet_padded"></td></tr>
|
||||
<tr><td class="mailpoet_padded"></td></tr>'
|
||||
);
|
||||
$column_styles = array(
|
||||
'block' => array(
|
||||
'backgroundColor' => "#999999"
|
||||
)
|
||||
);
|
||||
$rendered_column_content = $this->column_renderer->render(
|
||||
$column_styles,
|
||||
count($column_content),
|
||||
$column_content
|
||||
);
|
||||
expect(substr_count($rendered_column_content, 'mailpoet_padded'))->equals(3);
|
||||
}
|
||||
|
||||
function itRendersHeader() {
|
||||
$newsletter = json_decode($this->newsletter['body'], true);
|
||||
$template = $newsletter['content']['blocks'][0]['blocks'][0]['blocks'][0];
|
||||
|
Reference in New Issue
Block a user