Skip to content

Commit

Permalink
Added InviteCode action.
Browse files Browse the repository at this point in the history
  • Loading branch information
mack authored and matcornic committed Jan 29, 2020
1 parent 9f477cc commit a7aa23c
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 10 deletions.
33 changes: 29 additions & 4 deletions default.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,18 @@ func (dt *Default) HTMLTemplate() string {
font-size: 15px;
line-height: 18px;
}
/* Invite Code ------------------------------ */
.invite-code {
display: inline-block;
padding: 20px 36px 16px 36px;
border-radius: 3px;
font-family: Consolas, monaco, monospace;
font-size: 28px;
text-align: center;
letter-spacing: 8px;
color: #555;
background-color: #eee;
}
/* Buttons ------------------------------ */
.button {
display: inline-block;
Expand Down Expand Up @@ -386,9 +398,14 @@ func (dt *Default) HTMLTemplate() string {
<tr>
<td align="center">
<div>
<a href="{{ $action.Button.Link }}" class="button" style="{{ with $action.Button.Color }}background-color: {{ . }};{{ end }} {{ with $action.Button.TextColor }}color: {{ . }};{{ end }} width: {{$width}}px;" target="_blank">
{{ $action.Button.Text }}
</a>
{{ if $action.InviteCode }}
<span class="invite-code">{{ $action.InviteCode }}</span>
{{ end }}
{{ if $action.Button.Text }}
<a href="{{ $action.Button.Link }}" class="button" style="{{ with $action.Button.Color }}background-color: {{ . }};{{ end }} {{ with $action.Button.TextColor }}color: {{ . }};{{ end }}" target="_blank">
{{ $action.Button.Text }}
</a>
{{ end }}
</div>
</td>
</tr>
Expand Down Expand Up @@ -499,7 +516,15 @@ func (dt *Default) PlainTextTemplate() string {
{{ end }}
{{ with .Email.Body.Actions }}
{{ range $action := . }}
<p>{{ $action.Instructions }} {{ $action.Button.Link }}</p>
<p>
{{ $action.Instructions }}
{{ if $action.InviteCode }}
{{ $action.InviteCode }}
{{ end }}
{{ if $action.Button.Link }}
{{ $action.Button.Link }}
{{ end }}
</p>
{{ end }}
{{ end }}
{{ end }}
Expand Down
35 changes: 30 additions & 5 deletions flat.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,18 @@ func (dt *Flat) HTMLTemplate() string {
font-size: 15px;
line-height: 18px;
}
/* Invite Code ------------------------------ */
.invite-code {
display: inline-block;
padding: 20px 36px 16px 36px;
border-radius: 3px;
font-family: Consolas, monaco, monospace;
font-size: 28px;
text-align: center;
letter-spacing: 8px;
color: #555;
background-color: #eee;
}
/* Buttons ------------------------------ */
.button {
display: inline-block;
Expand Down Expand Up @@ -383,10 +395,15 @@ func (dt *Flat) HTMLTemplate() string {
<table class="body-action" align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<div>
<a href="{{ $action.Button.Link }}" class="button" style="{{ with $action.Button.Color }}background-color: {{ . }};{{ end }} {{ with $action.Button.TextColor }}color: {{ . }};{{ end }}" target="_blank">
{{ $action.Button.Text }}
</a>
<div>
{{ if $action.InviteCode }}
<span class="invite-code">{{ $action.InviteCode }}</span>
{{ end }}
{{ if $action.Button.Text }}
<a href="{{ $action.Button.Link }}" class="button" style="{{ with $action.Button.Color }}background-color: {{ . }};{{ end }} {{ with $action.Button.TextColor }}color: {{ . }};{{ end }}" target="_blank">
{{ $action.Button.Text }}
</a>
{{ end }}
</div>
</td>
</tr>
Expand Down Expand Up @@ -497,7 +514,15 @@ func (dt *Flat) PlainTextTemplate() string {
{{ end }}
{{ with .Email.Body.Actions }}
{{ range $action := . }}
<p>{{ $action.Instructions }} {{ $action.Button.Link }}</p>
<p>
{{ $action.Instructions }}
{{ if $action.InviteCode }}
{{ $action.InviteCode }}
{{ end }}
{{ if $action.Button.Link }}
{{ $action.Button.Link }}
{{ end }}
</p>
{{ end }}
{{ end }}
{{ end }}
Expand Down
3 changes: 2 additions & 1 deletion hermes.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,11 @@ type Columns struct {
CustomAlignment map[string]string
}

// Action is an action the user can do on the email (click on a button)
// Action is anything the user can act on (i.e., click on a button, view an invite code)
type Action struct {
Instructions string
Button Button
InviteCode string
}

// Button defines an action to launch
Expand Down

0 comments on commit a7aa23c

Please sign in to comment.