Merge branch 'master' of github.com:zyphlar/Open-Source-Access-Control-Web-Interface

This commit is contained in:
Will Bradley 2014-04-10 21:05:29 -07:00
commit 18a52b4fca
18 changed files with 166 additions and 126 deletions

View File

@ -3,7 +3,6 @@ source 'https://rubygems.org'
ruby '1.9.3' ruby '1.9.3'
gem 'rails', '3.2.8' gem 'rails', '3.2.8'
gem 'dotenv-rails' gem 'dotenv-rails'
# Bundle edge Rails instead: # Bundle edge Rails instead:

View File

@ -18,6 +18,7 @@ class ContractsController < ApplicationController
def create def create
Rails.logger.info "CONTRACT" Rails.logger.info "CONTRACT"
Rails.logger.info @contract.inspect Rails.logger.info @contract.inspect
@contract.created_by = current_user
respond_to do |format| respond_to do |format|
if @contract.save if @contract.save
format.html { redirect_to @contract, :notice => 'Contract was successfully created.' } format.html { redirect_to @contract, :notice => 'Contract was successfully created.' }
@ -51,6 +52,6 @@ class ContractsController < ApplicationController
end end
def load_users def load_users
@users = @users = User.accessible_by(current_ability).sort_by(&:name) @users = User.accessible_by(current_ability).sort_by(&:name)
end end
end end

View File

@ -1,38 +1,54 @@
class HomeController < ApplicationController class HomeController < ApplicationController
layout 'resources'
def index def index
@num_certs = UserCertification.count # Alerts
@recent_certs = UserCertification.where("created_at > ?", DateTime.now - 7.days).count if user_signed_in? && current_user.orientation.blank? then
@num_users = User.count flash[: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."
@recent_users = User.where("created_at > ?", DateTime.now - 7.days).count end
# Payments: member levels are multipled by 10 to indicate current payment; 25 x 10 = 250 if user_signed_in? && current_user.member_status.between?(2,100) then
@num_paid_users = User.all.select{|u| u.member_status >= 250 }.count flash[:alert] = "<!--
@num_plus_users = User.all.select{|u| u.member_status == 1000 }.count Member: <%= current_user.member.inspect
@num_basic_users = User.all.select{|u| u.member_status == 500 }.count Level: <%= current_user.member_level.inspect
@num_associate_users = User.all.select{|u| u.member_status == 250 }.count -->
@num_delinquent_users = User.all.select{|u| !u.payment_status }.count Looks like we haven't acknowledged a recent payment for you yet. This could be because we're slow, but if in doubt please see your profile for payment instructions, consider updating your membership level to something accurate, or contact us.<br/>Thanks for supporting us!"
if can? :read, User then
@recent_user_names = User.where("member_level > 10").accessible_by(current_ability).order('created_at desc').limit(5)
end
@num_door_opens = DoorLog.where("key = 'G'").count
@today_door_opens = DoorLog.where("key = 'G' AND created_at > ?", DateTime.now - 1.day).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 - 1.month).count
@num_logins = User.sum('sign_in_count')
@recent_logins = User.where('current_sign_in_at > ?',Date.today - 7.days).count
@num_macs = Mac.count
@recent_macs = Mac.where("since > ?", DateTime.now - 1.day).count
respond_to do |format|
format.html # index.html.erb
end end
end
def more_info # Fun Stats
respond_to do |format| @featured_resource = Resource.where("picture_file_name IS NOT NULL").sample
format.html # more_info.html.erb
@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
# Payments: member levels are multipled by 10 to indicate current payment; 25 x 10 = 250
@num_paid_users = User.all.select{|u| u.member_status >= 250 }.count
@num_plus_users = User.all.select{|u| u.member_status == 1000 }.count
@num_basic_users = User.all.select{|u| u.member_status == 500 }.count
@num_associate_users = User.all.select{|u| u.member_status == 250 }.count
@num_delinquent_users = User.all.select{|u| !u.payment_status }.count
if can? :read, User then
@recent_user_names = User.where("member_level > 10").accessible_by(current_ability).order('created_at desc').limit(5)
end
@num_door_opens = DoorLog.where("key = 'G'").count
@today_door_opens = DoorLog.where("key = 'G' AND created_at > ?", DateTime.now - 1.day).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 - 1.month).count
@num_logins = User.sum('sign_in_count')
@recent_logins = User.where('current_sign_in_at > ?',Date.today - 7.days).count
@num_macs = Mac.count
@recent_macs = Mac.where("since > ?", DateTime.now - 1.day).count
respond_to do |format|
format.html # index.html.erb
end
end
def more_info
respond_to do |format|
format.html # more_info.html.erb
end
end end
end
end end

View File

@ -1,6 +1,7 @@
class UsersController < ApplicationController class UsersController < ApplicationController
load_and_authorize_resource load_and_authorize_resource
before_filter :authenticate_user! before_filter :authenticate_user!
layout 'resources'
def sort_by_cert(certs,id) def sort_by_cert(certs,id)
result = 0 result = 0
@ -124,6 +125,9 @@ class UsersController < ApplicationController
# POST /users # POST /users
# POST /users.json # POST /users.json
def create def create
# update oriented_by only if orientation has been set
@user.oriented_by_id = current_user.id unless @user.orientation.blank?
respond_to do |format| respond_to do |format|
if @user.save if @user.save
format.html { redirect_to @user, :notice => 'User was successfully created.' } format.html { redirect_to @user, :notice => 'User was successfully created.' }
@ -138,6 +142,10 @@ class UsersController < ApplicationController
# PUT /users/1 # PUT /users/1
# PUT /users/1.json # PUT /users/1.json
def update def update
# update oriented_by only if it's blank but the (new) orientation isn't blank
# gotta test the params because they don't get applied til below.
@user.oriented_by_id = current_user.id if @user.oriented_by.blank? && (!params[:user]["orientation(1i)"].blank?)
respond_to do |format| respond_to do |format|
if @user.update_attributes(params[:user]) if @user.update_attributes(params[:user])
format.html { redirect_to @user, :notice => 'User was successfully updated.' } format.html { redirect_to @user, :notice => 'User was successfully updated.' }

View File

@ -1,6 +1,10 @@
class Contract < ActiveRecord::Base class Contract < ActiveRecord::Base
belongs_to :user belongs_to :user
attr_accessible :user_id, :first_name, :last_name, :cosigner, :signed_at, :document, :document_file_name, :document_content_type, :document_file_size, :document_updated_at belongs_to :created_by, :foreign_key => "created_by_id", :class_name => "User"
attr_accessible :user_id, :first_name, :last_name, :cosigner,
:signed_at, :document, :document_file_name, :document_content_type,
:document_file_size, :document_updated_at
# :created_by not accessible for security purposes
validates_presence_of :first_name, :signed_at #, :last_name validates_presence_of :first_name, :signed_at #, :last_name

View File

@ -11,6 +11,7 @@ class User < ActiveRecord::Base
# Setup accessible (or protected) attributes for your model # Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me, :name, :admin, :instructor, :member, :emergency_name, :emergency_phone, :current_skills, :desired_skills, :waiver, :emergency_email, :phone, :payment_method, :orientation, :member_level, :certifications, :hidden, :marketing_source, :payee, :accountant, :exit_reason, :twitter_url, :facebook_url, :github_url, :website_url, :email_visible, :phone_visible, :postal_code #TODO: make admin/instructor/member/etc not accessible attr_accessible :email, :password, :password_confirmation, :remember_me, :name, :admin, :instructor, :member, :emergency_name, :emergency_phone, :current_skills, :desired_skills, :waiver, :emergency_email, :phone, :payment_method, :orientation, :member_level, :certifications, :hidden, :marketing_source, :payee, :accountant, :exit_reason, :twitter_url, :facebook_url, :github_url, :website_url, :email_visible, :phone_visible, :postal_code #TODO: make admin/instructor/member/etc not accessible
belongs_to :oriented_by, :foreign_key => "oriented_by_id", :class_name => "User"
has_many :cards has_many :cards
has_many :user_certifications has_many :user_certifications
has_many :certifications, :through => :user_certifications has_many :certifications, :through => :user_certifications

View File

@ -18,9 +18,14 @@
<%= @contract.signed_at.to_date.to_s(:long) %> <%= @contract.signed_at.to_date.to_s(:long) %>
</small> </small>
</h2> </h2>
<% unless @contract.created_by.blank? %>
<p>
<em>Created by <%= @contract.created_by.name %></em>
</p>
<% end %>
<% if @contract.document.blank? %> <% if @contract.document.blank? %>
No document uploaded <p>No document uploaded</p>
<% else %> <% else %>
<p><%= link_to "Download Contract", @contract.document.url %> <p><%= link_to "Download Contract", @contract.document.url %>
<div class="col-xs-12"> <div class="col-xs-12">

View File

@ -3,55 +3,48 @@
<%= simple_format Setting.welcome_body %> <%= simple_format Setting.welcome_body %>
<% end %> <% end %>
<% if user_signed_in? && 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 %>
<% if user_signed_in? && current_user.member_status.between?(2,100) then %>
<%= current_user.member.inspect %>
<%= current_user.member_level.inspect %>
<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 %>
<table>
<tr>
<td>
<% if ((can? :read, User) && (@recent_user_names.count > 1)) then %> <% if ((can? :read, User) && (@recent_user_names.count > 1)) then %>
<h2>New People: <em>(say hi!)</em></h2> <div class="col-sm-4">
<ul> <h2>New People: <em>(say hi!)</em></h2>
<% @recent_user_names.each do |user| %> <ul>
<% if can? :read, user %> <% @recent_user_names.each do |user| %>
<li><%= link_to user.name, user %> <%= raw(user.member_status_symbol) %> <em>(Signed up <%= user.created_at.strftime("%b %d") %>)</em></li> <% if can? :read, user %>
<li><%= link_to user.name, user %> <%= raw(user.member_status_symbol) %> <em>(Signed up <%= user.created_at.strftime("%b %d") %>)</em></li>
<% end %>
<% end %>
</ul>
</div>
<% end %>
<div class="col-sm-4">
<h2>Cool Stats:</h2>
<dl>
<dt># of People in this DB:</dt>
<dd><%= @num_users %> (<%= @recent_users %> new in the last 7 days)</dd>
<dt># of People Certified:</dt>
<dd><%= @num_certs %> (<%= @recent_certs %> new in the last 7 days)</dd>
<dt># of Current Paying Members:</dt>
<dd><%= @num_paid_users %> (<%= @num_plus_users %> plus, <%= @num_basic_users %> basic, <%= @num_associate_users %> associate. <%= @num_delinquent_users %> not-current)</dd>
<dt># of Door Accesses Granted:</dt>
<dd><%= @num_door_opens %> (<%= @today_door_opens %> today, <%= @recent_door_opens %> in the last 7 days)</dd>
<dt># of Door Accesses Denied:</dt>
<dd><%= @num_door_denieds %> (<%= @recent_door_denieds %> in the last month)</dd>
<dt># of Members DB Logins:</dt>
<dd><%= @num_logins %> (<%= @recent_logins %> users last 7 days)</dd>
<dt># of Computers in this DB:</dt>
<dd><%= @num_macs %> (<%= @recent_macs %> seen today)</dd>
</dl>
</div>
<div class="col-sm-4">
<h2>Member Resources</h2>
<% if can? :access_doors_remotely, :door_access %>
<ul><li><%= link_to "Remote Door Access", space_api_access_path %></li></ul>
<% end %> <% end %>
<% end %> <%= simple_format Setting.member_resources_inset %>
</ul> </div>
<% end %>
<h2>Cool Stats:</h2>
<dl>
<dt># of People in this DB:</dt>
<dd><%= @num_users %> (<%= @recent_users %> new in the last 7 days)</dd>
<dt># of People Certified:</dt>
<dd><%= @num_certs %> (<%= @recent_certs %> new in the last 7 days)</dd>
<dt># of Current Paying Members:</dt>
<dd><%= @num_paid_users %> (<%= @num_plus_users %> plus, <%= @num_basic_users %> basic, <%= @num_associate_users %> associate. <%= @num_delinquent_users %> not-current)</dd>
<dt># of Door Accesses Granted:</dt>
<dd><%= @num_door_opens %> (<%= @today_door_opens %> today, <%= @recent_door_opens %> in the last 7 days)</dd>
<dt># of Door Accesses Denied:</dt>
<dd><%= @num_door_denieds %> (<%= @recent_door_denieds %> in the last month)</dd>
<dt># of Members DB Logins:</dt>
<dd><%= @num_logins %> (<%= @recent_logins %> users last 7 days)</dd>
<dt># of Computers in this DB:</dt>
<dd><%= @num_macs %> (<%= @recent_macs %> seen today)</dd>
</dl>
</td> <span class="col-sm-4">
<td> <h3>Featured item:</h3>
<%= render @featured_resource unless @featured_resource.blank? %>
<h2>Member Resources</h2> </span>
<% if can? :access_doors_remotely, :door_access %>
<ul><li><%= link_to "Remote Door Access", space_api_access_path %></li></ul>
<% end %>
<%= simple_format Setting.member_resources_inset %>
</td>
</tr>
</table>

View File

@ -2,6 +2,7 @@
<html> <html>
<head> <head>
<title>hsl_members(<%= controller.controller_name %>.<%= controller.action_name %><%= "["+params[:id]+"]" unless params[:id].blank? %>)</title> <title>hsl_members(<%= controller.controller_name %>.<%= controller.action_name %><%= "["+params[:id]+"]" unless params[:id].blank? %>)</title>
<link rel="icon" href="/favicon.ico">
<% if params[:controller] == "resources" %> <% if params[:controller] == "resources" %>
<link href="/bootstrap/css/bootstrap.min.css" type="text/css" rel="stylesheet" /> <link href="/bootstrap/css/bootstrap.min.css" type="text/css" rel="stylesheet" />
<link href="/bootstrap/css/bootstrap-theme.min.css" type="text/css" rel="stylesheet" /> <link href="/bootstrap/css/bootstrap-theme.min.css" type="text/css" rel="stylesheet" />

View File

@ -10,6 +10,7 @@
<link href="/bootstrap/css/bootstrap-theme.min.css" type="text/css" rel="stylesheet" /> <link href="/bootstrap/css/bootstrap-theme.min.css" type="text/css" rel="stylesheet" />
<script src="/bootstrap/js/bootstrap.min.js" type="text/javascript" ></script> <script src="/bootstrap/js/bootstrap.min.js" type="text/javascript" ></script>
<link rel="icon" href="/favicon.ico">
<style> <style>
.resource .thumbnail { height: 150px; position: relative; } .resource .thumbnail { height: 150px; position: relative; }
@ -24,6 +25,8 @@
font-weight: bold; left: 10px; } font-weight: bold; left: 10px; }
.resource .thumbnail .disposed { color: red; } .resource .thumbnail .disposed { color: red; }
.resource .thumbnail h4 { position: absolute; bottom: 1px; margin-bottom: 1px; } .resource .thumbnail h4 { position: absolute; bottom: 1px; margin-bottom: 1px; }
.col_highlight { background-color: #f9f9f9; }
</style> </style>

View File

@ -6,7 +6,7 @@
<h2><a name="new_users"></a>New Users</h2> <h2><a name="new_users"></a>New Users</h2>
<table> <table class="table table-hover">
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Member Level</th> <th>Member Level</th>
@ -25,22 +25,22 @@
<td><% if user.created_at.present? %> <td><% if user.created_at.present? %>
<%= distance_of_time_in_words(DateTime.now, user.created_at.to_date)+" ago" %> <%= distance_of_time_in_words(DateTime.now, user.created_at.to_date)+" ago" %>
<% else %> <% else %>
<span class="alert">&times;</span> <span class="label label-danger">&times;</span>
<% end %></td> <% end %></td>
<td><% if user.waiver.present? %> <td><% if user.waiver.present? %>
<%= distance_of_time_in_words(DateTime.now, user.waiver.to_date)+" ago" %> <%= distance_of_time_in_words(DateTime.now, user.waiver.to_date)+" ago" %>
<% else %> <% else %>
<span class="alert">&times;</span> <span class="label label-danger">&times;</span>
<% end %></td> <% end %></td>
<td><% if user.orientation.present? %> <td><% if user.orientation.present? %>
<%= distance_of_time_in_words(DateTime.now, user.orientation.to_date)+" ago" %> <%= distance_of_time_in_words(DateTime.now, user.orientation.to_date)+" ago" %>
<% else %> <% else %>
<span class="alert">&times;</span> <span class="label label-danger">&times;</span>
<% end %></td> <% end %></td>
<td><% if user.payments.present? %> <td><% if user.payments.present? %>
<%= distance_of_time_in_words(Date.today, user.payments.maximum(:date))+" ago" %> <%= distance_of_time_in_words(Date.today, user.payments.maximum(:date))+" ago" %>
<% else %> <% else %>
<span class="alert">&times;</span> <span class="label label-danger">&times;</span>
<% end %></td> <% end %></td>
</tr> </tr>
<% end %> <% end %>
@ -48,7 +48,7 @@
</table> </table>
<h2><a name="members_without_cards"></a>Basic+ Members Without Cards</h2> <h2><a name="members_without_cards"></a>Basic+ Members Without Cards</h2>
<table> <table class="table table-hover">
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Account Created</th> <th>Account Created</th>
@ -67,19 +67,19 @@
<td><% if user.payments.present? %> <td><% if user.payments.present? %>
<% last_payment = user.payments.maximum(:date) %> <% last_payment = user.payments.maximum(:date) %>
<% if Date.today-last_payment > 60 %> <% if Date.today-last_payment > 60 %>
<span class="alert"> <span class="label label-danger">
<% else %> <% else %>
<span class="notice"> <span class="label label-success">
<% end %> <% end %>
<%= distance_of_time_in_words(Date.today, user.payments.maximum(:date))+" ago" %> <%= distance_of_time_in_words(Date.today, user.payments.maximum(:date))+" ago" %>
</span> </span>
<% else %> <% else %>
<span class="alert">&times;</span> <span class="label label-danger">&times;</span>
<% end %></td> <% end %></td>
<td><% if user.cards.present? %> <td><% if user.cards.present? %>
<span class="notice">&check;</span> <span class="label label-success">&check;</span>
<% else %> <% else %>
<span class="alert">&times;</span> <span class="label label-danger">&times;</span>
<% end %></td> <% end %></td>
</tr> </tr>
<% end %> <% end %>
@ -88,7 +88,7 @@
<h2><a name="logins"></a>Logins</h2> <h2><a name="logins"></a>Logins</h2>
<table> <table class="table table-hover">
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Current Sign In</th> <th>Current Sign In</th>
@ -118,7 +118,7 @@
<h2><a name="zombies"></a>Never-Logged-In Members</h2> <h2><a name="zombies"></a>Never-Logged-In Members</h2>
<em>Excluding non-members</em> <em>Excluding non-members</em>
<table> <table class="table table-hover">
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Member Level</th> <th>Member Level</th>

View File

@ -1,6 +1,6 @@
<h1>Inactive Users</h1> <h1>Inactive Users</h1>
<table> <table class="table table-hover">
<col /> <col />
<col /> <col />
<% if current_user.admin? then %><col /><% end %> <% if current_user.admin? then %><col /><% end %>
@ -24,14 +24,12 @@
<th>Desired Level</th> <th>Desired Level</th>
<th>Last Payment</th> <th>Last Payment</th>
<th>Joined</th> <th>Joined</th>
<th></th>
<th></th>
</tr> </tr>
<% if !@users.blank? %> <% if !@users.blank? %>
<% @users.each do |user| %> <% @users.each do |user| %>
<tr<%= " class='hidden'" if user.hidden? %>> <tr<%= " class='hidden'" if user.hidden? %>>
<td><%= image_tag user.gravatar_url(:default => "http://members.heatsynclabs.org/assets/nil.png"), :class => :avatar %></td> <td><%= image_tag user.gravatar_url(:size => 25, :default => "http://members.heatsynclabs.org/assets/nil.png"), :class => :avatar %></td>
<td><%= link_to user.name, user %></td> <td><%= link_to user.name, user %></td>
<% if current_user.admin? then %><td><%= user.email %></td><% end %> <% if current_user.admin? then %><td><%= user.email %></td><% end %>
<td><% user.certifications.each do |c| %> <td><% user.certifications.each do |c| %>
@ -51,8 +49,6 @@
<% end %> <% end %>
</td> </td>
<td><%= user.created_at.to_date %></td> <td><%= user.created_at.to_date %></td>
<td><%= link_to 'Edit', edit_user_path(user) if can? :update, user %></td>
<td><%= link_to 'Destroy', user, :confirm => 'Are you sure? WARNING: THIS DOES NOT REMOVE THE USER FROM THE DOOR SYSTEM! DISABLE THEM FIRST.', :method => :delete if can? :destroy, user %></td>
</tr> </tr>
<% end %> <% end %>
<% end %> <% end %>

View File

@ -1,23 +1,25 @@
<h1>HeatSync People</h1> <h1>HeatSync People</h1>
<p>
<% if can? :create, User %> <% if can? :create, User %>
<%= link_to 'New User', new_user_path %> | <%= link_to 'New User', new_user_path, class: "btn btn-success" %>
<% end %> <% end %>
<% if can? :manage, User %> <% if can? :manage, User %>
<%= link_to 'Merge Users', users_merge_path %> | <%= link_to 'Merge Users', users_merge_path, class: "btn btn-primary" %>
<% end %> <% end %>
<% if current_user.admin? %> <% if current_user.admin? %>
<%= link_to 'Inactive Users', users_inactive_path %> | <%= link_to 'Inactive Users', users_inactive_path, class: "btn btn-default" %>
<% end %> <% end %>
<% if can? :activity, User %> <% if can? :activity, User %>
<%= link_to 'Recent Activity', users_activity_path %> | <%= link_to 'Recent Activity', users_activity_path, class: "btn btn-default" %>
<% end %> <% end %>
<% if can? :new_member_report, User %> <% if can? :new_member_report, User %>
<%= link_to 'New Members Report', users_new_member_report_path %> <%= link_to 'New Members Report', users_new_member_report_path, class: "btn btn-default" %>
<% end %> <% end %>
</p>
<% @certifications = Certification.all.sort_by(&:id) %> <% @certifications = Certification.all.sort_by(&:id) %>
<table> <table class="table table-hover">
<col /> <col />
<col /> <col />
<% if current_user.admin? then %><col /><% end %> <% if current_user.admin? then %><col /><% end %>
@ -47,14 +49,12 @@
<% @certifications.each do |c| %> <% @certifications.each do |c| %>
<th><a href="?full=full&sort=cert&cert=<%= c.id %>"><%= c.name %></a></th> <th><a href="?full=full&sort=cert&cert=<%= c.id %>"><%= c.name %></a></th>
<% end %> <% end %>
<th></th>
<th></th>
</tr> </tr>
<% if !@users.blank? %> <% if !@users.blank? %>
<% @users.each do |user| %> <% @users.each do |user| %>
<tr<%= ' class=hidden' if user.hidden? %>> <tr<%= ' class=hidden' if user.hidden? %>>
<td><%= image_tag user.gravatar_url(:default => "http://members.heatsynclabs.org/assets/nil.png"), :class => :avatar %></td> <td><%= image_tag user.gravatar_url(:size => 25, :default => "http://members.heatsynclabs.org/assets/nil.png"), :class => :avatar %></td>
<td><%= link_to user.name, user %></td> <td><%= link_to user.name, user %></td>
<td><%= raw(user.member_status_symbol) %></td> <td><%= raw(user.member_status_symbol) %></td>
<% if current_user.admin? then %><td><%= user.email %></td><% end %> <% if current_user.admin? then %><td><%= user.email %></td><% end %>
@ -74,8 +74,6 @@
<% end %> <% end %>
</td> </td>
<% end %> <% end %>
<td><%= link_to 'Edit', edit_user_path(user) if can? :update, user %></td>
<td><%= link_to 'Destroy', user, :confirm => 'Are you sure? WARNING: THIS DOES NOT REMOVE THE USER FROM THE DOOR SYSTEM! DISABLE THEM FIRST.', :method => :delete if can? :destroy, user %></td>
</tr> </tr>
<% end %> <% end %>
<% end %> <% end %>

View File

@ -6,9 +6,12 @@
<%= link_to image_tag('/facebook.png', :class => 'social-icon', :title => "Facebook"), @user.facebook_url, :class => 'social-link' if @user.facebook_url.present? %> <%= link_to image_tag('/facebook.png', :class => 'social-icon', :title => "Facebook"), @user.facebook_url, :class => 'social-link' if @user.facebook_url.present? %>
<%= link_to image_tag('/github.png', :class => 'social-icon', :title => "Github"), @user.github_url, :class => 'social-link' if @user.github_url.present? %> <%= link_to image_tag('/github.png', :class => 'social-icon', :title => "Github"), @user.github_url, :class => 'social-link' if @user.github_url.present? %>
<%= link_to image_tag('/website.png', :class => 'social-icon', :title => "Website"), @user.website_url, :class => 'social-link' if @user.website_url.present? %> <%= link_to image_tag('/website.png', :class => 'social-icon', :title => "Website"), @user.website_url, :class => 'social-link' if @user.website_url.present? %>
<%= link_to "Email User", user_compose_email_path(@user), :class => 'btn' %>
</h2>
<%= link_to 'Back', :back, :class => 'btn btn-default' %>
<%= link_to 'Email User', user_compose_email_path(@user), :class => 'btn btn-default' %>
<%= link_to 'Edit', edit_user_path(@user), class: "btn btn-primary" if can? :update, @user %>
<%= link_to 'Destroy', @user, class: "btn btn-danger", :confirm => 'Are you sure? WARNING: THIS DOES NOT REMOVE THE USER FROM THE DOOR SYSTEM! DISABLE THEM FIRST.', :method => :delete if can? :destroy, @user %>
</h2>
<% if current_user.admin? || @user.email_visible %> <% if current_user.admin? || @user.email_visible %>
<p> <p>
@ -36,6 +39,9 @@
<p> <p>
<b>Orientation?</b> <b>Orientation?</b>
<%= @user.orientation.strftime("%B %d %Y") unless @user.orientation.blank? %> <%= @user.orientation.strftime("%B %d %Y") unless @user.orientation.blank? %>
<% unless @user.oriented_by.blank? %>
<em>(recorded by <%= link_to @user.oriented_by.name, @user.oriented_by %>)</em>
<% end %>
</p> </p>
<p> <p>
<b>Emergency Name:</b> <b>Emergency Name:</b>
@ -74,7 +80,7 @@
</p> </p>
<% end %> <% end %>
<b>Certifications: </b><%= link_to "+ Add", (new_user_certification_path+"?user="+@user.id.to_s), :class => 'btn' if can? :create, UserCertification %> <b>Certifications: </b><%= link_to "+ Add", (new_user_certification_path+"?user="+@user.id.to_s), :class => 'btn btn-default' if can? :create, UserCertification %>
<ul> <ul>
<% @user.certifications.each do |certification| %> <% @user.certifications.each do |certification| %>
<li><%= link_to certification.name, certification %></li> <li><%= link_to certification.name, certification %></li>
@ -82,7 +88,7 @@
<% if @user.certifications.blank? %><li>n/a</li><% end %> <% if @user.certifications.blank? %><li>n/a</li><% end %>
</ul> </ul>
<p> <p>
<b>Card: </b><%= link_to "+ Add", (new_card_path+"?user="+@user.id.to_s), :class => 'btn' if can? :create, Card %> <b>Card: </b><%= link_to "+ Add", (new_card_path+"?user="+@user.id.to_s), :class => 'btn btn-default' if can? :create, Card %>
<% if current_user.admin? then %> <% if current_user.admin? then %>
<ul> <ul>
<% @user.cards.each do |c| %> <% @user.cards.each do |c| %>
@ -94,7 +100,7 @@
<% end %> <% end %>
</p> </p>
<b>Computers: </b><%= link_to "+ Add", new_mac_path, :class => 'btn' if can? :create, Mac %> <b>Computers: </b><%= link_to "+ Add", new_mac_path, :class => 'btn btn-default' if can? :create, Mac %>
<ul> <ul>
<% @user.macs.each do |mac| %> <% @user.macs.each do |mac| %>
<li><%= link_to mac.mac, mac %></li> <li><%= link_to mac.mac, mac %></li>
@ -163,7 +169,7 @@ margin-right: auto;
.clearfix { clear: both } .clearfix { clear: both }
</style> </style>
<b>Resources: </b><%= link_to "+ Add", new_resource_path, :class => 'btn' if can? :create, Resource %> <b>Resources: </b><%= link_to "+ Add", new_resource_path, :class => 'btn btn-default' if can? :create, Resource %>
<div class="row"><%= render @user.resources if @user.resources %></div> <div class="row"><%= render @user.resources if @user.resources %></div>
<div class="clearfix"></div> <div class="clearfix"></div>
</p> </p>
@ -171,7 +177,7 @@ margin-right: auto;
<p> <p>
<b>Waiver?</b> <b>Waiver?</b>
<%= @user.waiver.strftime("%B %d %Y") unless @user.waiver.blank? %><br/> <%= @user.waiver.strftime("%B %d %Y") unless @user.waiver.blank? %><br/>
<b>Contracts:</b> <%= link_to "+ Add", new_contract_path, :class => 'btn' if can? :create, Contract %> <b>Contracts:</b> <%= link_to "+ Add", new_contract_path, :class => 'btn btn-default' if can? :create, Contract %>
<ul> <ul>
<% @user.contracts.each do |contract| %> <% @user.contracts.each do |contract| %>
<li> <li>
@ -201,6 +207,3 @@ margin-right: auto;
<%= @user.current_sign_in_at %> <%= @user.current_sign_in_at %>
</p> </p>
<% end %> <% end %>
<% if can? :update, @user then %><%= link_to 'Edit', edit_user_path(@user) %> |<% end %>
<%= link_to 'Back', users_path %>

View File

@ -33,7 +33,7 @@
<h1>HeatSync People <h1>HeatSync People
<%= link_to 'New User', new_user_path, class: "btn btn-success" if can? :create, User %> <%= link_to 'New User', new_user_path, class: "btn btn-success" if can? :create, User %>
<%= link_to 'Merge Users', users_merge_path, class: "btn btn-default" if can? :manage, User %> <%= link_to 'Merge Users', users_merge_path, class: "btn btn-primary" if can? :manage, User %>
</h1> </h1>

View File

@ -0,0 +1,5 @@
class AddCreatedByToContract < ActiveRecord::Migration
def change
add_column :contracts, :created_by_id, :integer
end
end

View File

@ -0,0 +1,5 @@
class AddOrientedByToUsers < ActiveRecord::Migration
def change
add_column :users, :oriented_by_id, :integer
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140303030220) do ActiveRecord::Schema.define(:version => 20140411024809) do
create_table "cards", :force => true do |t| create_table "cards", :force => true do |t|
t.string "card_number" t.string "card_number"
@ -42,6 +42,7 @@ ActiveRecord::Schema.define(:version => 20140303030220) do
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.string "cosigner" t.string "cosigner"
t.integer "created_by_id"
end end
create_table "door_logs", :force => true do |t| create_table "door_logs", :force => true do |t|
@ -251,6 +252,7 @@ ActiveRecord::Schema.define(:version => 20140303030220) do
t.boolean "email_visible" t.boolean "email_visible"
t.boolean "phone_visible" t.boolean "phone_visible"
t.string "postal_code" t.string "postal_code"
t.integer "oriented_by_id"
end end
add_index "users", ["email"], :name => "index_users_on_email", :unique => true add_index "users", ["email"], :name => "index_users_on_email", :unique => true