Skip to content

Commit

Permalink
MDL-66807 analytics: Fix templates for gmail
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllaó committed Oct 31, 2019
1 parent d769970 commit 87e5342
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 42 deletions.
4 changes: 1 addition & 3 deletions analytics/templates/insight_info_message_prediction.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
{{> core_analytics/notification_styles}}

{{#body}}
<div>
{{{.}}}
</div>
{{{.}}}
{{/body}}
<br/>

Expand Down
12 changes: 8 additions & 4 deletions analytics/templates/notification_styles.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,16 @@
}
}}

<style>
{{! The styles defined here will be included in the Moodle web UI and in emails. Emails do not include Moodle
stylesheets so we want these styles to be applied to emails. However, they will also be included in the Moodle web UI.
We use the not(.dir-ltr):not(.dir-rtl) so that this style is not applied to the Moodle UI.
Note that gmail strips out HTML styles which selector includes the caracters (), so the font-family rule
is not applied in gmail.}}
<head><style>
body:not(.dir-ltr):not(.dir-rtl) {
font-family: 'Open Sans', sans-serif;
}
body:not(.dir-ltr):not(.dir-rtl) .btn-insight {
.btn-insight {
color: #007bff;
background-color: transparent;
display: inline-block;
Expand All @@ -47,10 +52,9 @@ body:not(.dir-ltr):not(.dir-rtl) .btn-insight {
user-select: none;
border: 1px solid #007bff;
padding: .375rem .75rem;
font-size: .9375rem;
line-height: 1.5;
border-radius: 0;
text-decoration: none;
cursor: pointer;
}
</style>
</style></head>
75 changes: 40 additions & 35 deletions user/templates/upcoming_activities_due_insight_body.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -37,56 +37,61 @@
}
}}

<style>
body:not(.dir-ltr):not(.dir-rtl) table.upcoming-activity-due {
font-family: 'Open Sans', sans-serif;
{{! The styles defined here will be included in the Moodle web UI and in emails. Emails do not include Moodle
stylesheets so we want these styles to be applied to emails. However, they will also be included in the Moodle web UI.
The styles defined in the class .table have precedence over general styles at tag level, so these styles are only
applied to emails.}}
<head><style>
table {
text-align: justify;
margin-bottom: 1rem;
margin-top: 1rem;
}
body:not(.dir-ltr):not(.dir-rtl) table.upcoming-activity-due tr.when {
table tr.when {
background-color: #e9ecef;
}
body:not(.dir-ltr):not(.dir-rtl) table.upcoming-activity-due th {
table th {
padding: 1rem .75rem 1rem .75rem;
font-weight: 400;
font-size: larger;
border-top: 1px solid #dee2e6;
}
body:not(.dir-ltr):not(.dir-rtl) table.upcoming-activity-due td {
table td {
padding: .75rem;
}
body:not(.dir-ltr):not(.dir-rtl) table.upcoming-activity-due td.link {
table td.link {
border-top: 1px solid #dee2e6;
border-bottom: 1px solid #dee2e6;
}
</style>
</style></head>

{{#str}} youhaveupcomingactivitiesdueinfo, moodle, {{userfirstname}} {{/str}}
<br/><br/>
<div>
{{#str}} youhaveupcomingactivitiesdueinfo, moodle, {{userfirstname}} {{/str}}
<br/><br/>

{{#activitiesdue}}
<table class="table upcoming-activity-due">
<thead>
<tr>
<th scope="col" class="h5">
{{#icon}}
{{#pix}} {{key}}, {{component}}, {{title}} {{alttext}} {{/pix}}
{{/icon}}
{{name}}
</th>
</tr>
</thead>
<tbody>
<tr class="when">
<td><strong>{{#str}} whendate, calendar, {{formattedtime}} {{/str}}</strong></td>
</tr>
<tr>
<td>{{#str}} coursetitle, moodle, {"course": "{{coursename}}" } {{/str}}</td>
</tr>
<tr>
<td class="link"><a href="{{url}}">{{#str}} gotoactivity, calendar{{/str}}</a></td>
</tr>
</tbody>
</table>
{{/activitiesdue}}
{{#activitiesdue}}
<table class="table upcoming-activity-due">
<thead>
<tr>
<th scope="col" class="h5">
{{#icon}}
{{#pix}} {{key}}, {{component}}, {{title}} {{alttext}} {{/pix}}
{{/icon}}
{{name}}
</th>
</tr>
</thead>
<tbody>
<tr class="when">
<td><strong>{{#str}} whendate, calendar, {{formattedtime}} {{/str}}</strong></td>
</tr>
<tr>
<td>{{#str}} coursetitle, moodle, {"course": "{{coursename}}" } {{/str}}</td>
</tr>
<tr>
<td class="link"><a href="{{url}}">{{#str}} gotoactivity, calendar{{/str}}</a></td>
</tr>
</tbody>
</table>
{{/activitiesdue}}
</div>

0 comments on commit 87e5342

Please sign in to comment.