Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Clicking on "Add Allergy" link on visit page takes you to the patient page #994

Closed
mnorbeck opened this issue Mar 17, 2017 · 4 comments
Closed

Comments

@mnorbeck
Copy link

Expected behavior:
Clicking on that link would pop-up the dialog to enter a new allergy, without leaving the page

Actual behavior:
click navigates off the visit page to the patient page

Steps to reproduce:

  1. create a visit for a patient
  2. click on the "+ Add Allergy" link

Screenshots (if applicable):

OS and Browser:

OSX 10.10.5, Chrome 55.0.2924.87 (64-bit)

@jkleinsc

@baoqchau
Copy link
Contributor

I did the same like you but in my case, it pop up a dialog to fill in the allergy as expected. Maybe because you did not pull the latest update repo?
screenshot_20170317_143841

@mnorbeck
Copy link
Author

@baoqchau maybe! thanks, I will check again

@mnorbeck mnorbeck assigned mnorbeck and unassigned mnorbeck Mar 24, 2017
@jkleinsc
Copy link
Member

@mnorbeck @baoqchau I just tested this locally with the latest code and it redirects to the patient from the visit.

@adeolabadmus
Copy link
Contributor

@jkleinsc, the issue here is that the editAllergy and createNewAllergy actions in the medication-allergy component bubbled. Hence, the linkToPatient action of the parent component (patient-summary) intercepted it. That is why any click on the New Allergy button or an existing allergy opens the patients/edit page.

The reason why that didn't happen in @baoqchau's case is because the visit model is new, which sets disablePatientLink to true. (https://github.com/HospitalRun/hospitalrun-frontend/blob/master/app/visits/edit/template.hbs#L25). That way, the interceptor action doesn't do anything, and the modal can open the normal way.

To solve the issue on an existing visit, setting bubbles=false on the action makes the modal open the normal way, but then, the next issue that arises is that: the modal is rendered into the patient-summary component. So, a click on any part of the modal opens the patient/edit page again.

So, I fixed it in #1040 by rendering the modal into the application modal outlet instead, like most modals in the app are implemented.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants