Story #52 Add "make trainer" checkbox on user edit page, Story #30 Add trainers to events - cseseniordesign/reservations GitHub Wiki
End User Documentation
Dev Testing Instructions
- Make sure you are on the most recent version of the
dev-add-trainers-to-events
branch.
- Go to the Users page on the website.
- Start editing any user.
- Scroll down and check the
Make Trainer
checkbox.
- Click the
Update
button to finish editing the user.
- Edit the user again, making sure the
Make Trainer
box is still checked.
- Navigate to the Users table in the database.
- Verify that the
is_trainer
column is set to 1
for the user you edited.
- Now that you have made a user a trainer, navigate to the Events page on the website.
- Create a new event or edit an existing one.
- Click the
Trainer:
drop-down.
- Click on the user that you made a trainer earlier.
- Click
Save Event
.
- Edit the event again to ensure the trainer you selected is still assigned to the event.
Technical Documentation
models/user.rb
- Defined methods to change the value of the
is_trainer
column in the database. These are called by the code in users.rb
(explained below).
routes/admin/users.rb
- Added code that is activated when the
Make Trainer
box is checked when editing a user.
views/admin/edit_user.erb
- Implemented the
Make Trainer
UI element. The box is "checked" when user.is_trainer == 1
.
models/event.rb
- Defined the
trainer_id
based on the parameters from events.rb
(explained below).
routes/admin/events.rb
- Defined
trainers
as all users where the is_trainer
column is equal to 1
.
- Defined the parameters for getting and posting trainers.
views/admin/new_event.erb
- Implemented the trainer drop-down menu UI element on the event create/edit page.