Story #101 Add Preset Emails | User and Technical Documentation - cseseniordesign/reservations GitHub Wiki

End User Documentation

Dev Testing Instructions

  1. Make sure you are on the most recent version of the dev-email-presets branch.
  2. Start your dev environment and log in with development2 so you have all permissions.
  3. Navigate to the Admin -> Email page
  4. Click the manage email presets button to navigate to the email presets page.
  5. On the Manage Preset Emails page make sure there is a button to create a new preset and that there is a table showing the current presets.
  6. Click "new preset" and try to create a preset without filling out all of the required fields. Ensure that an error is flashed and that the preset is not created.
  7. Create a valid preset and ensure that you are redirected to the previous page and that you now see the preset in the table.
  8. Edit the preset you just created and make sure the page loads pre-populated with all the information that you set when you created it. Edit the preset and make sure it updates. If you clear out the required fields and try to save you should get an error.
  9. Ensure that you can delete the preset. Make sure that when you delete the preset it is removed from the database.
  10. Go to compose an email and ensure there is a dropdown at the bottom of the page to select a preset email. Ensure that when you select a preset that the subject and body autofill based on the preset's information.
  11. Ensure there are no errors in the console throughout your testing and that the page is responsive on all screen sizes.

Production Testing Instructions

  1. Go to https://innovationstudio-manager.unl.edu/login/ and log in with an account that has elevated permissions to view the Admin -> Email page.
  2. Follow steps 3 and up from the dev testing instructions above.

Technical Documentation

models/preset_email.rb

  • Added this new model to represent the preset_emails table.

new_schema.sql

  • Added scripts for the preset_emails table and for adding default preset emails.

routes/admin/emails.rb

  • Added new get route /admin/events/presets/? which loads the admin/email_presets.erb.
  • Added new get route /admin/events/presets/create/? which loads the admin/new_preset_email.erb with a new preset email.
  • Added new get route /admin/events/presets/:preset_id/edit/? which loads the admin/new_preset_email.erb with an existing preset email based on the preset_id.
  • Added new post route /admin/events/presets/create/? which validates the preset emails information, creates the preset email, and redirects the user back to the manage presets page. If validation or the creation fails then an error is flashed.
  • Added new post route /admin/events/presets/:preset_id/edit/? which validates the preset emails information, updates the preset email, and redirects the user back to the manage presets page. If validation or the update fails then an error is flashed.
  • Added new post route /admin/events/presets/:preset_id/delete/? which deletes the preset email. If the deletion fails then an error is flashed.
  • Added a new get route /admin/email/preset_emails_json/? which returns all of the preset emails in JSON format.

views/admin/email_presets.erb

  • Added this view for viewing email presets. From here the user can create, edit, or delete email presets.

views/admin/emails.erb

  • Added a button to navigate to the manage email presets page.

views/admin/new_preset_email.erb

  • Added this view for creating/editing preset emails.

views/admin/send_email.erb

  • Added a select dropdown to select an email preset to autofill the subject and body. Added javascript logic autofill the subject and body fields when a preset is selected.