Skip to content
Snippets Groups Projects
Commit 9572ab95 authored by Allen Gilliland's avatar Allen Gilliland
Browse files

Merge pull request #1621 from metabase/responsive-pulse-email

Responsive™ pulse email
parents 11934beb bb8ffda3
Branches
Tags
No related merge requests found
</div>
{{#quotation}}
<div style="padding: 3em; text-align: center; color: #CCCCCC; font-size: small;">"{{quotation}}"<br/>- {{quotationAuthor}}</div>
<div style="padding-top: 2em; padding-bottom: 1em; text-align: center; color: #CCCCCC; font-size: small;">"{{quotation}}"<br/>- {{quotationAuthor}}</div>
{{/quotation}}
{{#logoFooter}}
<div style="padding-bottom: 2em; text-align: center;">
<div style="padding-bottom: 1em; padding-top: 1em; text-align: center;">
<img width="32" height="40" src="http://static.metabase.com/email_logo.png"/>
</div>
{{/logoFooter}}
......
<html>
<body style="font-family: 'Helvetica Neue', Helvetica, sans-serif; font-size: 0.875rem; color: #727479; padding-top: 2em; padding-bottom: 1em; background-color: #F9FBFC; ">
<head>
<style>
@media screen and (min-width:600px) {
.pulse .container {
padding: 2em 4em !important;
}
}
</style>
</head>
<body class="{{emailType}}" style="font-family: 'Helvetica Neue', Helvetica, sans-serif; font-size: 0.875rem; color: #727479; padding: 1em; background-color: #F9FBFC; ">
{{#logoHeader}}
<div style="padding-bottom: 2em; text-align: center;">
<div style="padding-bottom: 2em; padding-top: 1em; text-align: center;">
<img width="32" height="40" src="http://static.metabase.com/email_logo.png"/>
</div>
{{/logoHeader}}
<div style="margin: 0 auto; max-width: 560px; padding: 2em 4em 2em 4em; color: #9F9F9F; border: 1px solid #dddddd; background-color: #FFFFFF; box-shadow: 0 1px 2px rgba(0, 0, 0, .08);">
<div class="container" style="margin: 0 auto; padding: 0; max-width: 660px; color: #9F9F9F;">
......@@ -21,7 +21,8 @@
(let [data-quote (rand-nth q/quotations)
company (or (setting/get :site-name) "Unknown")
message-body (stencil/render-file "metabase/email/new_user_invite"
{:invitedName (:first_name invited)
{:emailType "new_user_invite"
:invitedName (:first_name invited)
:invitorName (:first_name invitor)
:invitorEmail (:email invitor)
:company company
......@@ -44,7 +45,8 @@
(string? hostname)
(string? password-reset-url)]}
(let [message-body (stencil/render-file "metabase/email/password_reset"
{:hostname hostname
{:emailType "password_reset"
:hostname hostname
:passwordResetUrl password-reset-url
:logoHeader true})]
(email/send-message
......@@ -74,20 +76,21 @@
render-img (fn [bytes]
(let [index (or (find-byte-array bytes @images) (count @images))]
(if (= index (count @images)) (reset! images (conj @images bytes)))
(str "cid:IMAGE_" index)))
(str "cid:IMAGE" index)))
body (apply vector :div (mapv (partial render-pulse-section render-img true) results))
data-quote (rand-nth q/quotations)
message-body (stencil/render-file "metabase/email/pulse"
{:pulse (html body)
{:emailType "pulse"
:pulse (html body)
; :pulseName (:name pulse)
:sectionStype p/section-style
:sectionStyle p/section-style
:colorGrey4 p/color-grey-4
:quotation (:quote data-quote)
:quotationAuthor (:author data-quote)
:logoFooter true})]
(apply vector {:type "text/html" :content message-body}
(map-indexed (fn [idx bytes] {:type :inline
:content-id (str "IMAGE_" idx)
:content-id (str "IMAGE" idx)
:content-type "image/png"
:content (write-byte-array-to-temp-file bytes)})
@images))))
{{> metabase/email/_header }}
<div style="text-align: center;">
<div style="padding: 2em 4em; border: 1px solid #dddddd; border-radius: 2px; background-color: white; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); text-align: center;">
<div style="padding-bottom: 1em;">
<h2 style="font-weight: normal; color: #4C545B;line-height: 1.65rem;">{{invitedName}}, you're invited to {{company}}'s&nbsp;Metabase</h2>
<h4 style="font-weight: normal;"><a style="color: #4A90E2; text-decoration: none;" href="mailto:{{invitorEmail}}">{{invitorName}} ({{invitorEmail}})</a> invited you to join them.</h4>
......
{{> metabase/email/_header }}
<p>
You're receiving this e-mail because you or someone else has requested a password for your user account at {{hostname}}.
It can be safely ignored if you did not request a password reset. Click the link below to reset your password.
</p>
<p>
<a href="{{passwordResetUrl}}">{{passwordResetUrl}}</a>
</p>
<div style="padding: 2em 4em; border: 1px solid #dddddd; border-radius: 2px; background-color: white; box-shadow: 0 1px 2px rgba(0, 0, 0, .08);">
<p>
You're receiving this e-mail because you or someone else has requested a password for your user account at {{hostname}}.
It can be safely ignored if you did not request a password reset. Click the link below to reset your password.
</p>
<p>
<a href="{{passwordResetUrl}}">{{passwordResetUrl}}</a>
</p>
</div>
{{> metabase/email/footer }}
......@@ -183,7 +183,7 @@
(-> row (nth col-idx) (format-cell col) h)])
(if bar-column
[:td {:style (str bar-td-style "width: 99%;")}
[:div {:style (str "background-color: " color-purple "; height: 20px; width: " (float (* 100 (/ (bar-column row) max-value))) "%")} "&#160;"]])])
[:div {:style (str "background-color: " color-purple "; max-height: 10px; height: 10px; border-radius: 2px; width: " (float (* 100 (/ (bar-column row) max-value))) "%")} "&#160;"]])])
rows)]]))
(defn render-truncation-warning
......@@ -298,12 +298,14 @@
:target "_blank"
:style (str section-style "margin: 16px; margin-bottom: 16px; display: block; text-decoration: none;")}
(if include-title
[:div {:style "margin-bottom: 8px;"}
[:span {:style header-style}
(-> card :name h)]
(if include-buttons [:img {:style "float: right; width: 16px;"
:width 16
:src (-> (str "frontend_client/app/img/external_link@2x.png") io/resource io/input-stream org.apache.commons.io.IOUtils/toByteArray render-img)}])])
[:table {:style "margin-bottom: 8px; width: 100%;"}
[:tbody
[:tr
[:td [:span {:style header-style} (-> card :name h)]]
[:td {:style "text-align: right;"}
(if include-buttons [:img {:style "width: 16px;"
:width 16
:src (-> (str "frontend_client/app/img/external_link.png") io/resource io/input-stream org.apache.commons.io.IOUtils/toByteArray render-img)}])]]]])
(case (detect-pulse-card-type card data)
:empty (render-card-empty card data render-img include-buttons)
:scalar (render-card-scalar card data render-img include-buttons)
......@@ -319,7 +321,7 @@
(defn render-pulse-section
[render-img include-buttons {:keys [card result]}]
[:div {:style (str "margin-top: 10px; margin-bottom: 20px; border: 2px solid " color-grey-1 "; border-radius: 2px;")}
[:div {:style (str "margin-top: 10px; margin-bottom: 20px; border: 1px solid #dddddd; border-radius: 2px; background-color: white; box-shadow: 0 1px 2px rgba(0, 0, 0, .08);")}
(render-pulse-card card (:data result) render-img true include-buttons)])
(defn render-pulse-card-to-png
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment