From 0b5978d4ef63a46788906bf5626aef0bc431e93d Mon Sep 17 00:00:00 2001 From: Matthew Shepard Date: Tue, 16 Oct 2012 22:59:35 -0700 Subject: [PATCH] Add active status to user show/edit. --- app/models/user.rb | 2 +- app/views/users/_form.html.erb | 4 ++++ app/views/users/index.html.erb | 4 ++++ app/views/users/show.html.erb | 5 +++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 565c09b..3e8c50e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -6,7 +6,7 @@ class User < ActiveRecord::Base :recoverable, :rememberable, :trackable, :validatable # Setup accessible (or protected) attributes for your model - attr_accessible :email, :password, :password_confirmation, :remember_me, :name, :admin + attr_accessible :email, :password, :password_confirmation, :remember_me, :name, :admin, :active has_many :cards end diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb index 78fa292..3cca74b 100644 --- a/app/views/users/_form.html.erb +++ b/app/views/users/_form.html.erb @@ -33,6 +33,10 @@ Change Password <% end %> +
+ <%= f.label :active, "Active?" %>
+ <%= f.check_box :active %> +
<%= f.label :admin, "Admin?" %>
<%= f.check_box :admin %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index b21e02d..2fb4353 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -8,6 +8,8 @@ Name Email Cards + Active? + Waiver? Admin? @@ -23,6 +25,8 @@ <%= link_to c.card_number, card_url(c) %><%= "," unless c == user.cards.last %> <% end %> + <%= if user.active? then "Active" end %> + <%= if user.waiver.blank? then "Not Signed" else "Signed" end %> <%= if user.admin? then "Admin" end %> <%= link_to 'Edit', edit_user_path(user) if can? :update, user %> <%= 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 %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index f8609c0..33d78f4 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -9,6 +9,11 @@ <%= @user.email %>

+

+ Active? + <%= @user.active %> +

+

Admin? <%= @user.admin %>