user management

This commit is contained in:
2015-10-20 21:49:59 -05:00
parent c204389103
commit 41ceccc5b5
17 changed files with 158 additions and 49 deletions

View File

@ -0,0 +1,29 @@
%ul.sub-nav
%li= link_to 'back', :back
- if @user.errors.full_messages.any?
.errors
%h1 Uh oh!
- @user.errors.full_messages.each do |e|
%p= e
= form_for @user, as: :user, url: form_action do |f|
= f.label :first_name
= f.text_field :first_name
= f.label :last_name
= f.text_field :last_name
= f.label :phone
= f.phone_field :phone
= f.label :email, 'GMAIL ADDRESS'
= f.email_field :email
= f.label :admin
= f.check_box :admin
= f.label :staff
= f.check_box :staff
= f.submit

View File

@ -1 +1,3 @@
-# %ul.sub-nav
- if can_create_user? current_user
%ul.sub-nav
%li= link_to 'New', new_user_path

View File

@ -0,0 +1,3 @@
%h2 Edit #{@user.name}
= render partial: 'form', locals: {form_action: edit_user_path}

View File

@ -1,5 +1,13 @@
%h1 Users
%h1 Admins
%ul.index
- @admins.each do |user|
%li.name
= link_to user.name, user_path(user)
= edit_btn(edit_user_path(user))
%ul
- @users.each do |user|
%li= user.name
%h1 Staff
%ul.index
- @staff.each do |staff|
%li.name
= link_to staff.name, user_path(staff)
= edit_btn(edit_user_path(staff))

View File

@ -0,0 +1,3 @@
%h2 Register a new User
= render partial: 'form', locals: {form_action: add_user_path}

View File

@ -0,0 +1,16 @@
%h2= @user.name
%ul.sub-nav
%li= link_to 'back', :back
%li= link_to 'edit', edit_user_path(@user)
%p Email: #{mail_to(@user.email, nil, encode: 'hex')}
%p Phone: #{number_to_phone @user.phone} #{page_link(@user)}
- unless @user.children.empty?
%p Children:
%ul
- @user.children.each do |child|
%li
= link_to child.name, child_path(child)
= link_to 'remove', del_parenthood_path(@user, child), method: :delete