Finishing touches on abilities and registration form
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
58
app/views/devise/registrations/_user.html.erb
Normal file
58
app/views/devise/registrations/_user.html.erb
Normal file
@@ -0,0 +1,58 @@
|
||||
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => html) do |f| %>
|
||||
<div class="field">
|
||||
<%= f.label :name %><br />
|
||||
<%= f.text_field :name %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :phone %><br />
|
||||
<%= f.text_field :phone %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :emergency_name, "Emergency contact" %><br />
|
||||
<%= f.text_field :emergency_name %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :emergency_phone %><br />
|
||||
<%= f.text_field :emergency_phone %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :emergency_email %><br />
|
||||
<%= f.text_field :emergency_email %>
|
||||
</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">
|
||||
<%= f.label :payment_method %> <i>(after changing this, please update your payment method to match.)</i><br />
|
||||
<%= f.select :payment_method, [[nil],["PayPal"],["Dwolla"],["Bill Pay"],["Check"],["Cash"],["Other"]] %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :current_skills %><br />
|
||||
<%= f.text_area :current_skills %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :desired_skills %><br />
|
||||
<%= f.text_area :desired_skills %>
|
||||
</div>
|
||||
|
||||
<div><%= f.label :password %><br />
|
||||
<%= f.password_field :password %></div>
|
||||
|
||||
<div><%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation %></div>
|
||||
|
||||
<% if params[:action]!='new' %>
|
||||
<div><%= f.label :current_password %><br />
|
||||
<%= f.password_field :current_password %></div>
|
||||
<% end %>
|
||||
|
||||
<div><%= f.submit button_label %></div>
|
||||
|
||||
<% end %>
|
||||
@@ -1,30 +1,10 @@
|
||||
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
||||
<h2>Edit Your Profile</h2>
|
||||
|
||||
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :name %><br />
|
||||
<%= f.text_field :name %>
|
||||
</div>
|
||||
<%= render :partial => "user", :locals => { :resource => resource, :html => { :method => :put }, :button_label => "Update Profile" } %>
|
||||
|
||||
<div><%= f.label :email %><br />
|
||||
<%= f.email_field :email %></div>
|
||||
<%= render "devise/shared/links" %>
|
||||
|
||||
<div><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
|
||||
<%= f.password_field :password, :autocomplete => "off" %></div>
|
||||
|
||||
<div><%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation %></div>
|
||||
|
||||
<div><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
|
||||
<%= f.password_field :current_password %></div>
|
||||
|
||||
<div><%= f.submit "Update" %></div>
|
||||
<% end %>
|
||||
|
||||
<h3>Cancel my account</h3>
|
||||
|
||||
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %>.</p>
|
||||
|
||||
<%= link_to "Back", :back %>
|
||||
|
||||
@@ -1,23 +1,7 @@
|
||||
<h2>Sign up</h2>
|
||||
|
||||
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :name %><br />
|
||||
<%= f.text_field :name %>
|
||||
</div>
|
||||
|
||||
<div><%= f.label :email %><br />
|
||||
<%= f.email_field :email %></div>
|
||||
|
||||
<div><%= f.label :password %><br />
|
||||
<%= f.password_field :password %></div>
|
||||
|
||||
<div><%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation %></div>
|
||||
|
||||
<div><%= f.submit "Sign up" %></div>
|
||||
<% end %>
|
||||
<%= render :partial => "user", :locals => { :resource => resource, :button_label => "Sign Up", :html => nil } %>
|
||||
|
||||
<%= render "devise/shared/links" %>
|
||||
|
||||
@@ -90,6 +90,10 @@
|
||||
<%= f.label :admin, "Admin?" %><br />
|
||||
<%= f.check_box :admin %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :hidden, "Hidden?" %><br />
|
||||
<%= f.check_box :hidden %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<h3>Cards</h3>
|
||||
<ul>
|
||||
|
||||
Reference in New Issue
Block a user