Implement an acceptance mailer with localized views
This commit is contained in:
parent
27677e2d0a
commit
97fcc32990
|
@ -4,4 +4,10 @@ class EventMailer < ActionMailer::Base
|
|||
@event = event
|
||||
mail(to: 'core@openfest.org', subject: "Ново предложение за #{@event.class.model_name.human.mb_chars.downcase.to_s}: #{@event.title}")
|
||||
end
|
||||
|
||||
def acceptance_notification(event)
|
||||
@event = event
|
||||
I18n.locale = @event.language
|
||||
mail to: @event.user.email, from: 'cfp@openfest.org', subject: I18n.t('event_mailer.acceptance_notification.subject', conference: @event.conference.title)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,6 +19,11 @@ class Event < ActiveRecord::Base
|
|||
STATE_TO_GLYPH = {undecided: 'question-sign', rejected: 'remove', approved: 'ok', backup: 'retweet'}
|
||||
STATE_TO_CLASS = {undecided: 'warning', rejected: 'danger', approved: 'success', backup: 'info'}
|
||||
|
||||
def send_acceptance_notification!
|
||||
EventMailer.acceptance_notification(self).deliver
|
||||
touch :acceptance_notification_sent_at
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def send_new_event_notification
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Предложението ви е одобрено
|
|
@ -0,0 +1 @@
|
|||
Your submission was approved
|
|
@ -20,6 +20,9 @@
|
|||
# available at http://guides.rubyonrails.org/i18n.html.
|
||||
|
||||
bg:
|
||||
event_mailer:
|
||||
acceptance_notification:
|
||||
subject: 'Предложението ви за %{conference} е одобрено'
|
||||
activerecord:
|
||||
models:
|
||||
user:
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
# available at http://guides.rubyonrails.org/i18n.html.
|
||||
|
||||
en:
|
||||
event_mailer:
|
||||
acceptance_notification:
|
||||
subject: 'Your submission for %{conference} has been approved'
|
||||
activerecord:
|
||||
models:
|
||||
user:
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
class AddAcceptanceEmailFieldsToEvents < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :events, :acceptance_notification_sent_at, :timestamp
|
||||
add_column :events, :confirmed_at, :timestamp
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue