Skip to content

Commit

Permalink
add ability for campaign admin to enter a contact phone number
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt LeBel committed Nov 28, 2013
1 parent 062b9ed commit 0c4b2e1
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 5 deletions.
4 changes: 4 additions & 0 deletions app/assets/javascripts/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ $( document ).ready(function() {
rules: {
"settings[site_name]": { required: true },
"settings[reply_to_email]": { required: true, email: true },
"settings[phone_number]": { phoneUS: true },
"settings[header_link_url]": { url: true },
"settings[tweet_text]": { maxlength: 120 },
"settings[facebook_app_id]": { digits: true },
Expand All @@ -34,6 +35,9 @@ $( document ).ready(function() {
required: "Please enter a reply to email address",
email: "Hmm. That doesn't look like a valid email"
},
"settings[phone_number]": {
phoneUS: "Hmm. That doesn't look like a valid phone number. <br> ex: 555-555-5555"
},
"settings[header_link_url]": {
url: "Hmm. That doesn't look like a valid URL. ex: http://crowdtilt.com"
},
Expand Down
2 changes: 1 addition & 1 deletion app/models/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Settings < ActiveRecord::Base
:logo_image, :logo_image_delete, :copyright_text, :facebook_title,
:facebook_description, :facebook_image, :facebook_image_delete, :homepage_content,
:custom_css, :header_link_text, :header_link_url, :ct_sandbox_guest_id, :ct_production_guest_id,
:ct_sandbox_admin_id, :ct_production_admin_id, :reply_to_email, :custom_js, :default_campaign_id, :indexable
:ct_sandbox_admin_id, :ct_production_admin_id, :reply_to_email, :custom_js, :default_campaign_id, :indexable, :phone_number

attr_accessor :logo_image_delete, :facebook_image_delete

Expand Down
5 changes: 5 additions & 0 deletions app/views/admin/admin_website.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
<label>Reply To Email</label>
<%= f.text_field :reply_to_email %>
</div>
<div class="field clearfix">
<p class="explanation">Enter a phone number where contributors can reach you.</p>
<label>Contact Phone Number (Optional)</label>
<%= f.text_field :phone_number %>
</div>

<div class="field clearfix">
<p class="explanation">If you would like to display a logo instead of your site name in the header, upload it here. Resize the image before uploading for best results in your template.</p>
Expand Down
2 changes: 1 addition & 1 deletion app/views/user_mailer/payment_confirmation.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Hi <%= @payment.fullname.split(' ')[0] %>,

<br/><br/>

This email is a confirmation of your $<%= number_with_precision(@payment.amount.to_f/100.0 + @payment.user_fee_amount.to_f/100.0, precision: 2) %> payment to <%= @campaign.name %>. If you have any questions about this campaign, please contact <%= @settings.reply_to_email %>.
This is an email receipt for your $<%= number_with_precision(@payment.amount.to_f/100.0 + @payment.user_fee_amount.to_f/100.0, precision: 2) %> contribution to <a href="<%= url_for campaign_home_url(@campaign) %>"><%= @campaign.name %></a>. If you have any questions about this campaign, please contact the campaign's organizer at <%= @settings.reply_to_email %><% if @settings.phone_number.present? %> or <%= @settings.phone_number %><% end %>.

<br/><br/>

Expand Down
2 changes: 1 addition & 1 deletion app/views/user_mailer/payment_confirmation.text.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Hi <%= @payment.fullname.split(' ')[0] %>,

This email is a confirmation of your $<%= number_with_precision(@payment.amount.to_f/100.0 + @payment.user_fee_amount.to_f/100.0, precision: 2) %> payment to <%= @campaign.name %>. If you have any questions about this campaign, please contact <%= @settings.reply_to_email %>.
This is an email receipt for your $<%= number_with_precision(@payment.amount.to_f/100.0 + @payment.user_fee_amount.to_f/100.0, precision: 2) %> contribution to <%= @campaign.name %> (<%= url_for campaign_home_url(@campaign) %>). If you have any questions about this campaign, please contact the campaign's organizer at <%= @settings.reply_to_email %><% if @settings.phone_number.present? %> or <%= @settings.phone_number %><% end %>.

<% if [email protected]_flag %>
This campaign is in sandbox mode, your card will not actually be charged.
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20131128003747_add_phone_number_to_settings.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddPhoneNumberToSettings < ActiveRecord::Migration
def change
add_column :settings, :phone_number, :string
end
end
5 changes: 3 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20131007231616) do
ActiveRecord::Schema.define(:version => 20131128003747) do

create_table "campaigns", :force => true do |t|
t.string "name"
Expand Down Expand Up @@ -171,8 +171,9 @@
t.string "mailgun_route_id"
t.string "ct_prod_api_key"
t.string "ct_prod_api_secret"
t.integer "default_campaign_id"
t.boolean "indexable", :default => true
t.integer "default_campaign_id"
t.string "phone_number"
end

create_table "users", :force => true do |t|
Expand Down

0 comments on commit 0c4b2e1

Please sign in to comment.