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
|
@event = event
|
||||||
mail(to: 'core@openfest.org', subject: "Ново предложение за #{@event.class.model_name.human.mb_chars.downcase.to_s}: #{@event.title}")
|
mail(to: 'core@openfest.org', subject: "Ново предложение за #{@event.class.model_name.human.mb_chars.downcase.to_s}: #{@event.title}")
|
||||||
end
|
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
|
end
|
||||||
|
|
|
@ -19,6 +19,11 @@ class Event < ActiveRecord::Base
|
||||||
STATE_TO_GLYPH = {undecided: 'question-sign', rejected: 'remove', approved: 'ok', backup: 'retweet'}
|
STATE_TO_GLYPH = {undecided: 'question-sign', rejected: 'remove', approved: 'ok', backup: 'retweet'}
|
||||||
STATE_TO_CLASS = {undecided: 'warning', rejected: 'danger', approved: 'success', backup: 'info'}
|
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
|
private
|
||||||
|
|
||||||
def send_new_event_notification
|
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.
|
# available at http://guides.rubyonrails.org/i18n.html.
|
||||||
|
|
||||||
bg:
|
bg:
|
||||||
|
event_mailer:
|
||||||
|
acceptance_notification:
|
||||||
|
subject: 'Предложението ви за %{conference} е одобрено'
|
||||||
activerecord:
|
activerecord:
|
||||||
models:
|
models:
|
||||||
user:
|
user:
|
||||||
|
|
|
@ -20,6 +20,9 @@
|
||||||
# available at http://guides.rubyonrails.org/i18n.html.
|
# available at http://guides.rubyonrails.org/i18n.html.
|
||||||
|
|
||||||
en:
|
en:
|
||||||
|
event_mailer:
|
||||||
|
acceptance_notification:
|
||||||
|
subject: 'Your submission for %{conference} has been approved'
|
||||||
activerecord:
|
activerecord:
|
||||||
models:
|
models:
|
||||||
user:
|
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