Skip to content

Commit

Permalink
WIP: Migrate to Brevo SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
BadPixxel committed Sep 27, 2023
1 parent ac64407 commit 49973f1
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Repository/EmailRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* file that was distributed with this source code.
*/

namespace BadPixxel\SendinblueBridge\Repository;
namespace BadPixxel\BrevoBridge\Repository;

use Doctrine\ORM\EntityRepository;
use Sonata\UserBundle\Model\UserInterface as User;
Expand Down
2 changes: 1 addition & 1 deletion src/Repository/SmsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* file that was distributed with this source code.
*/

namespace BadPixxel\SendinblueBridge\Repository;
namespace BadPixxel\BrevoBridge\Repository;

use Doctrine\ORM\EntityRepository;
use Sonata\UserBundle\Model\UserInterface as User;
Expand Down
46 changes: 45 additions & 1 deletion src/Resources/views/Debug/email_view.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,55 @@
{# EMBEDD EMAIL FROM COMPILED TEMPLATE #}
{% include tmplPath with tmplParams only %}

<style>
.button {
display: inline-block;
padding: .75rem 1.25rem;
border-radius: 10rem;
color: #fff;
text-transform: uppercase;
font-size: 1rem;
letter-spacing: .15rem;
transition: all .3s;
position: relative;
overflow: hidden;
z-index: 1;
&:after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
background-color: lightgreen;
border-radius: 10rem;
z-index: -2;
}
&:before {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 0%;
height: 100%;
background-color: forestgreen;
transition: all .3s;
border-radius: 10rem;
z-index: -1;
}
&:hover {
color: #fff;
&:before {
width: 100%;
}
}
}
</style>
{# ADD SWITCH MENU #}
<div align="center">
<br />
<hr />
<a href="{{ path('admin_badpixxel_sendinblue_templates_list') }}">
<a class="button" href="{{ path('admin_badpixxel_brevo_templates_list') }}">
Back to List
</a>
<hr />
Expand Down
42 changes: 42 additions & 0 deletions src/Resources/views/Layout/default.mjml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{#
DEFAULT MJML EMAIL LAYOUT
#}

<mjml>

<mj-head>
{% block styles %}
{% include '@BrevoBridge/Layout/styles.mjml.twig' %}
{% endblock %}
<mj-preview>{% block preview %}{% endblock %}</mj-preview>

</mj-head>

<mj-body background-color="#ffffff">
{% block header %}
{% include '@BrevoBridge/Layout/header.mjml.twig' %}
{% endblock %}

{% block contents %}
<mj-section mj-class="bg-white" padding-bottom="0px">
<mj-column>

<mj-text mj-class="txt-title">
{% verbatim %}{{ params.subject }}{% endverbatim %}
</mj-text>

<mj-text mj-class="txt-lead">
{% verbatim %}{{ params.text }}{% endverbatim %}
</mj-text>

</mj-column>
</mj-section>

{% endblock %}

{% block footer %}
{% include '@BrevoBridge/Layout/footer.mjml.twig' %}
{% endblock %}
</mj-body>

</mjml>
23 changes: 23 additions & 0 deletions src/Resources/views/Layout/footer.mjml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{#
DEFAULT FOOTER
#}

<mj-section mj-class="bg-white no-padding">
<mj-column>
<mj-divider border-width="1px" border-color="#8d8d8d" width="95%"></mj-divider>
</mj-column>
</mj-section>

<mj-section mj-class="bg-gray no-padding">

<mj-column width="80%" vertical-align="top">
<mj-text mj-class="footer-title">
<p><b>This is Footer Title</b></p>
</mj-text>
<mj-divider mj-class="footer-div"></mj-divider>
<mj-text mj-class="footer-text">
<p style="line-height:25px">This is Footer Text</p>
</mj-text>
</mj-column>

</mj-section>
24 changes: 24 additions & 0 deletions src/Resources/views/Layout/header.mjml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

<mj-section mj-class="bg-gray" padding="15px">
<mj-column width="30%">
<mj-image href="{% verbatim %}{{ params.urls.home }}{% endverbatim %}"
src="{{ asset('bundles/brevobridge/img/brevo-logo.svg') }}"
alt="Logo" align="center" padding="10px" padding-left="20px"
>
</mj-image>
</mj-column>

<mj-column width="70%" vertical-align="middle" padding-bottom="5px" padding-top="5px">
<mj-navbar hamburger="hamburger" ico-color="white">
<mj-navbar-link href="{% verbatim %}{{ params.urls.home }}{% endverbatim %}" color="white" font-size="13px">
Item 1
</mj-navbar-link>
<mj-navbar-link href="{% verbatim %}{{ params.urls.home }}{% endverbatim %}" color="white" font-size="13px">
Item 2
</mj-navbar-link>
<mj-navbar-link href="{% verbatim %}{{ params.urls.home }}{% endverbatim %}" color="white" font-size="13px">
Item 3
</mj-navbar-link>
</mj-navbar>
</mj-column>
</mj-section>
41 changes: 41 additions & 0 deletions src/Resources/views/Layout/styles.mjml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{#
DEFAULT LAYOUT STYLES
#}

<mj-attributes>

{# GENERAL STYLES #}
<mj-class name="no-padding" padding="0px"></mj-class>
<mj-class name="no-y-padding" padding-top="0px" padding-bottom="0px"></mj-class>

{# BACKGROUNDS STYLES #}
<mj-class name="bg-white" background-color="#FFFFFF"></mj-class>
<mj-class name="bg-gray" background-color="lightgray"></mj-class>
<mj-class name="bg-dark" background-color="darkgray"></mj-class>
<mj-class name="bg-primary" background-color="green"></mj-class>
<mj-class name="bg-blue" background-color="blue"></mj-class>
<mj-class name="bg-green" background-color="green"></mj-class>

{# TEXTS STYLES #}
<mj-class name="txt-title" font-size="22px" color="green" font-family="arial" font-weight="bold"></mj-class>
<mj-class name="txt-subtitle" font-size="16px" font-weight="bold" font-family="Arial" padding="0 25px" color="#525252" ></mj-class>
<mj-class name="txt-lead" font-size="15px" line-height="22px" color="#666666" font-family="arial"></mj-class>
<mj-class name="txt-sm" font-size="13px" line-height="20px"></mj-class>
<mj-class name="txt-xs" font-size="11px" line-height="18px"></mj-class>
<mj-class name="txt-title-alt" font-size="20px" color="#22d39d" font-family="arial" font-weight="bold"></mj-class>
<mj-class name="txt-div" border-width="2px" border-color="#d1d1d1" width="100%" padding-top="0px" padding-bottom="3px"></mj-class>
<mj-class name="txt-div-alt" border-width="1px" border-color="#d1d1d1" padding-top="10px" padding-bottom="3px"></mj-class>

{# TEXTS COLORS #}
<mj-class name="txt-red" color="red"></mj-class>
<mj-class name="txt-gray" color="gray"></mj-class>
<mj-class name="txt-green" color="green"></mj-class>
<mj-class name="txt-blue" color="blue"></mj-class>
<mj-class name="txt-navy" color="navy"></mj-class>

{# FOOTER STYLES #}
<mj-class name="footer-text" align="center" font-family="Arial" font-size="14px" padding="0 25px" color="#696969"></mj-class>
<mj-class name="footer-title" align="center" font-family="Arial" font-size="14px" padding="0 25px" color="#525252" ></mj-class>
<mj-class name="footer-div" border-width="1px" border-color="#d5d9dd" width="75%" padding-top="5px" padding-bottom="10px"></mj-class>

</mj-attributes>
10 changes: 5 additions & 5 deletions src/Resources/views/TemplatesAdmin/list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

{% extends base_template %}

{% block title %}SendInBlue{% endblock %}
{% block navbar_title %}SendInBlue Bridge Templates{% endblock %}
{% block title %}Brevo{% endblock %}
{% block navbar_title %}Brevo Bridge Templates{% endblock %}

{% block sonata_admin_content %}

Expand Down Expand Up @@ -34,21 +34,21 @@
<td class="sonata-ba-list-field sonata-ba-list-field-text">{{ emailClass }}</td>
<td class="sonata-ba-list-field sonata-ba-list-field-actions" objectid="34">
<div class="btn-group">
<a href="{{ path('admin_badpixxel_sendinblue_templates_view', {'emailCode': emailCode}) }}"
<a href="{{ path('admin_badpixxel_brevo_templates_view', {'emailCode': emailCode}) }}"
class="btn btn-sm btn-default view_link"
target="_blank" title="Preview"
>
<i class="fa fa-eye" aria-hidden="true"></i>
Preview
</a>
<a href="{{ path('admin_badpixxel_sendinblue_templates_update', {'emailCode': emailCode}) }}"
<a href="{{ path('admin_badpixxel_brevo_templates_update', {'emailCode': emailCode}) }}"
class="btn btn-sm btn-default view_link"
title="Export to SenInBlue"
>
<i class="fa fa-upload" aria-hidden="true"></i>
Export
</a>
<a href="{{ path('admin_badpixxel_sendinblue_templates_send', {'emailCode': emailCode}) }}"
<a href="{{ path('admin_badpixxel_brevo_templates_send', {'emailCode': emailCode}) }}"
class="btn btn-sm btn-default view_link"
title="Send a test Email"
>
Expand Down

0 comments on commit 49973f1

Please sign in to comment.