diff --git a/Gemfile b/Gemfile index a7ef364..8ecbde8 100644 --- a/Gemfile +++ b/Gemfile @@ -43,3 +43,4 @@ gem 'bcrypt-ruby', '~> 3.0.0' # gem 'ruby-debug' #gem "paperclip", "~> 3.0" +gem 'gravtastic' diff --git a/Gemfile.lock b/Gemfile.lock index 1161070..94abf55 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -47,6 +47,7 @@ GEM erubis (2.7.0) execjs (1.4.0) multi_json (~> 1.0) + gravtastic (3.2.6) hike (1.2.1) i18n (0.6.0) journey (1.0.4) @@ -120,6 +121,7 @@ DEPENDENCIES cancan coffee-rails (~> 3.2.1) devise + gravtastic jquery-rails json rails (= 3.2.3) diff --git a/app/assets/images/nil.png b/app/assets/images/nil.png new file mode 100644 index 0000000..85e0250 Binary files /dev/null and b/app/assets/images/nil.png differ diff --git a/app/assets/javascripts/users.js.coffee b/app/assets/javascripts/users.js.coffee index c695add..fad16ce 100644 --- a/app/assets/javascripts/users.js.coffee +++ b/app/assets/javascripts/users.js.coffee @@ -3,4 +3,5 @@ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ jQuery -> $('#user_payment_method').change -> - $('#pmt_'+$(this).value).css('display: inline') + $('.payment_instructions').hide() + $('#pmt_'+$(this).val()).show() diff --git a/app/assets/stylesheets/scaffolds.css.scss b/app/assets/stylesheets/scaffolds.css.scss index a427ef3..c56b92f 100644 --- a/app/assets/stylesheets/scaffolds.css.scss +++ b/app/assets/stylesheets/scaffolds.css.scss @@ -4,6 +4,7 @@ body { font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18px; + margin: 0; } p, ol, ul, td { @@ -35,10 +36,23 @@ div { } } +#header { + background-color: #eee; border: 1px solid #ddd; + border-bottom-left-radius: 1em; + border-bottom-right-radius: 1em; + padding: 0.5em; +} + +#header a { + margin-right: 1em; +} + #notice { color: green; } +#content { margin: 1em; } + .field_with_errors { padding: 2px; background-color: red; diff --git a/app/assets/stylesheets/users.css.scss b/app/assets/stylesheets/users.css.scss index 921e590..d372b96 100644 --- a/app/assets/stylesheets/users.css.scss +++ b/app/assets/stylesheets/users.css.scss @@ -5,4 +5,9 @@ .iconinfo, .hoverinfo { font-size: 1.5em; } .hoverinfo { cursor: progress; } +.payment_links { background-color: #ddd; padding: 1em; border-radius: 1em; + display: inline-block; float: right; } + +.avatar { height: 2em; width: 2em; } + textarea { height: 10em; } diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb new file mode 100644 index 0000000..a893c77 --- /dev/null +++ b/app/controllers/registrations_controller.rb @@ -0,0 +1,14 @@ +class RegistrationsController < Devise::RegistrationsController + protected + + # After signup + def after_sign_up_path_for(resource) + '/users/edit/?flash=welcome_msg' + end + + # After edit + def after_update_path_for(resource) + '/users/edit' + end + +end diff --git a/app/models/ability.rb b/app/models/ability.rb index 1c4ae6d..4ed0b2d 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -17,7 +17,7 @@ class Ability # Instructors can manage certs and see users if user.instructor? can :manage, Certification - can [:create,:read], User + can [:create,:read], User, :hidden => [nil,false] can :manage, UserCertification end # Users can see others' stuff if they've been oriented diff --git a/app/models/user.rb b/app/models/user.rb index d987add..f74b7a2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,4 +1,7 @@ class User < ActiveRecord::Base + include Gravtastic + gravtastic :size => 120, :default => "" + # Include default devise modules. Others available are: # :token_authenticatable, :confirmable, # :lockable, :timeoutable and :omniauthable diff --git a/app/views/cards/index.html.erb b/app/views/cards/index.html.erb index 53ff18d..1e02060 100644 --- a/app/views/cards/index.html.erb +++ b/app/views/cards/index.html.erb @@ -1,4 +1,4 @@ -

Listing cards

+

Access Cards

<%= link_to 'New Card', new_card_path if can? :create, Card %> <%= link_to 'Upload all cards', upload_all_path if can? :upload_all, Card %> diff --git a/app/views/certifications/index.html.erb b/app/views/certifications/index.html.erb index 222caf2..0ffc078 100644 --- a/app/views/certifications/index.html.erb +++ b/app/views/certifications/index.html.erb @@ -1,4 +1,4 @@ -

Listing certifications

+

Certification Classes

<%= link_to 'Create Certification', new_certification_path if can? :create, Certification %> diff --git a/app/views/devise/registrations/_user.html.erb b/app/views/devise/registrations/_user.html.erb index 762ea35..9a8e514 100644 --- a/app/views/devise/registrations/_user.html.erb +++ b/app/views/devise/registrations/_user.html.erb @@ -1,3 +1,11 @@ +<% if params[:flash] == "welcome_msg" then %> +

Thank for you choosing to become a HeatSync Labs member! As we foster this community of learning, science, and the arts every member is important.

+You can get your payments started by following the instructions on this page. Please note electronic recurring payments are -highly- encouraged-- we do not have staff. If you must pay via cash/check, please consider prepaying for 3, 6 or 12 months up front.
+To claim member benefits such as storage, grab a volunteer during your next stop into HeatSync or schedule a time to meet up in advance. Someone should also be contacting you shortly via the email address you provided.
+Please also note that certain privileges like 24/7 card access require community approval.
+Thanks again, and happy hacking!

+<% end %> + <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => html) do |f| %>
<%= f.label :name %>
diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 328e723..258f930 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -2,6 +2,67 @@ <%= devise_error_messages! %> + + +<%= link_to image_tag(resource.gravatar_url), "https://www.gravatar.com", :title => "Adjust your photo at Gravatar.com" %> + <%= render :partial => "user", :locals => { :resource => resource, :html => { :method => :put }, :button_label => "Update Profile" } %> <%= render "devise/shared/links" %> diff --git a/app/views/door_logs/index.html.erb b/app/views/door_logs/index.html.erb index 7578aca..7366721 100644 --- a/app/views/door_logs/index.html.erb +++ b/app/views/door_logs/index.html.erb @@ -1,4 +1,4 @@ -

Listing door_logs

+

Door Logs

<%= link_to 'Download Door Logs', download_path %> Show Log Guide diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 229a0ba..8191c06 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,5 +1,9 @@

Welcome to the HeatSync Labs Members App.

+ +<% if !user_signed_in? then %>

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

+<% end %> + <% 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 %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index b682488..40be030 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,29 +1,31 @@ - Dooraccess + hsl_members(<%= controller.controller_name %>.<%= controller.action_name %><%= "["+params[:id]+"]" unless params[:id].blank? %>) <%= stylesheet_link_tag "application", :media => "all" %> <%= javascript_include_tag "application" %> <%= csrf_meta_tags %>

<%= raw(notice) %>

<%= raw(alert) %>

+
<%= yield %> - +
diff --git a/app/views/user_certifications/index.html.erb b/app/views/user_certifications/index.html.erb index 7d3b3d3..391f4fc 100644 --- a/app/views/user_certifications/index.html.erb +++ b/app/views/user_certifications/index.html.erb @@ -1,4 +1,4 @@ -

Listing User Certifications

+

User Certifications

<%= link_to 'New User Certification', new_user_certification_path %> diff --git a/app/views/users/_payment_methods.html.erb b/app/views/users/_payment_methods.html.erb index 72af497..dac3d25 100644 --- a/app/views/users/_payment_methods.html.erb +++ b/app/views/users/_payment_methods.html.erb @@ -1,7 +1,13 @@ -<% @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!"} %> +<% @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", +: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 %> (after changing this, please update your payment method to match.)
+<%= g.label :payment_method %> (after changing this, please make sure you update your payment service, it's not automatic.)
<%= g.select :payment_method, @payment_methods %> <% @payment_instructions.each_pair do |key, value| %> <%= value %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 33023ea..86e0346 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -1,9 +1,10 @@ -

Listing users

+

HeatSync People

<% if can? :create, User %> <%= link_to 'New User', new_user_path %> <% end %> + <% if current_user.admin? then %><% end %> @@ -14,6 +15,7 @@ + <% if current_user.admin? then %><% end %> @@ -32,6 +34,7 @@ <% if !@users.blank? %> <% @users.each do |user| %> <% if current_user.admin? then %><% end %>
NameEmailCertifications<%= image_tag user.gravatar_url(:default => "http://members.heatsynclabs.org/assets/nil.png"), :class => :avatar %> <%= link_to user.name, user %><%= user.email %><% user.certifications.each do |c| %> @@ -52,4 +55,8 @@ <% end %>
+<% if current_user.orientation.blank? then %> +

There's a lot more to see here, but our records show you haven't completed the new member orientation yet. If that's incorrect, please contact a volunteer.

+<% end %> +
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 678bb76..3460322 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,3 +1,4 @@ +<%= image_tag @user.gravatar_url(:default => "http://members.heatsynclabs.org/assets/nil.png") %>

Name: diff --git a/config/routes.rb b/config/routes.rb index 52f7666..2030948 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,7 +10,7 @@ Dooraccess::Application.routes.draw do :only => [:new, :create, :edit, :update], :path => 'users', :path_names => { :new => 'sign_up' }, - :controller => 'devise/registrations', + :controller => 'registrations', :as => :user_registration do get :cancel end