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

  1. Make sure you are on the most recent version of the dev-add-trainers-to-events branch.
  2. Go to the Users page on the website.
  3. Start editing any user.
  4. Scroll down and check the Make Trainer checkbox.
  5. Click the Update button to finish editing the user.
  6. Edit the user again, making sure the Make Trainer box is still checked.
  7. Navigate to the Users table in the database.
  8. Verify that the is_trainer column is set to 1 for the user you edited.
  9. Now that you have made a user a trainer, navigate to the Events page on the website.
  10. Create a new event or edit an existing one.
  11. Click the Trainer: drop-down.
  12. Click on the user that you made a trainer earlier.
  13. Click Save Event.
  14. 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.