Trying to get dynamic helptext for selecting payment methods

This commit is contained in:
Will Bradley 2013-01-25 22:30:05 -07:00
parent e9c648d36e
commit 8ab6fa10ea
10 changed files with 52 additions and 7 deletions

View File

@ -1,3 +1,6 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
jQuery ->
$('#user_payment_method').change ->
$('#pmt_'+$(this).value).css('display: inline')

View File

@ -75,3 +75,5 @@ dt { font-weight: bold; }
.notice { color: green; }
.alert { color: red; }
.hidden, .hidden a { color: #ccc; }
.payment_instructions { display: none }

View File

@ -4,3 +4,5 @@
.iconinfo, .hoverinfo { font-size: 1.5em; }
.hoverinfo { cursor: progress; }
textarea { height: 10em; }

View File

@ -3,8 +3,13 @@ class ApplicationController < ActionController::Base
rescue_from CanCan::AccessDenied do |exception|
if !current_user.nil? && current_user.orientation.blank? then
flash[:alert] = "Sorry, you need to complete New Member Orientation before having access to this page. <br/>Please check your email and schedule a New Member Orientation with a volunteer."
redirect_to root_url
flash[:alert] = "Sorry, you probably need to complete New Member Orientation before having access to this page. <br/>Please check your email and schedule a New Member Orientation with a volunteer."
else
flash[:alert] = "Nothing to see here!"
end
redirect_to root_url
end
@payment_methods = [[nil],["PayPal"],["Dwolla"],["Bill Pay"],["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", :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!"}
end

View File

@ -1,6 +1,15 @@
class HomeController < ApplicationController
def index
@num_certs = UserCertification.count
@recent_certs = UserCertification.where("created_at > ?", DateTime.now - 7.days).count
@num_users = User.count
@recent_users = User.where("created_at > ?", DateTime.now - 7.days).count
@num_door_opens = DoorLog.where("key = 'G'").count
@recent_door_opens = DoorLog.where("key = 'G' AND created_at > ?", DateTime.now - 7.days).count
@num_door_denieds = DoorLog.where("key = 'D'").count
@recent_door_denieds = DoorLog.where("key = 'D' AND created_at > ?", DateTime.now - 7.days).count
respond_to do |format|
format.html # index.html.erb
end

View File

@ -1,2 +1,4 @@
module ApplicationHelper
@payment_methods = [[nil],["PayPal"],["Dwolla"],["Bill Pay"],["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", :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!"}
end

View File

@ -30,8 +30,7 @@
<%= f.select :member_level, [[nil],["None",0],["Unable",1],["Volunteer",10],["Associate ($25)",25],["Basic ($50)",50],["Plus ($100)",100]] %>
</div>
<div class="field">
<%= f.label :payment_method %> <i>(after changing this, please update your payment method to match.)</i><br />
<%= f.select :payment_method, [[nil],["PayPal"],["Dwolla"],["Bill Pay"],["Check"],["Cash"],["Other"]] %>
<%= render :partial => "/users/payment_methods", :locals => { :g => f } %>
</div>
<div class="field">
<%= f.label :current_skills %><br />

View File

@ -1 +1,16 @@
<p>Welcome to the HeatSync Labs Members App.</p>
<h1>Welcome to the HeatSync Labs Members App.</h1>
<p>You can sign up to become a member here, but you'll need to visit the lab to get full access.</p>
<% if user_signed_in? && current_user.member.to_i < current_user.member_level.to_i then %>
<p class="alert">Looks like we haven't acknowledged a recent payment for you yet. This could be because we're slow, or this app just got started, but if in doubt please see your profile for payment instructions, or consider updating your membership level to something accurate.<br/>Thanks for supporting HeatSync!</p>
<% end %>
<h2>Cool Stats:</h2>
<dl>
<dt># of People in this DB:</dt>
<dd><%= @num_users %> (<%= @recent_users %> in the last 7 days)</dd>
<dt># of People Certified:</dt>
<dd><%= @num_certs %> (<%= @recent_certs %> in the last 7 days)</dd>
<dt># of Accesses Granted:</dt>
<dd><%= @num_door_opens %> (<%= @recent_door_opens %> in the last 7 days)</dd>
<dt># of Accesses Denied:</dt>
<dd><%= @num_door_denieds %> (<%= @recent_door_denieds %> in the last 7 days)</dd>
</dl>

View File

@ -63,8 +63,7 @@
<%= f.select :member_level, [[nil],["None",0],["Unable",1],["Volunteer",10],["Associate",25],["Basic",50],["Plus",100]] %>
</div>
<div class="field">
<%= f.label :payment_method %><br />
<%= f.select :payment_method, [[nil],["PayPal"],["Dwolla"],["Bill Pay"],["Check"],["Cash"],["Other"]] %>
<%= render :partial => "/users/payment_methods", :locals => { :g => f } %>
</div>
<div class="field">
<%= f.label :phone %><br />

View File

@ -0,0 +1,9 @@
<% @payment_methods = [[nil],["PayPal"],["Dwolla"],["Bill Pay"],["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", "Bill Pay" => "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 update your payment method to match.)</i><br />
<%= g.select :payment_method, @payment_methods %>
<% @payment_instructions.each_pair do |key, value| %>
<span class="payment_instructions" id="pmt_<%= key %>"><%= value %></span>
<% end %>