Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1731] Add Court Mandates to Edit CASA Case page #1795

Conversation

rhian-cs
Copy link
Contributor

@rhian-cs rhian-cs commented Feb 26, 2021

What github issue is this PR for, if any?

Resolves #1731

What changed, and why?

In the Edit page of the CASA Cases, there is now a way to add Court Mandates to a specific case. These mandates are basically strings, that can be filled through text areas in the CASA Case form.
I did not follow 100% of the design suggestions described in the issue, but if that is undesirable, please let me know.

Compared to what was requested, I implemented the following:

  • Only supervisors have the ability to add/edit/remove court mandates.
  • This lives at the bottom of the "Court Details" section on the Edit CASA Case page.
  • There should be a subheader within this section with the text: Court Mandates
  • If you have a different design vision for what follows, go for it! We are not married to what's described below.
  • Underneath "Court Mandates", should be the text "Add a court mandate."
  • There should be a clickable + symbol next to this text which creates a text field when clicked.
  • The user's cursor should automatically be in the new text field once it is created.
  • A "submit" button should appear alongside the new text field.
  • Clicking "submit" saves the court mandate as typed in the text field.
  • There is no limit on how many court mandates can be added.
  • Clicking "Update CASA Case" (already exists on the page) saves changes.

How will this affect user permissions?

  • Volunteer permissions: Volunteers can see (but not edit/add) court mandates of a given case
  • Supervisor permissions: Supervisors can see, edit and add court mandates to a given case
  • Admin permissions: Admins can see, edit and add court mandates to a given case

How is this tested? (please write tests!) 💖💪

Automated tests:

I tested the following requirements:

Request tests
  • Non-admins and non-supervisors cannot add/edit court mandates
  • Admins and Supervisors can add/edit court mandates, but:
    • Not in the create form
    • Only in the update form
  • The response was as expected and the appropriate changes were made (or not made in case of invalid data) in the database
  • Creating a new mandate but placing no text inside it is accepted, but ignored.
  • Attempting to change an existing mandate to an empty string is not allowed (please see below)
Frontend tests
  • The (+) button works
  • The (+) button adds a text area that can be filled
  • Inserting data into the text area and submitting the form works
  • Permission tests: Admin & Supervisor can see the (+) button, Volunteer cannot

Manual testing

  • Log-in as a supervisor
  • Go to the Cases page
  • Choose a case and go to the Edit page of that case
  • Click on the (+) button
  • Check if the cursor was automatically placed at the new text area
  • Fill the text area with something
  • Click on the (+) button once again but add no text to the new text area
  • Click on Update CASA Case
  • Check if the court mandates are still present and on the same order you added them and if the empty text areas are gone
  • Now to test the Volunteer, assign this case to a volunteer that you have the access credentials to, and then log-out
  • Log-in as this volunteer, go to My Cases, click on the Edit button for the case you added mandates to
  • Check if you can't change the text area value

Screenshots please :)

Overview, now the button is present at the bottom of Court details
01-overall

Clicking on the (+) button creates a new textarea
02-add-empty

Multiple textareas can be added, with no limit
03-multiple

The fields can be filled with any string and since they are text areas, the size can be adjusted.
04-filled-fields

After the Update button is clicked, the page is reloaded so the textareas shrink again.
05-after

Mobile view (Supervisor/Admin)
06-mobile

Desktop view (Volunteer)
The volunteers can also see court mandates and expand the text areas, but cannot edit them.
07-volunteer-desktop

Mobile view (Volunteer)
08-volunteer-mobile

Possible issues?

I took the liberty of allowing mandates to be edited, but not deleted (leaving this to #1733).
However, this may have an undesirable effect: After a mandate is added, it cannot be set to an empty string and it will not be deleted.
If any changes are required, once again please let me know.

@github-actions github-actions bot added javascript for use by Github Labeler to mark pull requests that update Javascript code ruby Pull requests that update Ruby code Tests! 🎉💖👏 labels Feb 26, 2021
Copy link
Collaborator

@compwron compwron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool! :) Sounds very reasonable

@compwron compwron merged commit 6c8ffac into rubyforgood:main Mar 1, 2021
@rhian-cs rhian-cs deleted the 1731-add-court-mandates-to-edit-casa-case-page branch May 27, 2021 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javascript for use by Github Labeler to mark pull requests that update Javascript code ruby Pull requests that update Ruby code Tests! 🎉💖👏
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add court mandates to Edit CASA Case page
2 participants