From f65932fee1b610000a2ecaee9e8e0266abb778e0 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Sat, 10 May 2014 11:37:35 +0200 Subject: [PATCH] Some more email invitation refactoring --- lib/Mojolicious/Plugin/Mailer.pm | 12 ++++--- lib/Vroom/I18N/en.pm | 9 +++-- lib/Vroom/I18N/fr.pm | 12 ++++--- public/vroom.pl | 1 - templates/default/invite.email_html.ep | 64 +++++++++++++++++++--------------- templates/default/invite.email_text.ep | 10 ++++-- 6 files changed, 64 insertions(+), 44 deletions(-) diff --git a/lib/Mojolicious/Plugin/Mailer.pm b/lib/Mojolicious/Plugin/Mailer.pm index 9396a6e..529b367 100644 --- a/lib/Mojolicious/Plugin/Mailer.pm +++ b/lib/Mojolicious/Plugin/Mailer.pm @@ -28,23 +28,25 @@ sub register { Email::MIME->create( body => Encode::encode('UTF-8', $self->render( @data, - format => $args->{format} ? $args->{format} : 'email_html', + format => $args->{format} ? $args->{format} : 'email_text', partial => 1 )), attributes => { charset => 'utf-8', - content_type => 'text/html', + encoding => '7bit', + content_type => 'text/plain', } ), Email::MIME->create( body => Encode::encode('UTF-8', $self->render( @data, - format => $args->{format} ? $args->{format} : 'email_text', + format => $args->{format} ? $args->{format} : 'email_html', partial => 1 )), attributes => { charset => 'utf-8', - content_type => 'text/plain', + encoding => '7bit', + content_type => 'text/html', } ), ); @@ -64,7 +66,7 @@ sub register { ); $email->charset_set ( $args->{charset} ? $args->{charset} : 'utf-8' ); - $email->content_type_set( $args->{content_type} ? $args->{content_type} : 'text/html' ); + $email->content_type_set( $args->{content_type} ? $args->{content_type} : 'multipart/alternative' ); return Email::Sender::Simple->try_to_send( $email, { transport => $transport } ) if $transport; diff --git a/lib/Vroom/I18N/en.pm b/lib/Vroom/I18N/en.pm index 28ef6d9..800bee0 100644 --- a/lib/Vroom/I18N/en.pm +++ b/lib/Vroom/I18N/en.pm @@ -12,9 +12,12 @@ our %Lexicon = ( "ERROR_NOT_LOGGED_IN" => "Sorry, your not logged in", "EMAIL_INVITATION" => "Video conference invitation", "INVITE_SENT_TO_s" => "An invitation was sent to %s", - "TO_JOIN_CLICK_THIS_LINK" => "You're invited to join a video conference. " . - "All you need is a modern web browser and a webcam. When you're ready, " . - "just go to this address", + "YOU_ARE_INVITED_TO_A_MEETING" => "You are awaited on a video conferecing room. " . + "Before joining it, make sure you have all the necessary", + "A_MODERN_BROWSER" => "A modern web browser, recent versions of Mozilla Firefox, Google Chrome or Opera will work", + "A_WEBCAM" => "A webcam", + "A_MIC" => "A microphone", + "WHEN_YOU_ARE_READY" => "When you are ready, go to this address to join the conference", "HAVE_A_NICE_MEETING" => "Have a nice meeting :-)", "EMAIL_SIGN" => "VROOM! And video conferencing becomes free, simple and safe", "FEEDBACK" => "Feedback", diff --git a/lib/Vroom/I18N/fr.pm b/lib/Vroom/I18N/fr.pm index 42c5220..4c2a5ba 100644 --- a/lib/Vroom/I18N/fr.pm +++ b/lib/Vroom/I18N/fr.pm @@ -12,10 +12,14 @@ our %Lexicon = ( "ERROR_ROOM_s_LOCKED" => "Le salon %s est verrouillé, vous ne pouvez pas le rejoindre", "ERROR_OCCURED" => "Une erreur est survenue", "ERROR_NOT_LOGGED_IN" => "Désolé, vous n'êtes pas identifié", - "EMAIL_INVITATION" => "Vidéo conférence", - "TO_JOIN_CLICK_THIS_LINK" => "Vous êtes attendu sur un salon de vidéo conférence. " . - "Tout ce dont vous avez besoin est un navigateur web récent et " . - "une webcam. Quand vous êtes prêt, rendez-vous sur cette adresse", + "EMAIL_INVITATION" => "Invitation à une conférence vidéo", + "YOU_ARE_INVITED_TO_A_MEETING" => "Vous êtes attendu sur un salon de vidéo conférence. " . + "Avant de le rejoindre, assurez vous de disposer de tout le nécessaire", + "A_MODERN_BROWSER" => "Un navigateur web moderne, les versions récentes des navigateurs Mozilla " . + "Firefox, Google Chrome ou Opera fonctionneront", + "A_WEBCAM" => "Une webcam", + "A_MIC" => "Un micro", + "WHEN_YOU_ARE_READY" => "Quand vous êtes prêt, rendez-vous sur cette adresse pour joindre la conférence", "HAVE_A_NICE_MEETING" => "Bonne réunion :-)", "EMAIL_SIGN" => "VROOM! Et la visio conférence devient libre, simple et sûr", "FEEDBACK" => "Retour d'expérience", diff --git a/public/vroom.pl b/public/vroom.pl index 6845a04..6fae7ff 100755 --- a/public/vroom.pl +++ b/public/vroom.pl @@ -381,7 +381,6 @@ post '/action' => sub { Subject => encode("MIME-Header", $self->l("EMAIL_INVITATION")), To => $rcpt ], - content_type => 'multipart/alternative', data => [ template => 'invite', room => $room diff --git a/templates/default/invite.email_html.ep b/templates/default/invite.email_html.ep index 814ed19..f140d8f 100644 --- a/templates/default/invite.email_html.ep +++ b/templates/default/invite.email_html.ep @@ -1,29 +1,37 @@ - -

- <% - my $url = $self->url_for('/')->to_abs; - $url .= ($url =~ m/\/$/) ? '' : '/'; - %> - <%= - $self->l('TO_JOIN_CLICK_THIS_LINK'); - %> -
-

-

-

- - <%= $url . $room %> - -

-
-

-
-

+<% + my $url = $self->url_for('/')->to_abs; + $url .= ($url =~ m/\/$/) ? '' : '/'; +%> +

+ <%=l 'YOU_ARE_INVITED_TO_A_MEETING' %> +

+

+

+ <%=l 'WHEN_YOU_ARE_READY' %> +

+

+ + <%= $url . $room %> + +

+
+

+
+

<%=l 'HAVE_A_NICE_MEETING' %> -

-

- — -
- <%=l 'EMAIL_SIGN' %> -

- +

+

+ — +
+ <%=l 'EMAIL_SIGN' %> +

diff --git a/templates/default/invite.email_text.ep b/templates/default/invite.email_text.ep index ba32d58..23f10a5 100644 --- a/templates/default/invite.email_text.ep +++ b/templates/default/invite.email_text.ep @@ -2,9 +2,13 @@ my $url = $self->url_for('/')->to_abs; $url .= ($url =~ m/\/$/) ? '' : '/'; %> -<%= - $self->l('TO_JOIN_CLICK_THIS_LINK') -%> +<%=l 'YOU_ARE_INVITED_TO_A_MEETING' %> + + * <%=l 'A_MODERN_BROWSER' %> + * <%=l 'A_WEBCAM' %> + * <%=l 'A_MIC' %> + +<%=l 'WHEN_YOU_ARE_READY' %> <%= $url . $room %>