This repository has been archived by the owner on Jan 26, 2021. It is now read-only.
forked from rubycentral/cfp-app
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Both html & plain text emails are sent from markdown templates
- Loading branch information
Showing
15 changed files
with
70 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module MailerHelper | ||
|
||
def md_link_to(name, path) | ||
"[#{name}](#{path})" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class ApplicationMailer < ActionMailer::Base | ||
helper MailerHelper | ||
|
||
def mail_markdown(options) | ||
mail options do |format| | ||
markdown_string = render_to_string(action_name, formats: :md) | ||
format.text { render text: markdown_string} | ||
format.html { render text: Redcarpet::Markdown.new(Redcarpet::Render::HTML).render(markdown_string)} | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
class InvitationMailer < ActionMailer::Base | ||
class InvitationMailer < ApplicationMailer | ||
|
||
def speaker(invitation, speaker) | ||
@invitation = invitation | ||
@proposal = invitation.proposal | ||
@speaker = speaker | ||
|
||
mail(to: @invitation.email, from: @proposal.event.contact_email, subject: "You've been invited to join the \"#{@proposal.title}\" proposal for #{@proposal.event}") | ||
mail_markdown(to: @invitation.email, from: @proposal.event.contact_email, subject: "You've been invited to join the \"#{@proposal.title}\" proposal for #{@proposal.event}") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
class ParticipantInvitationMailer < ActionMailer::Base | ||
class ParticipantInvitationMailer < ApplicationMailer | ||
|
||
def create(participant_invitation) | ||
@participant_invitation = participant_invitation | ||
@event = participant_invitation.event | ||
|
||
mail to: participant_invitation.email, | ||
from: @event.contact_email, | ||
subject: "You've been invited to participate in a CFP" | ||
mail_markdown to: participant_invitation.email, | ||
from: @event.contact_email, | ||
subject: "You've been invited to participate in a CFP" | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
app/views/comment_notification_mailer/email_notification.html.haml
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
app/views/comment_notification_mailer/email_notification.md.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Hello! | ||
<%= @comment.person.name %> has left a comment on the proposal '<%= @comment.proposal.title %>' for <%= @comment.proposal.event.name %>: | ||
|
||
> <%= simple_format(@comment.body) %> | ||
|
||
<%= md_link_to 'View the proposal', proposal_url(slug: @comment.proposal.event.slug, uuid: @comment.proposal) %> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Hello! | ||
|
||
<%= @speaker.name %> <%= @speaker.email %> has invited you as a speaker on the proposal <%= @proposal.title %> for <%= @proposal.event %>. | ||
|
||
You can accept or refuse this invitation by visiting <% md_link_to 'the proposal page', invitation_url(invitation_slug: @invitation.slug) %>. | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Hi there! | ||
|
||
You've been invited to participate in a Call for Proposals for the event | ||
<%= @participant_invitation.event %> as the role <%= @participant_invitation.role %>. | ||
|
||
<%= md_link_to 'Click here to accept.', | ||
accept_participant_invitation_url(@participant_invitation.slug, | ||
@participant_invitation.token) %> | ||
You'll be prompted to create an account if you don't already have one. | ||
|
||
<%= md_link_to 'Click here to decline.', | ||
refuse_participant_invitation_url(@participant_invitation.slug, | ||
@participant_invitation.token) %> | ||
|
||
You can view the event <%= md_link_to 'here', event_url(@event.slug) %>. | ||
|
||
The <%= @event.name %> Program Committee |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<%= @comment.person.name %> has left a comment on your proposal <%= @proposal.title %> for <%= @proposal.event.name %>: | ||
|
||
> <%= simple_format(@comment.body) %> | ||
|
||
<%= md_link_to 'View your proposal', proposal_url(slug: @proposal.event.slug, uuid: @proposal) %> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class InvitationPreview < ActionMailer::Preview | ||
def create | ||
ParticipantInvitationMailer.create(ParticipantInvitation.first) | ||
end | ||
end |