diff --git a/app/models/ability.rb b/app/models/ability.rb
index 1353a0b..57035eb 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -16,12 +16,12 @@ class Ability
# Instructors can manage certs and see users
if user.instructor?
can :manage, Certification
- can :read, User
+ can [:create,:read], User
can :manage, UserCertification
end
# Users can see others' stuff if they've been oriented
unless user.orientation.blank?
- can :read, User
+ can :read, User, :hidden => [nil,false]
can :read, UserCertification
end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index 6c41f9f..d3b3644 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, :instructor, :member, :emergency_name, :emergency_phone, :current_skills, :desired_skills, :waiver, :emergency_email, :phone, :payment_method, :orientation, :member_level, :certifications
+ 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
has_many :cards
has_many :user_certifications
diff --git a/app/views/devise/registrations/_user.html.erb b/app/views/devise/registrations/_user.html.erb
new file mode 100644
index 0000000..346cb2e
--- /dev/null
+++ b/app/views/devise/registrations/_user.html.erb
@@ -0,0 +1,58 @@
+<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => html) do |f| %>
+
+ <%= f.label :name %>
+ <%= f.text_field :name %>
+
+
+
+ <%= f.label :email %>
+ <%= f.email_field :email %>
+
+
+
+ <%= f.label :phone %>
+ <%= f.text_field :phone %>
+
+
+ <%= f.label :emergency_name, "Emergency contact" %>
+ <%= f.text_field :emergency_name %>
+
+
+ <%= f.label :emergency_phone %>
+ <%= f.text_field :emergency_phone %>
+
+
+ <%= f.label :emergency_email %>
+ <%= f.text_field :emergency_email %>
+
+
+ <%= f.label :member_level, "Membership Level" %>
+ <%= f.select :member_level, [[nil],["None",0],["Unable",1],["Volunteer",10],["Associate ($25)",25],["Basic ($50)",50],["Plus ($100)",100]] %>
+
+
+ <%= f.label :payment_method %> (after changing this, please update your payment method to match.)
+ <%= f.select :payment_method, [[nil],["PayPal"],["Dwolla"],["Bill Pay"],["Check"],["Cash"],["Other"]] %>
+
+
+ <%= f.label :current_skills %>
+ <%= f.text_area :current_skills %>
+
+
+ <%= f.label :desired_skills %>
+ <%= f.text_area :desired_skills %>
+
+
+ <%= f.label :password %>
+ <%= f.password_field :password %>
+
+ <%= f.label :password_confirmation %>
+ <%= f.password_field :password_confirmation %>
+
+ <% if params[:action]!='new' %>
+ <%= f.label :current_password %>
+ <%= f.password_field :current_password %>
+ <% end %>
+
+ <%= f.submit button_label %>
+
+<% end %>
diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb
index fbbc622..328e723 100644
--- a/app/views/devise/registrations/edit.html.erb
+++ b/app/views/devise/registrations/edit.html.erb
@@ -1,30 +1,10 @@
-Edit <%= resource_name.to_s.humanize %>
+Edit Your Profile
-<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
- <%= devise_error_messages! %>
+<%= devise_error_messages! %>
-
- <%= f.label :name %>
- <%= f.text_field :name %>
-
+<%= render :partial => "user", :locals => { :resource => resource, :html => { :method => :put }, :button_label => "Update Profile" } %>
- <%= f.label :email %>
- <%= f.email_field :email %>
+<%= render "devise/shared/links" %>
- <%= f.label :password %> (leave blank if you don't want to change it)
- <%= f.password_field :password, :autocomplete => "off" %>
-
- <%= f.label :password_confirmation %>
- <%= f.password_field :password_confirmation %>
-
- <%= f.label :current_password %> (we need your current password to confirm your changes)
- <%= f.password_field :current_password %>
-
- <%= f.submit "Update" %>
-<% end %>
-
-Cancel my account
-
-Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %>.
<%= link_to "Back", :back %>
diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb
index df3407c..134179a 100644
--- a/app/views/devise/registrations/new.html.erb
+++ b/app/views/devise/registrations/new.html.erb
@@ -1,23 +1,7 @@
Sign up
-<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
-
- <%= f.label :name %>
- <%= f.text_field :name %>
-
-
- <%= f.label :email %>
- <%= f.email_field :email %>
-
- <%= f.label :password %>
- <%= f.password_field :password %>
-
- <%= f.label :password_confirmation %>
- <%= f.password_field :password_confirmation %>
-
- <%= f.submit "Sign up" %>
-<% end %>
+ <%= render :partial => "user", :locals => { :resource => resource, :button_label => "Sign Up", :html => nil } %>
<%= render "devise/shared/links" %>
diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb
index 54e9f5c..aae514d 100644
--- a/app/views/users/_form.html.erb
+++ b/app/views/users/_form.html.erb
@@ -90,6 +90,10 @@
<%= f.label :admin, "Admin?" %>
<%= f.check_box :admin %>
+
+ <%= f.label :hidden, "Hidden?" %>
+ <%= f.check_box :hidden %>
+
Cards
diff --git a/config/routes.rb b/config/routes.rb
index 55cb2ac..52f7666 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -4,7 +4,18 @@ Dooraccess::Application.routes.draw do
resources :certifications
- devise_for :users
+ devise_for :users, :skip => :registrations
+ devise_scope :user do
+ resource :registration,
+ :only => [:new, :create, :edit, :update],
+ :path => 'users',
+ :path_names => { :new => 'sign_up' },
+ :controller => 'devise/registrations',
+ :as => :user_registration do
+ get :cancel
+ end
+ end
+
resources :users
match 'users/create' => 'users#create', :via => :post # Use POST users/create instead of POST users to avoid devise conflict
diff --git a/db/migrate/20130125185724_add_hidden_to_users.rb b/db/migrate/20130125185724_add_hidden_to_users.rb
new file mode 100644
index 0000000..92c8718
--- /dev/null
+++ b/db/migrate/20130125185724_add_hidden_to_users.rb
@@ -0,0 +1,5 @@
+class AddHiddenToUsers < ActiveRecord::Migration
+ def change
+ add_column :users, :hidden, :boolean
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 75b7cc3..95a78b0 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20130125133237) do
+ActiveRecord::Schema.define(:version => 20130125185724) do
create_table "cards", :force => true do |t|
t.string "card_number"
@@ -71,6 +71,7 @@ ActiveRecord::Schema.define(:version => 20130125133237) do
t.string "current_skills"
t.string "desired_skills"
t.boolean "instructor"
+ t.boolean "hidden"
end
add_index "users", ["email"], :name => "index_users_on_email", :unique => true