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,6 +1,22 @@
class HomeController < ApplicationController class HomeController < ApplicationController
layout 'resources'
def index def index
# Alerts
if user_signed_in? && current_user.orientation.blank? then
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."
end
if user_signed_in? && current_user.member_status.between?(2,100) then
flash[:alert] = "<!--
Member: <%= current_user.member.inspect
Level: <%= current_user.member_level.inspect
-->
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!"
end
# Fun Stats
@featured_resource = Resource.where("picture_file_name IS NOT NULL").sample
@num_certs = UserCertification.count @num_certs = UserCertification.count
@recent_certs = UserCertification.where("created_at > ?", DateTime.now - 7.days).count @recent_certs = UserCertification.where("created_at > ?", DateTime.now - 7.days).count
@num_users = User.count @num_users = User.count

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,19 +3,8 @@
<%= 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 %>
<div class="col-sm-4">
<h2>New People: <em>(say hi!)</em></h2> <h2>New People: <em>(say hi!)</em></h2>
<ul> <ul>
<% @recent_user_names.each do |user| %> <% @recent_user_names.each do |user| %>
@ -24,7 +13,10 @@
<% end %> <% end %>
<% end %> <% end %>
</ul> </ul>
</div>
<% end %> <% end %>
<div class="col-sm-4">
<h2>Cool Stats:</h2> <h2>Cool Stats:</h2>
<dl> <dl>
<dt># of People in this DB:</dt> <dt># of People in this DB:</dt>
@ -42,16 +34,17 @@
<dt># of Computers in this DB:</dt> <dt># of Computers in this DB:</dt>
<dd><%= @num_macs %> (<%= @recent_macs %> seen today)</dd> <dd><%= @num_macs %> (<%= @recent_macs %> seen today)</dd>
</dl> </dl>
</div>
</td> <div class="col-sm-4">
<td>
<h2>Member Resources</h2> <h2>Member Resources</h2>
<% if can? :access_doors_remotely, :door_access %> <% if can? :access_doors_remotely, :door_access %>
<ul><li><%= link_to "Remote Door Access", space_api_access_path %></li></ul> <ul><li><%= link_to "Remote Door Access", space_api_access_path %></li></ul>
<% end %> <% end %>
<%= simple_format Setting.member_resources_inset %> <%= simple_format Setting.member_resources_inset %>
</div>
</td> <span class="col-sm-4">
</tr> <h3>Featured item:</h3>
</table> <%= render @featured_resource unless @featured_resource.blank? %>
</span>

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