peacecorps / medlink

A project to make it easier for Peace Corps Volunteers to order their medical supplies from a local Peace Corps Office. Volunteers can order by sms or webform. PC Staff interact with the orders in a simple to use dashboard.
https://www.youtube.com/watch?v=uNkwizhzMVA
Other
39 stars 36 forks source link

Admin Can View/Edit Master Supply List #432

Closed PTNielsen closed 9 years ago

PTNielsen commented 9 years ago

Similar to my last pull request but it's from a separate branch, not master. This should pass both checks as well. Please be sure to ignore the changes to the schema file in lines 66 and 67.

A supplies controller has been created (with associated Pundit Policy) which allows admins to view and toggle the orderability of any particular item. A link to this index view has been created by way of a dropdown menu on the navbar from 'Supplies' which was modeled after the gear dropdown.

Per our work a few weeks ago, an admin makes an item unorderable by clicking the button (designated with an X) on that items row. That item is then excluded from the scope of all requests to the Supply Table (scoped as 'orderable: true') with exception of the supplies_path view which shows that information unscoped. In order to better show which items are marked as available, when an item is made unorderable, it is given a strike through the name and the row is given the class danger. The admin may then make the item orderable again by clicking the same button (now designated with a checkmark). An "Add New Supply" link has also been included which brings the admin to a form to create a new Supply item (name and shortcode must be unique).

Tests have been created and are passing. Please let me know what adjustments need to be made.

rpearce commented 9 years ago

Apart from some nitpicks/suggestions, code looks :+1:

jamesdabbs commented 9 years ago

Sorry for the slow merge, but thanks @PTNielsen for all the hard work. :star2: