Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add template body text optional inliner #155

Open
wants to merge 8 commits into
base: v5_backport
Choose a base branch
from

Conversation

xavierteres
Copy link

@xavierteres xavierteres commented May 23, 2024

Objectius

Cada visualitzador de e-mails implementa la visualització HTML una mica diferent i això fa que la visualització de e-mails sigui a part de complicada, poc cohesionada.

Una de les solucions més comunes per intentar cohesionar la visualització al màxim és posar el CSS dintre de cada etiqueta (inlining) d'aquesta manera els visualitzadors no poden "decidir" tant i els més antics suporten millor el CSS.

L'inlining es pot activar o desactivar a través d'un boolean a la plantilla del correu.

Comportament amb inlining

L'exemple més bàsic de la llibreria i amb el que passem als testos

Codi sense inlining.

<html>
<style type="text/css">
h1 { border:1px solid black }
p { color:red;}
</style>
<h1 style="font-weight:bolder">Peter</h1>
<p>Hej</p>
</html>

Un cop passat l'inlining

<html>
<h1 style="font-weight:bolder; border:1px solid black">Peter</h1>
<p style="color:red">Hej</p>
</html>

La PR conté testos per totes les funcions tocades i un script de migració.

Co-authored-by: Daniel Estanyol i Torres <[email protected]>
Copy link
Member

@lcbautista lcbautista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Documenteu la PR, no se sap que fa sense haver de llegir el codi.
  • Tests si su plau

@destanyol
Copy link

Right away!

@xavierteres xavierteres marked this pull request as ready for review May 24, 2024 10:06
@@ -512,6 +513,7 @@ def _get_model_data_name_search(
relation='ir.attachment',
string='Attachments'),
'attach_record_items': fields.boolean('Attach record items', select=2, help=u"Si es marca aquesta opcio, s'enviaran com a fitxers adjunts del email tots els adjunts del registre utilitzat per renderitzar el email."),
'inline': fields.boolean('Inline HTML', help=u"Si es marca aquesta opcio, l'html passara per un proces d'inline"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idioma del mòdul és l'anglès.

@@ -1,3 +1,4 @@
mako
qreu>=0.7.5
html2text
premailer==2.9.6
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entenc que una versió superior no és compatible amb python 2.7 no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants