Skip to content

Commit 1f94fbf

Browse files
authored
Merge pull request #60 from laravel-enso/new_email_notifications_template
New email notifications template
2 parents 950a606 + 5ad7a5d commit 1f94fbf

File tree

13 files changed

+504
-3
lines changed

13 files changed

+504
-3
lines changed

src/AppServiceProvider.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ private function publishesResources()
6161
$this->publishes([
6262
__DIR__.'/resources/views' => resource_path('views/vendor/laravel-enso'),
6363
]);
64+
65+
$this->publishes([
66+
__DIR__.'/resources/views/emails' => resource_path('views/emails'),
67+
__DIR__.'/resources/assets/images' => resource_path('assets/images'),
68+
], 'email-templates');
69+
70+
$this->publishes([
71+
__DIR__.'/resources/views/emails' => resource_path('views/emails'),
72+
__DIR__.'/resources/assets/images' => resource_path('assets/images'),
73+
], 'core-email-templates');
6474
}
6575

6676
private function registerMiddleware()

src/app/Notifications/ResetPasswordNotification.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace LaravelEnso\Core\app\Notifications;
44

55
use Illuminate\Bus\Queueable;
6+
use Illuminate\Support\Facades\App;
67
use Illuminate\Notifications\Notification;
78
use Illuminate\Contracts\Queue\ShouldQueue;
89
use Illuminate\Notifications\Messages\MailMessage;
@@ -27,11 +28,17 @@ public function via($notifiable)
2728

2829
public function toMail($notifiable)
2930
{
31+
app()->setLocale($notifiable->preferences->global->lang);
32+
3033
return (new MailMessage())
3134
->subject(__('Reset Password Notification'))
32-
->line(__('Please set or reset your password by clicking the button below.'))
33-
->action(__('Direct Link'), config('app.url').'/password/reset/'.$this->token)
34-
->line(__('Thank you for using our application!'));
35+
->view('emails.passwordReset',
36+
[
37+
'body' => __('Please set or reset your password by clicking the button below.'),
38+
'ending' => __('Thank you for using our application!'),
39+
'resetURL' => config('app.url').'/password/reset/'.$this->token,
40+
'buttonLabel' => __('Reset Your Password'),
41+
]);
3542
}
3643

3744
public function toArray($notifiable)
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
@import url(http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,900);
2+
3+
/* Take care of image borders and formatting */
4+
5+
img {
6+
max-width: 600px;
7+
outline: none;
8+
text-decoration: none;
9+
-ms-interpolation-mode: bicubic;
10+
}
11+
12+
a img {
13+
border: none;
14+
}
15+
16+
table {
17+
border-collapse: collapse !important;
18+
}
19+
20+
#outlook a {
21+
padding: 0;
22+
}
23+
24+
.ReadMsgBody {
25+
width: 100%;
26+
}
27+
28+
.ExternalClass {
29+
width: 100%;
30+
}
31+
32+
.backgroundTable {
33+
margin: 0 auto;
34+
padding: 0;
35+
width: 100% !important;
36+
}
37+
38+
table td {
39+
border-collapse: collapse;
40+
}
41+
42+
.ExternalClass * {
43+
line-height: 115%;
44+
}
45+
46+
/* General styling */
47+
48+
td {
49+
font-family: Arial, sans-serif;
50+
}
51+
52+
body {
53+
-webkit-font-smoothing: antialiased;
54+
-webkit-text-size-adjust: none;
55+
width: 100%;
56+
height: 100%;
57+
color: #6f6f6f;
58+
font-weight: 400;
59+
font-size: 18px;
60+
}
61+
62+
h1 {
63+
margin: 10px 0;
64+
}
65+
66+
a {
67+
color: #27aa90;
68+
text-decoration: none;
69+
}
70+
71+
.force-full-width {
72+
width: 100% !important;
73+
}
74+
75+
.body-padding {
76+
padding: 0 75px;
77+
}
78+
79+
.force-width-80 {
80+
width: 80% !important;
81+
}
82+
83+
.spaced-out-lines {
84+
line-height: 1.4;
85+
}
86+
87+
@media screen {
88+
/* Thanks Outlook 2013! */
89+
* {
90+
font-family: 'Source Sans Pro', 'Helvetica Neue', 'Arial', 'sans-serif' !important;
91+
}
92+
.w280 {
93+
width: 280px !important;
94+
}
95+
96+
}
97+
98+
/* Mobile styles */
99+
@media only screen and (max-width: 480px) {
100+
101+
table[class*="w320"] {
102+
width: 320px !important;
103+
}
104+
105+
td[class*="w320"] {
106+
width: 280px !important;
107+
padding-left: 20px !important;
108+
padding-right: 20px !important;
109+
}
110+
111+
img[class*="w320"] {
112+
width: 250px !important;
113+
height: 67px !important;
114+
}
115+
116+
td[class*="mobile-spacing"] {
117+
padding-top: 10px !important;
118+
padding-bottom: 10px !important;
119+
}
120+
121+
*[class*="mobile-hide"] {
122+
display: none !important;
123+
}
124+
125+
*[class*="mobile-br"] {
126+
font-size: 12px !important;
127+
}
128+
129+
td[class*="mobile-w20"] {
130+
width: 20px !important;
131+
}
132+
133+
img[class*="mobile-w20"] {
134+
width: 20px !important;
135+
}
136+
137+
td[class*="mobile-center"] {
138+
text-align: center !important;
139+
}
140+
141+
table[class*="w100p"] {
142+
width: 100% !important;
143+
}
144+
145+
td[class*="activate-now"] {
146+
padding-right: 0 !important;
147+
padding-top: 20px !important;
148+
}
149+
150+
td[class*="mobile-resize"] {
151+
font-size: 22px !important;
152+
padding-left: 15px !important;
153+
}
154+
155+
}
14.8 KB
Loading
1.34 KB
Loading
1.47 KB
Loading
1.38 KB
Loading
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3+
<html xmlns="http://www.w3.org/1999/xhtml">
4+
<head>
5+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
6+
<meta name="viewport" content="width=device-width, initial-scale=1"/>
7+
<title>{{$htmlTitle or ''}}</title>
8+
9+
10+
@include('emails.partials.css')
11+
12+
13+
<!-- Originally designed by https://github.com/kaytcat -->
14+
<!-- Header image designed by Freepik.com -->
15+
16+
@yield('css')
17+
18+
</head>
19+
<body offset="0" class="body"
20+
style="padding:0; margin:0; display:block; background:#eeebeb; -webkit-text-size-adjust:none" bgcolor="#eeebeb">
21+
<table align="center" cellpadding="0" cellspacing="0" width="100%" height="100%">
22+
<tr>
23+
<td align="center" valign="top" style="background-color:#eeebeb" width="100%">
24+
25+
<center>
26+
27+
<table cellspacing="0" cellpadding="0" width="600" class="w320">
28+
<tr>
29+
<td align="center" valign="top">
30+
31+
@include('emails.partials.header')
32+
33+
<table cellspacing="0" cellpadding="0" width="100%" class="force-full-width"
34+
bgcolor="#ffffff">
35+
<tr>
36+
<td style="background-color:#ffffff;">
37+
<br>
38+
<center>
39+
<table style="margin: 0 auto;" cellspacing="0" cellpadding="0" class="force-width-80">
40+
<tr>
41+
<td style="text-align:left; color: #6f6f6f;" class="spaced-out-lines">
42+
@yield('content')
43+
</td>
44+
</tr>
45+
</table>
46+
</center>
47+
48+
<table style="margin:0 auto;" cellspacing="0" cellpadding="10" width="100%">
49+
<tr>
50+
<td style="text-align:center; margin:0 auto;">
51+
<br>
52+
<div>
53+
<!--[if mso]>
54+
<v:rect xmlns:v="urn:schemas-microsoft-com:vml"
55+
xmlns:w="urn:schemas-microsoft-com:office:word"
56+
href="http://"
57+
style="height:45px;v-text-anchor:middle;width:220px;"
58+
stroke="f" fillcolor="#f5774e">
59+
<w:anchorlock/>
60+
<center>
61+
<![endif]-->
62+
@yield('buttons')
63+
<!--[if mso]>
64+
</center>
65+
</v:rect>
66+
<![endif]-->
67+
</div>
68+
<br>
69+
</td>
70+
</tr>
71+
</table>
72+
73+
@include('emails.partials.footer')
74+
</td>
75+
</tr>
76+
</table>
77+
</td>
78+
</tr>
79+
</table>
80+
</center>
81+
</td>
82+
</tr>
83+
</table>
84+
</body>
85+
</html>

0 commit comments

Comments
 (0)