Story #82 Implement separate columns for tool reservation and tool authorization on preset events and events - cseseniordesign/reservations GitHub Wiki

End User Documentation

Dev Testing Instructions

  1. Ensure you are on the most recent version of the dev-add-event-authorizations branch.
  2. Start your dev environment and log in with development2, so you have all permissions.
  3. Navigate to the Events tab under Admin.
  4. From the toolbox, click the Event Presets button, then create a new preset by clicking the "+ new preset" button.
  5. Select from the preset tool authorization list and save the new preset.
  6. Navigate to the Events page and create a new event from the newly created preset.
  7. Ensure that all authorization tools included in the preset are already chosen by default on the new event page, and confirm that the checkbox next to tool authorization is checked to preserve the selected list.
  8. Edit the created event from Upcoming Event Items by clicking the title of the event, then modify the authorization tool list and save the updated event.
  9. To ensure that your updates have been saved, please click on the title of the event once more.
  10. To remove the event that you have created, navigate to the action column and select the delete button.
  11. Make sure that all records associated with the event have been properly removed from the event_authorizations table in the database.

Production Testing Instructions

  1. Go to https://innovationstudio-manager.unl.edu/home/
  2. Log in as an admin user, then Follow steps 3-10 from the dev testing instructions above.

Technical Documentation

models/event.rb

  • adding relationship of type "has_many" to event_authorizations.
  • adding has_authorization method.

models/event_authorization.rb

  • created a new class named EventAuthorization connected to events and resources tables.

routes/admin/events.rb

  • Changes within the GET /admin/events/create/? action:
    • Retrieving all tools and the selected preset from the database and passing them to the admin/new_event.erb file.
  • Changes within the POST /admin/events/create/? action:
    • create EventAuthorization new records in the database.
  • Changes within the GET /admin/events/:event_id/edit/? action:
    • Retrieving all tools and authorized_tools_ids from the database and passing them to the admin/new_event.erb file.
  • Changes within the POST /admin/events/:event_id/edit/? action:
    • Save the updated EventAuthorization records in the database.
  • Changes within the POST /admin/events/:event_id/delete/? action:
    • Remove Event Authorization records in the database that are connected to the deleted event.

new_schema.sql

  • Included SQL script to create the event_authorizations table.

views/admin/new_event.erb

  • added authorization tool list with a checkbox.
  • Implemented The logic for pre-selecting the authorization tools checkbox.
  • Implemented the logic to pre-select the list of authorization tools.

views/admin/new_preset_event.erb

  • change the tools list name from "Preset Event Tools" to "Preset Event Authorization Tools".