Lots of styling; avatars, payment methods, and more.

This commit is contained in:
Will Bradley 2013-01-26 02:21:41 -07:00
parent 8ab6fa10ea
commit 1865123201
21 changed files with 147 additions and 18 deletions

View File

@ -43,3 +43,4 @@ gem 'bcrypt-ruby', '~> 3.0.0'
# gem 'ruby-debug'
#gem "paperclip", "~> 3.0"
gem 'gravtastic'

View File

@ -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)

BIN
app/assets/images/nil.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

View File

@ -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()

View File

@ -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;

View File

@ -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; }

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,4 @@
<h1>Listing cards</h1>
<h1>Access Cards</h1>
<%= link_to 'New Card', new_card_path if can? :create, Card %>
<%= link_to 'Upload all cards', upload_all_path if can? :upload_all, Card %>

View File

@ -1,4 +1,4 @@
<h1>Listing certifications</h1>
<h1>Certification Classes</h1>
<%= link_to 'Create Certification', new_certification_path if can? :create, Certification %>

View File

@ -1,3 +1,11 @@
<% if params[:flash] == "welcome_msg" then %>
<p class="notice"><strong>Thank for you choosing to become a HeatSync Labs member!</strong> As we foster this community of learning, science, and the arts every member is important. <br/><br/>
You can get your payments started by following the instructions on this page. <strong>Please note electronic recurring payments are -highly- encouraged</strong>-- we do not have staff. If you must pay via cash/check, please consider prepaying for 3, 6 or 12 months up front.<br/>
<strong>To claim member benefits</strong> 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.<br/>
Please also note that certain privileges like 24/7 card access require community approval.<br/>
Thanks again, and happy hacking!</p>
<% end %>
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => html) do |f| %>
<div class="field">
<%= f.label :name %><br />

View File

@ -2,6 +2,67 @@
<%= devise_error_messages! %>
<div class="payment_links">
<% if resource.payment_method == "Dwolla" %>
<h3>Dwolla Payment Link</h3>
<% if resource.member_level == "25" %>
<strong>Associate Membership ($25/mo):</strong>
<a href="http://members.heatsynclabs.org/users/edit" class="dwolla_button" data-name="Associate Membership" data-desc="$25/month membership" data-amount="25" data-shipping="0" data-tax="0" data-key="8nMi2WmI7F8uXVlSNNDmX2o2Cgh9Af8dfJGIrd7ZrgyjNfLIxj">Subscribe</a>
<% elsif resource.member_level == "50" %>
<strong>Basic Membership ($50/mo):</strong>
<a href="http://members.heatsynclabs.org/users/edit" class="dwolla_button" data-name="Basic Membership" data-desc="$50/month membership" data-amount="50" data-shipping="0" data-tax="0" data-key="8nMi2WmI7F8uXVlSNNDmX2o2Cgh9Af8dfJGIrd7ZrgyjNfLIxj">Subscribe</a>
<% elsif resource.member_level == "100" %>
<strong>Plus Membership ($100/mo):</strong>
<a href="http://members.heatsynclabs.org/users/edit" class="dwolla_button" data-name="Plus Membership" data-desc="$100/month membership" data-amount="100" data-shipping="0" data-tax="0" data-key="8nMi2WmI7F8uXVlSNNDmX2o2Cgh9Af8dfJGIrd7ZrgyjNfLIxj">Subscribe</a>
<% else %>
Hmm, your membership level doesn't appear to be at $25/50/100...
<% end %>
<script type="text/javascript" src="https://www.dwolla.com/scripts/button.min.js"> </script>
<% elsif resource.payment_method == "PayPal" %>
<h3>PayPal Payment Link</h3>
<% if resource.member_level == "25" %>
<strong>Associate Membership ($25/mo):</strong>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="SZWVLPAG79XCN">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
<% elsif resource.member_level == "50" %>
<strong>Basic Membership ($50/mo):</strong>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="GEAMCMZZKC4AW">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
<% elsif resource.member_level == "100" %>
<strong>Plus Membership ($100/mo):</strong>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="L7XVC2GUJJR5A">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
<% else %>
Hmm, your membership level doesn't appear to be at $25/50/100...
<% end %>
<% elsif resource.payment_method == "BillPay" %>
<h3>Bill Pay Info</h3>
<p>Have your bank send a monthly check to HeatSync Labs Treasurer, 140 W Main St, Mesa AZ 85201 <strong>Electronic or advance payments are appreciated!</strong></p>
<% elsif resource.payment_method == "Check" %>
<h3>Check Payment Info</h3>
<p>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. <strong>Electronic or advance payments are appreciated!</strong></p>
<% elsif resource.payment_method == "Cash" %>
<p>Put in the drop safe at the Lab with a deposit slip firmly attached each month. <strong>Electronic or advance payments are appreciated!</strong></p>
<% else %>
<h3>Payment Links</h3>
<p>Normally you'd see payment buttons here, but you don't seem to have an electronic payment option selected...</p>
<% end %>
</div>
<%= 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" %>

View File

@ -1,4 +1,4 @@
<h1>Listing door_logs</h1>
<h1>Door Logs</h1>
<%= link_to 'Download Door Logs', download_path %>
<a href="#" onclick="$('#log-guide').toggle();">Show Log Guide</a>

View File

@ -1,5 +1,9 @@
<h1>Welcome to the HeatSync Labs Members App.</h1>
<% if !user_signed_in? then %>
<p>You can sign up to become a member here, but you'll need to visit the lab to get full access.</p>
<% end %>
<% 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 %>

View File

@ -1,29 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<title>Dooraccess</title>
<title>hsl_members(<%= controller.controller_name %>.<%= controller.action_name %><%= "["+params[:id]+"]" unless params[:id].blank? %>)</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<div id="header">
<%= link_to 'Users', users_path if can? :read, User %>
<%= link_to 'Cards', cards_path if can? :manage, Card %>
<%= link_to 'People', users_path if can? :read, User %>
<%= link_to 'Access Cards', cards_path if can? :manage, Card %>
<% if can? :manage, UserCertification %>
<%= link_to 'Cert Classes', certifications_path if can? :read, Certification %>
<%= link_to 'User Certs', user_certifications_path if can? :create, UserCertification %>
<% else %>
<%= link_to 'Certifications', certifications_path if can? :read, Certification %>
<% end %>
<%= link_to 'Logs', door_logs_path if can? :read, DoorLog %>
<%= link_to 'Door Logs', door_logs_path if can? :read, DoorLog %>
<% if user_signed_in? then %><%= link_to 'Profile', edit_user_registration_path %><% end %>
<%= link_to 'Sign out', destroy_user_session_path, :method => :delete if user_signed_in? %>
<%= link_to 'Sign in', new_user_session_path unless user_signed_in? %>
<%= 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? %>
</div>
<p class="notice"><%= raw(notice) %></p>
<p class="alert"><%= raw(alert) %></p>
<div id="content">
<%= yield %>
</div>
</body>
</html>

View File

@ -1,4 +1,4 @@
<h1>Listing User Certifications</h1>
<h1>User Certifications</h1>
<%= link_to 'New User Certification', new_user_certification_path %>

View File

@ -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 %> <i>(after changing this, please update your payment method to match.)</i><br />
<%= g.label :payment_method %> <i>(after changing this, please make sure you update your payment service, it's not automatic.)</i><br />
<%= g.select :payment_method, @payment_methods %>
<% @payment_instructions.each_pair do |key, value| %>
<span class="payment_instructions" id="pmt_<%= key %>"><%= value %></span>

View File

@ -1,9 +1,10 @@
<h1>Listing users</h1>
<h1>HeatSync People</h1>
<% if can? :create, User %>
<%= link_to 'New User', new_user_path %>
<% end %>
<table>
<col />
<col />
<% if current_user.admin? then %><col /><% end %>
<col />
@ -14,6 +15,7 @@
<col />
<col class="col_highlight" />
<tr>
<th></th>
<th><a href="?sort=name">Name</a></th>
<% if current_user.admin? then %><th><a href="?sort=email">Email</a></th><% end %>
<th><a href="?sort=certifications">Certifications</a></th>
@ -32,6 +34,7 @@
<% if !@users.blank? %>
<% @users.each do |user| %>
<tr<%= " class='hidden'" if user.hidden? %>>
<td><%= image_tag user.gravatar_url(:default => "http://members.heatsynclabs.org/assets/nil.png"), :class => :avatar %></td>
<td><%= link_to user.name, user %></td>
<% if current_user.admin? then %><td><%= user.email %></td><% end %>
<td><% user.certifications.each do |c| %>
@ -52,4 +55,8 @@
<% end %>
</table>
<% if current_user.orientation.blank? then %>
<p class="alert">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.</p>
<% end %>
<br />

View File

@ -1,3 +1,4 @@
<%= image_tag @user.gravatar_url(:default => "http://members.heatsynclabs.org/assets/nil.png") %>
<p>
<b>Name:</b>

View File

@ -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