Adding activity and form fields for user profiles

This commit is contained in:
Will Bradley 2013-08-29 02:27:48 -07:00
parent 37aba522cf
commit 8820dc4986
7 changed files with 71 additions and 11 deletions

View File

@ -8,6 +8,10 @@
.payment_links { background-color: #ddd; padding: 1em; border-radius: 1em; .payment_links { background-color: #ddd; padding: 1em; border-radius: 1em;
display: inline-block; float: right; } display: inline-block; float: right; }
.payment-highlighted {
background-color: orange !important;
}
.avatar { height: 2em; width: 2em; } .avatar { height: 2em; width: 2em; }
.avatar-large { .avatar-large {

View File

@ -33,9 +33,15 @@ class UsersController < ApplicationController
end end
end end
# 'Active' users who haven't paid recently
def inactive def inactive
@users = @users.all.select{|u| u if u.payment_status == false }.sort_by{ |u| -u.delinquency } @users = @users.all.select{|u| u if u.payment_status == false }.sort_by{ |u| -u.delinquency }
end end
# Recent user activity
def activity
@users = User.where(:last_sign_in_at => 1.month.ago..Date.today)
end
# GET /users/1 # GET /users/1
# GET /users/1.json # GET /users/1.json

View File

@ -1,12 +1,21 @@
<% if params[:flash] == "welcome_msg" then %> <% 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/> <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/><br/> You can get your payments started by clicking the payment button on this page or contacting a HeatSync member. <strong>Please note electronic recurring payments are -highly- encouraged</strong>-- we do not have paid staff. If you must pay via cash/check, please consider prepaying for 3, 6 or 12 months up front to reduce volunteer workload.<br/><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/><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 to schedule a New Member Orientation as well. After the orientation, you'll be equipped to be an awesome member of our community, and this website will get a lot more useful.<br/><br/>
Please also note that certain privileges like 24/7 card access require community approval.<br/><br/> Please also note that certain privileges like 24/7 card access require community approval.<br/><br/>
Thanks again, and happy hacking!</p> Thanks again, and happy hacking!</p>
<% end %> <% end %>
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => html) do |f| %> <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => html) do |f| %>
<div class="field">
<%= f.label :member_level, "Membership Level" %><br />
<%= f.select :member_level, [[nil],["None",0],["Unable",1],["Volunteer",10],["Associate ($25)",25],["Basic ($50)",50],["Plus ($100)",100]] %>
</div>
<div class="field">
<%= render :partial => "/users/payment_methods", :locals => { :g => f } %>
</div>
<div class="field"> <div class="field">
<%= f.label :name, "Full Name" %><br /> <%= f.label :name, "Full Name" %><br />
<%= f.text_field :name %> <%= f.text_field :name %>
@ -15,12 +24,28 @@ Thanks again, and happy hacking!</p>
<div class="field"> <div class="field">
<%= f.label :email %><br /> <%= f.label :email %><br />
<%= f.email_field :email %> <%= f.email_field :email %>
<%= f.check_box :email_visible %>
<%= f.label :email_visible, "Show Email to All Members?" %>
</div> </div>
<div class="field"> <div class="field">
<%= f.label :phone %><br /> <%= f.label :phone %><br />
<%= f.text_field :phone %> <%= f.text_field :phone %>
<%= f.check_box :phone_visible %>
<%= f.label :phone_visible, "Show Phone to All Members?" %>
</div> </div>
<div class="field">
<%= f.label :twitter_url %>
<%= f.text_field :twitter_url, :placeholder => "https://twitter.com/heatsynclabs" %><br/>
<%= f.label :facebook_url %>
<%= f.text_field :facebook_url, :placeholder => "https://www.facebook.com/HeatSyncLabs" %><br/>
<%= f.label :github_url %>
<%= f.text_field :github_url, :placeholder => "https://github.com/heatsynclabs" %><br/>
<%= f.label :website_url %>
<%= f.text_field :website_url, :placeholder => "http://www.heatsynclabs.org" %>
</div>
<div class="field"> <div class="field">
<%= f.label :emergency_name, "Emergency Contact Name" %><br /> <%= f.label :emergency_name, "Emergency Contact Name" %><br />
<%= f.text_field :emergency_name %> <%= f.text_field :emergency_name %>
@ -33,13 +58,6 @@ Thanks again, and happy hacking!</p>
<%= f.label :emergency_email %><br /> <%= f.label :emergency_email %><br />
<%= f.text_field :emergency_email %> <%= f.text_field :emergency_email %>
</div> </div>
<div class="field">
<%= f.label :member_level, "Membership Level" %><br />
<%= f.select :member_level, [[nil],["None",0],["Unable",1],["Volunteer",10],["Associate ($25)",25],["Basic ($50)",50],["Plus ($100)",100]] %>
</div>
<div class="field">
<%= render :partial => "/users/payment_methods", :locals => { :g => f } %>
</div>
<div class="field"> <div class="field">
<%= f.label :current_skills, "What skills, knowledge and experience do you bring to the community?" %><br /> <%= f.label :current_skills, "What skills, knowledge and experience do you bring to the community?" %><br />
<%= f.text_area :current_skills %> <%= f.text_area :current_skills %>

View File

@ -2,12 +2,12 @@
<%= devise_error_messages! %> <%= devise_error_messages! %>
<div class="payment_links"> <div class="payment_links <%= "payment-highlighted" if params[:flash] == "welcome_msg" %>">
<% if can? :read, resource.payments then %> <% if can? :read, resource.payments then %>
<h3>Recorded Payments:</h3> <h3>Recorded Payments:</h3>
<ul> <ul>
<% resource.payments.each do |payment| %> <% resource.payments.sort_by(&:date).reverse!.each do |payment| %>
<li><%= payment.date %></li> <li><%= payment.date %></li>
<% end %> <% end %>
</ul> </ul>

View File

@ -0,0 +1,30 @@
<h1>Recent User Activity</h1>
<table>
<tr>
<th>Current Sign In</th>
<th>Last Sign In</th>
<th>Sign In Count</th>
<th>Name</th>
<th>Account Created</th>
<th></th>
</tr>
<% if !@users.blank? %>
<% @users.sort_by(&:current_sign_in_at).reverse!.each do |user| %>
<tr<%= " class='hidden'" if user.hidden? %>>
<td><%= distance_of_time_in_words DateTime.now, user.current_sign_in_at %> ago</td>
<td>
<% if user.last_sign_in_at != user.current_sign_in_at %>
<%= distance_of_time_in_words DateTime.now, user.last_sign_in_at %> ago
<% end %>
</td>
<td><%= user.sign_in_count %> times</td>
<td><%= link_to user.name, user %></td>
<td><%= distance_of_time_in_words DateTime.now, user.created_at %> ago</td>
<td><%= link_to 'Edit', edit_user_path(user) if can? :update, user %></td>
</tr>
<% end %>
<% end %>
</table>

View File

@ -8,6 +8,7 @@
<% end %> <% end %>
<% if current_user.admin? %> <% if current_user.admin? %>
| <%= link_to 'Inactive Users', users_inactive_path %> | <%= link_to 'Inactive Users', users_inactive_path %>
| <%= link_to 'Recent Activity', users_activity_path %>
<% end %> <% end %>
<table> <table>
<col /> <col />

View File

@ -26,6 +26,7 @@ Dooraccess::Application.routes.draw do
end end
match 'user_summary/:id' => 'users#user_summary' # User summary view match 'user_summary/:id' => 'users#user_summary' # User summary view
match 'users/activity' => 'users#activity' # User activity
match 'users/merge' => 'users#merge_view', :via => :get # Merge view match 'users/merge' => 'users#merge_view', :via => :get # Merge view
match 'users/merge' => 'users#merge_action', :via => :post # Merge action match 'users/merge' => 'users#merge_action', :via => :post # Merge action
match 'users/inactive' => 'users#inactive' # Inactive users report match 'users/inactive' => 'users#inactive' # Inactive users report