Story #32 Add a UI to auto fill the current event creation form based on a selected preset event - cseseniordesign/reservations GitHub Wiki

End User Documentation

Dev Testing Instructions

  1. Make sure you are on the most recent version of the dev-autofill-event-creation branch.
  2. Start your dev environment and log in with development2 so you have all permissions.
  3. Navigate to the Admin -> Events page
  4. Click the button in the toolbox to navigate to the event presets page.
  5. On the Manage Preset Events page make sure there is a button to create a new event and a dropdown to select a current preset.
  6. Choose a preset from the dropdown.
  7. Click the button 'New Event from Preset'
  8. You should now be redirected to the events page, where the fields are populated with values pertaining to the selected preset event or not filled in the case of no selected preset event.
  9. Change the start date and time of the event.
  10. The end date should be the same as the start date.
  11. The end time should be set to the start time plus the duration of the selected preset event unless no preset event was selected then the end time will be the same as the start time.
  12. Create the new event.
  13. 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 with elevated permissions to view the Admin -> Events page.
  2. Follow steps 3 and up from the dev testing instructions above.

Technical Documentation

routes/admin/events.rb

  • Added a new parameter called preset_id which is the id of the selected preset event
  • Edited get '/admin/events/create/?' route to check if a preset event was selected to autofill
  • If the preset event id is 0 it will be an empty event template
  • If the preset event id is anything but 0 it will autofill the fields with information from the preset event
  • It will also create a new event with those fields filled out

views/admin/events.erb

  • Added a new button 'New Event from Preset' to navigate to the event creation page with fields auto-filled from selected preset
  • Added a dropdown populate with the preset events to select one to use to autofill the event creation page

views/admin/new_event.erb

  • Added a hidden field to hold the duration of the preset event
  • Added javascript to update the end date and time of the event (to match the preset event fields) when the start date and time are changed