@ -8,44 +8,6 @@ class UserMailer < ActionMailer::Base
default from : " Bike!Bike! <noreply@bikebike.org> "
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.user_mailer.activation_needed_email.subject
#
def activation_needed_email ( email_address )
@greeting = " Hi "
mail to : email_address
end
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.user_mailer.activation_success_email.subject
#
def activation_success_email
@greeting = " Hi "
mail to : " to@example.org "
end
def conference_registration_email ( conference , data , conference_registration )
@data = data
@conference = conference
@url = " https://bikebike.org " #UserMailer.default_url_options[:host]
@confirmation_url = UserMailer . default_url_options [ :host ] + " / #{ @conference . url } /register/confirm/ #{ conference_registration . confirmation_token } / " . gsub ( / \/ \/ + / , '/' )
mail to : data [ :email ] , subject : ( I18n . t 'register.email.registration.subject' , " Please confirm your registration for #{ conference . title } " , vars : { :conference_title = > conference . title } )
end
def conference_registration_confirmed_email ( conference , data , conference_registration )
@data = data
@conference = conference
@url = " https://bikebike.org " #UserMailer.default_url_options[:host]
@confirmation_url = UserMailer . default_url_options [ :host ] + " / #{ @conference . url } /register/pay-registration/ #{ conference_registration . confirmation_token } / " . gsub ( / \/ \/ + / , '/' )
mail to : data [ :email ] , subject : ( I18n . t 'register.email.registration_confirmed.subject' , " Thanks for confirming your registration for #{ conference . title } " , vars : { :conference_title = > conference . title } )
end
def email_confirmation ( confirmation )
@confirmation = confirmation
@subject = _ 'email.subject.confirm_email' , 'Please confirm your email address'
@ -53,9 +15,9 @@ class UserMailer < ActionMailer::Base
end
def registration_confirmation ( registration )
@registration = registration
@conference = Conference . find ( @registration . conference_id )
@user = User . find ( @registration . user_id )
@registration = ConferenceRegistration . find ( registration )
@conference = @registration . conference
@user = @registration . user
@subject = @conference . registration_status . to_sym == :pre ?
_ (
'email.subject.pre_registration_confirmed' ,
@ -72,17 +34,18 @@ class UserMailer < ActionMailer::Base
def broadcast ( host , subject , content , user , conference )
@host = host
@content = content
@banner = nil #(@host || 'http://localhost/') + (conference ? (conference.poster.preview.url || '') : image_url('logo.png'))
@banner = nil
@conference = Conference . find ( conference )
@user = Conference . find ( user ) if user . present?
@subject = " [ #{ conference ? conference . title : 'Bike!Bike!' } ] #{ subject } "
if user && user . named_email
email = user . named_email
mail to : email , subject : @subject
if @user && @user . named_email
mail to : @user . named_email , subject : @subject
end
end
def workshop_facilitator_request ( workshop , requester , message )
@workshop = workshop
@requester = requester
@workshop = Workshop . find ( workshop )
@requester = User . find ( requester )
addresses = [ ]
@workshop . active_facilitators . each do | f |
addresses << f . named_email
@ -96,9 +59,9 @@ class UserMailer < ActionMailer::Base
end
def workshop_facilitator_request_approved ( workshop , user )
@workshop = workshop
@workshop = Workshop . find ( workshop )
@conference = Conference . find ( @workshop . conference_id )
@user = user
@user = User . find ( user )
@subject = ( _ 'email.subject.workshop_request_approved' ,
" You have been added as a facilitator of #{ @workshop . title } " ,
:vars = > { :workshop_title = > @workshop . title } )
@ -106,9 +69,9 @@ class UserMailer < ActionMailer::Base
end
def workshop_facilitator_request_denied ( workshop , user )
@workshop = workshop
@conference = Conference . find ( @workshop . conference_id )
@user = user
@workshop = Workshop . find ( workshop )
@conference = @workshop . conference
@user = User . find ( user )
@subject = ( _ 'email.subject.workshop_request_denied' ,
" Your request to facilitate #{ @workshop . title } has been denied " ,
:vars = > { :workshop_title = > @workshop . title } )
@ -116,12 +79,12 @@ class UserMailer < ActionMailer::Base
end
def workshop_translated ( workshop , data , locale , user , translator )
@workshop = workshop
@workshop = Workshop . find ( workshop )
@data = data
@locale = locale
@locale_name = language_name ( locale )
@user = user
@translator = translator
@user = User . find ( user )
@translator = User . find ( translator )
@subject = ( _ 'email.subject.workshop_translated' ,
" The #{ @locale_name } translation for #{ @workshop . title } has been modified " ,
vars : { language : @language_name , workshop_title : @workshop . title } )
@ -139,10 +102,10 @@ class UserMailer < ActionMailer::Base
end
def workshop_original_content_changed ( workshop , data , user , translator )
@workshop = workshop
@workshop = Workshop . find ( workshop )
@data = data
@user = user
@translator = translator
@user = User . find ( user )
@translator = User . find ( translator )
@subject = ( _ 'email.subject.workshop_original_content_changed' ,
" Original content for #{ @workshop . title } has been modified " ,
vars : { workshop_title : @workshop . title } )
@ -160,9 +123,9 @@ class UserMailer < ActionMailer::Base
end
def workshop_comment ( workshop , comment , user )
@workshop = workshop
@workshop = Workshop . find ( workshop )
@comment = comment
@user = user
@user = User . find ( user )
if comment . reply?
@subject = ( _ 'email.subject.workshop_comment.reply' , vars : { user_name : comment . user . name } )
@ -180,20 +143,20 @@ class UserMailer < ActionMailer::Base
@exception = exception
@request = request
@params = params
@user = user
@user = User . find ( user )
mail to : 'goodgodwin@hotmail.com' , subject : @subject
end
def contact ( from , subject , message , email_list )
@message = message
@from = from
@from = from . is_a? ( Integer ) ? User . find ( from ) : from
mail to : email_list . join ( ', ' ) , subject : @subject , reply_to : from . is_a? ( User ) ? from . named_email : from
end
def contact_details ( from , subject , message , request , params )
@message = message
@from = from
@from = from . is_a? ( Integer ) ? User . find ( from ) : from
@request = request
@params = params