diff --git a/app/assets/javascripts/users.js.coffee b/app/assets/javascripts/users.js.coffee index 7615679..c695add 100644 --- a/app/assets/javascripts/users.js.coffee +++ b/app/assets/javascripts/users.js.coffee @@ -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') diff --git a/app/assets/stylesheets/scaffolds.css.scss b/app/assets/stylesheets/scaffolds.css.scss index 02ff4b7..a427ef3 100644 --- a/app/assets/stylesheets/scaffolds.css.scss +++ b/app/assets/stylesheets/scaffolds.css.scss @@ -75,3 +75,5 @@ dt { font-weight: bold; } .notice { color: green; } .alert { color: red; } .hidden, .hidden a { color: #ccc; } + +.payment_instructions { display: none } diff --git a/app/assets/stylesheets/users.css.scss b/app/assets/stylesheets/users.css.scss index 39607aa..921e590 100644 --- a/app/assets/stylesheets/users.css.scss +++ b/app/assets/stylesheets/users.css.scss @@ -4,3 +4,5 @@ .iconinfo, .hoverinfo { font-size: 1.5em; } .hoverinfo { cursor: progress; } + +textarea { height: 10em; } diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6f71934..7f162a0 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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.
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.
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 diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 5606ef5..34f86eb 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -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 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..66caaa4 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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 diff --git a/app/views/devise/registrations/_user.html.erb b/app/views/devise/registrations/_user.html.erb index 346cb2e..762ea35 100644 --- a/app/views/devise/registrations/_user.html.erb +++ b/app/views/devise/registrations/_user.html.erb @@ -30,8 +30,7 @@ <%= f.select :member_level, [[nil],["None",0],["Unable",1],["Volunteer",10],["Associate ($25)",25],["Basic ($50)",50],["Plus ($100)",100]] %>
- <%= f.label :payment_method %> (after changing this, please update your payment method to match.)
- <%= f.select :payment_method, [[nil],["PayPal"],["Dwolla"],["Bill Pay"],["Check"],["Cash"],["Other"]] %> + <%= render :partial => "/users/payment_methods", :locals => { :g => f } %>
<%= f.label :current_skills %>
diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 070e4ae..229a0ba 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1 +1,16 @@ -

Welcome to the HeatSync Labs Members App.

+

Welcome to the HeatSync Labs Members App.

+

You can sign up to become a member here, but you'll need to visit the lab to get full access.

+<% if user_signed_in? && current_user.member.to_i < current_user.member_level.to_i then %> +

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.
Thanks for supporting HeatSync!

+<% end %> +

Cool Stats:

+
+
# of People in this DB:
+
<%= @num_users %> (<%= @recent_users %> in the last 7 days)
+
# of People Certified:
+
<%= @num_certs %> (<%= @recent_certs %> in the last 7 days)
+
# of Accesses Granted:
+
<%= @num_door_opens %> (<%= @recent_door_opens %> in the last 7 days)
+
# of Accesses Denied:
+
<%= @num_door_denieds %> (<%= @recent_door_denieds %> in the last 7 days)
+
diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb index aae514d..493dc35 100644 --- a/app/views/users/_form.html.erb +++ b/app/views/users/_form.html.erb @@ -63,8 +63,7 @@ <%= f.select :member_level, [[nil],["None",0],["Unable",1],["Volunteer",10],["Associate",25],["Basic",50],["Plus",100]] %>
- <%= f.label :payment_method %>
- <%= f.select :payment_method, [[nil],["PayPal"],["Dwolla"],["Bill Pay"],["Check"],["Cash"],["Other"]] %> + <%= render :partial => "/users/payment_methods", :locals => { :g => f } %>
<%= f.label :phone %>
diff --git a/app/views/users/_payment_methods.html.erb b/app/views/users/_payment_methods.html.erb new file mode 100644 index 0000000..72af497 --- /dev/null +++ b/app/views/users/_payment_methods.html.erb @@ -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 %> (after changing this, please update your payment method to match.)
+<%= g.select :payment_method, @payment_methods %> +<% @payment_instructions.each_pair do |key, value| %> + <%= value %> +<% end %> +