Added mailer to notify on new user
This commit is contained in:
parent
50171effad
commit
1239d6682b
13
app/mailers/user_mailer.rb
Normal file
13
app/mailers/user_mailer.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
class UserMailer < ActionMailer::Base
|
||||
default :from => "wiki@heatsynclabs.org"
|
||||
|
||||
def new_user_email(user)
|
||||
@user = user
|
||||
@url = "http://members.heatsynclabs.org"
|
||||
|
||||
@admins = User.where(:name => "Will Bradley")
|
||||
@admins.each do |admin|
|
||||
mail(:to => admin.email, :subject => "New HeatSync Member")
|
||||
end
|
||||
end
|
||||
end
|
|
@ -15,6 +15,9 @@ class User < ActiveRecord::Base
|
|||
has_many :user_certifications
|
||||
has_many :certifications, :through => :user_certifications
|
||||
|
||||
after_create :send_new_user_email
|
||||
|
||||
|
||||
def member_status
|
||||
output = ""
|
||||
|
||||
|
@ -45,4 +48,12 @@ class User < ActiveRecord::Base
|
|||
|
||||
return output
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
def send_new_user_email
|
||||
Rails.logger.info UserMailer.new_user_email(self).deliver
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ Thanks again, and happy hacking!</p>
|
|||
|
||||
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => html) do |f| %>
|
||||
<div class="field">
|
||||
<%= f.label :name %><br />
|
||||
<%= f.label :name, "Full Name" %><br />
|
||||
<%= f.text_field :name %>
|
||||
</div>
|
||||
|
||||
|
@ -22,7 +22,7 @@ Thanks again, and happy hacking!</p>
|
|||
<%= f.text_field :phone %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :emergency_name, "Emergency contact" %><br />
|
||||
<%= f.label :emergency_name, "Emergency Contact Name" %><br />
|
||||
<%= f.text_field :emergency_name %>
|
||||
</div>
|
||||
<div class="field">
|
||||
|
@ -41,22 +41,22 @@ Thanks again, and happy hacking!</p>
|
|||
<%= render :partial => "/users/payment_methods", :locals => { :g => f } %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :current_skills %><br />
|
||||
<%= f.label :current_skills, "What skills, knowledge and experience do you bring to the community?" %><br />
|
||||
<%= f.text_area :current_skills %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :desired_skills %><br />
|
||||
<%= f.label :desired_skills, "What skills, knowledge and experiences are you looking for in HeatSync?" %><br />
|
||||
<%= f.text_area :desired_skills %>
|
||||
</div>
|
||||
|
||||
<div><%= f.label :password %><br />
|
||||
<div><%= f.label :password %><% if params[:action]!='new' %> <em>(Only if you want to change your password)</em><% end %><br />
|
||||
<%= f.password_field :password %></div>
|
||||
|
||||
<div><%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation %></div>
|
||||
|
||||
<% if params[:action]!='new' %>
|
||||
<div><%= f.label :current_password %><br />
|
||||
<div><%= f.label :current_password, "Type Your Current Password" %> <em>(For your account's security)</em><br />
|
||||
<%= f.password_field :current_password %></div>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<h2>Sign up</h2>
|
||||
<h2>Membership Application</h2>
|
||||
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<% if user_signed_in? then %><%= link_to 'Profile', edit_user_registration_path %><% end %>
|
||||
<%= link_to 'Logout', destroy_user_session_path, :method => :delete if user_signed_in? %>
|
||||
<%= link_to 'Login', new_user_session_path unless user_signed_in? %>
|
||||
<%= link_to 'Become a Member', new_user_registration_path unless user_signed_in? %>
|
||||
<%= link_to 'Membership Application', new_user_registration_path unless user_signed_in? %>
|
||||
</div>
|
||||
<div id="content">
|
||||
<p class="notice"><%= raw(notice) %></p>
|
||||
|
|
16
app/views/user_mailer/new_user_email.html.erb
Normal file
16
app/views/user_mailer/new_user_email.html.erb
Normal file
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||
</head>
|
||||
<body>
|
||||
<h2><%= @user.name %> just signed up.</h2>
|
||||
<p>
|
||||
Please contact them at <%= @user.email %><%= " or "+@user.phone.to_s unless @user.phone.blank? %> to set up a
|
||||
new user orientation, waiver, welcome, payment help, etc.<br/>
|
||||
</p>
|
||||
<p>
|
||||
To login to the site, just follow this link: <%= @url %>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
6
app/views/user_mailer/new_user_email.text.erb
Normal file
6
app/views/user_mailer/new_user_email.text.erb
Normal file
|
@ -0,0 +1,6 @@
|
|||
<%= @user.name %> just signed up.
|
||||
---
|
||||
Please contact them at <%= @user.email %><%= " or "+@user.phone.to_s unless @user.phone.blank? %> to set up a
|
||||
new user orientation, waiver, welcome, payment help, etc.
|
||||
|
||||
To login to the site, just follow this link: <%= @url %>
|
|
@ -17,7 +17,7 @@
|
|||
<% end %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :name %><br />
|
||||
<%= f.label :name, "Full Name" %><br />
|
||||
<%= f.text_field :name %>
|
||||
</div>
|
||||
<div class="field">
|
||||
|
@ -60,7 +60,7 @@
|
|||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :member_level, "Desired Member Level" %><br />
|
||||
<%= f.select :member_level, [[nil],["None",0],["Unable",1],["Volunteer",10],["Associate",25],["Basic",50],["Plus",100]] %>
|
||||
<%= f.select :member_level, [[nil],["None",0],["Unable",1],["Volunteer",10],["Associate ($25)",25],["Basic ($50)",50],["Plus ($100)",100]] %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= render :partial => "/users/payment_methods", :locals => { :g => f } %>
|
||||
|
@ -70,11 +70,11 @@
|
|||
<%= f.text_field :phone %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :current_skills %><br />
|
||||
<%= f.label :current_skills, "What skills, knowledge and experience do you bring to the community?" %><br />
|
||||
<%= f.text_area :current_skills %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :desired_skills %><br />
|
||||
<%= f.label :desired_skills, "What skills, knowledge and experiences are you looking for in HeatSync?" %><br />
|
||||
<%= f.text_area :desired_skills %>
|
||||
</div>
|
||||
<div class="field">
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<% @payment_methods = [[nil],["PayPal"],["Dwolla"],["Bill Pay","BillPay"],["Check"],["Cash"],["Other"]]
|
||||
@payment_instructions = {nil => nil,
|
||||
:PayPal => "Set up a monthly recurring payment to hslfinances@gmail.com",
|
||||
:Dwolla => "Set up a monthly recurring payment to hslfinances@gmail.com",
|
||||
:PayPal => "Set up a monthly recurring payment to hslfinances@gmail.com or via the button on the next page.",
|
||||
:Dwolla => "Set up a monthly recurring payment to hslfinances@gmail.com or via the button on the next page.",
|
||||
:BillPay => "Have your bank send a monthly check to HeatSync Labs Treasurer, 140 W Main St, Mesa AZ 85201",
|
||||
:Check => "Mail to HeatSync Labs Treasurer, 140 W Main St, Mesa AZ 85201 OR put in the drop safe at the Lab with a deposit slip firmly attached each month.",
|
||||
:Cash => "Put in the drop safe at the Lab with a deposit slip firmly attached each month.",
|
||||
:Other => "Hmm... talk to a Treasurer!"} %>
|
||||
|
||||
<%= g.label :payment_method %> <i>(after changing this, please make sure you update your payment service, it's not automatic.)</i><br />
|
||||
<%= g.label :payment_method %><% if params[:action] != 'new' %> <i>(after changing this, please make sure you update your payment service, it's not automatic.)</i><% end %><br />
|
||||
<%= g.select :payment_method, @payment_methods %>
|
||||
<% @payment_instructions.each_pair do |key, value| %>
|
||||
<span class="payment_instructions" id="pmt_<%= key %>"><%= value %></span>
|
||||
|
|
7
test/functional/user_mailer_test.rb
Normal file
7
test/functional/user_mailer_test.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class UserMailerTest < ActionMailer::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
Loading…
Reference in New Issue
Block a user