Skip to content

Add page to manage volunteer case assignments#210

Merged
compwron merged 5 commits into
rubyforgood:masterfrom
colinsoleim:issue-208-edit-volunteer-case-assignments
Apr 28, 2020
Merged

Add page to manage volunteer case assignments#210
compwron merged 5 commits into
rubyforgood:masterfrom
colinsoleim:issue-208-edit-volunteer-case-assignments

Conversation

@colinsoleim
Copy link
Copy Markdown
Collaborator

@colinsoleim colinsoleim commented Apr 28, 2020

What github issue is this PR for, if any?

Resolves #208
Resolves #204

Checklist

  • I have performed a self-review of my own code
  • I added comments, particularly in hard-to-understand areas
  • I updated the /docs
  • I added tests that prove my fix is effective or that my feature works
  • bundle exec rake passes locally
  • My PR title includes "WIP" or is draft PR if work is in progress

What changed, and why?

This commit adds a new page for admins to manage the case assignments of volunteers. Because this page only handles case assignments at the moment, I changed the route from edit_volunteers to a nested route inside of volunteers, i.e. volunteers/1/case_assignments.

How will this affect user permissions?

  • Admins can now add/remove case assignments to/from volunteers

How is this tested?

New rspec tests have been added!

Screenshots please :)

Screen Shot 2020-04-27 at 8 06 34 PM

def must_be_admin
return if current_user&.casa_admin?

flash[:notice] = 'You do not have permission to view that page.'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice :)

Comment thread app/controllers/case_assignments_controller.rb
@compwron
Copy link
Copy Markdown
Collaborator

Looks great so far, I'll come back when it's un-drafted :)

@colinsoleim colinsoleim marked this pull request as ready for review April 28, 2020 00:29
@compwron
Copy link
Copy Markdown
Collaborator

Because there will be a lot of (100-200) cases, we will eventually want that "assign new case" dropdown to allow search. Also, eventually we'll want to show whether a case is currently assigned to a volunteer, and which one.
Screen Shot 2020-04-27 at 5 47 17 PM


def humanized_type
"#{contact_type.humanize.titleize}"
contact_type.humanize.titleize.to_s
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

:)

volunteer = User.find(params[:volunteer_id])
case_assignment = volunteer.case_assignments.find(params[:id])

case_assignment.destroy
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Eventually we will want to use case_assignment.is_active instead of .destroy so we can view previously-assigned volunteers but because case_contact has case_id (so case contacts never vanish) it's not needed for MVP

@compwron compwron merged commit 53c768a into rubyforgood:master Apr 28, 2020
@colinsoleim colinsoleim deleted the issue-208-edit-volunteer-case-assignments branch April 28, 2020 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Admin can assign volunteer to casa_case Admin can unassign volunteer from casa_case

2 participants