Story #31, #49 Add UI For Managing Event Presets | User and Technical Documentation - cseseniordesign/reservations GitHub Wiki
End User Documentation
Dev Testing Instructions
Make sure you are on the most recent version of the dev-event-presets branch.
Start your dev environment and log in with development2 so you have all permissions.
Navigate to the Admin -> Events page
Click the button in the toolbox to navigate to the event presets page.
On the Manage Preset Events page make sure there is a button to create a new preset and that there is a table showing the current presets.
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.
Create a valid preset and ensure that you are redirected to the previous page and that you now see the preset in the table.
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.
Ensure that you can delete the preset. Make sure that when you delete the preset that the join table records that tie tools to it are also deleted from the database.
Ensure there are no errors in the console throughout your testing and that the page is responsive on all screen sizes.
Follow steps 3 and up from the dev testing instructions above.
Technical Documentation
models/preset_event.rb
Added this new model to represent the preset_events table.
models/preset_events_has_resource.rb
Added this new model to represent the preset_events_has_resources table.
models/resource.rb
Added has many relationship with preset_events_has_resources.
routes/admin/events.rb
Added new get route /admin/events/presets/? which loads the admin/event_presets.erb.
Added new get route /admin/events/presets/create/? which loads the admin/new_preset_event.erb with a new preset event.
Added new get route /admin/events/presets/:preset_id/edit/? which loads the admin/new_preset_event.erb with an existing preset event based on the preset_id.
Added new post route /admin/events/presets/create/? which validates the preset events information, creates the preset event, 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 events information, updates the preset event, 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 all the join table records that tie tools to the preset event then it deletes the preset event. If the deletion fails then an error is flashed.
views/admin/event_presets.erb
Added this view for viewing event presets. From here the user can create, edit, or delete event presets.
views/admin/new_preset_event.erb
Added this view for creating/editing preset events.
views/admin/events.erb
Added a button in the toolbox to navigate to the manage presets page.