- Updates button height calculation

- Removes background color when it's set to "transparent"
- Removes second line break from paragraphs
- Introduces other changes based on Becks's testing
- Updates unit tests
This commit is contained in:
Vlad
2016-03-31 15:23:30 -04:00
parent 4486f9c5b0
commit 4f30158722
8 changed files with 51 additions and 31 deletions

View File

@@ -7,7 +7,6 @@ use MailPoet\Newsletter\Renderer\StylesHelper;
class Button {
static function render($element, $column_count) {
$element['styles']['block']['width'] = self::calculateWidth($element, $column_count);
$element['styles']['block']['height'] = self::calculateHeight($element);
$template = '
<tr>
<td class="mailpoet_padded_bottom mailpoet_padded_side" valign="top">
@@ -17,10 +16,10 @@ class Button {
<td class="mailpoet_button-container" style="padding:8px 20px;text-align:' . $element['styles']['block']['textAlign'] . ';"><!--[if mso]>
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word"
href="' . $element['url'] . '"
style="height:' . $element['styles']['block']['height'] . ';
style="height:' . $element['styles']['block']['lineHeight'] . ';
width:' . $element['styles']['block']['width'] . ';
v-text-anchor:middle;"
arcsize="' . round($element['styles']['block']['borderRadius'] / $element['styles']['block']['height'] * 100) . '%"
arcsize="' . round($element['styles']['block']['borderRadius'] / $element['styles']['block']['lineHeight'] * 100) . '%"
strokeweight="1px"
strokecolor="' . $element['styles']['block']['borderColor'] . '"
fillcolor="' . $element['styles']['block']['backgroundColor'] . '">
@@ -52,11 +51,4 @@ class Button {
$button_width = $button_width - (2 * $border_width) . 'px';
return $button_width;
}
static function calculateHeight($element) {
$border_width = (int) $element['styles']['block']['borderWidth'];
$button_height = (int) $element['styles']['block']['lineHeight'];
$button_height = $button_height - (2 * $border_width) . 'px';
return $button_height;
}
}