Module: Renalware::PrescriptionsHelper
- Defined in:
- app/helpers/renalware/prescriptions_helper.rb
Instance Method Summary collapse
- #default_provider(provider) ⇒ Object
- #highlight_validation_fail(med_object, med_attribute) ⇒ Object
- #medication_and_route(med_route) ⇒ Object
- #new_patient_medications_prescription_termination_path(patient, prescription, treatable = nil) ⇒ Object
- #new_patient_prescription_path(patient, treatable = nil) ⇒ Object
- #patient_medications_prescription_termination_path(patient, prescription, treatable = nil) ⇒ Object
- #patient_prescriptions_path(patient, treatable = nil, params = {}) ⇒ Object
- #validation_fail(prescription) ⇒ Object
Instance Method Details
#default_provider(provider) ⇒ Object
37 38 39 |
# File 'app/helpers/renalware/prescriptions_helper.rb', line 37 def default_provider(provider) provider == "gp" ? "checked" : nil end |
#highlight_validation_fail(med_object, med_attribute) ⇒ Object
27 28 29 30 31 |
# File 'app/helpers/renalware/prescriptions_helper.rb', line 27 def highlight_validation_fail(med_object, med_attribute) return unless med_object.errors.include?(med_attribute) "field_with_errors" end |
#medication_and_route(med_route) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/helpers/renalware/prescriptions_helper.rb', line 41 def medication_and_route(med_route) if med_route.blank? "No medication prescribed" else other_route = "Route: Other (Please specify in notes)" safe_join( med_route.map do |m| route = if m.medication_route.name == other_route m.medication_route.full_name else m.medication_route.name end "<li> #{m.drug.name} - #{route} </li>".html_safe end ) end end |
#new_patient_medications_prescription_termination_path(patient, prescription, treatable = nil) ⇒ Object
20 21 22 23 24 25 |
# File 'app/helpers/renalware/prescriptions_helper.rb', line 20 def new_patient_medications_prescription_termination_path(patient, prescription, treatable = nil) treatable ||= patient super(patient, prescription, treatable_type: treatable.class.to_s, treatable_id: treatable.id) end |
#new_patient_prescription_path(patient, treatable = nil) ⇒ Object
10 11 12 13 |
# File 'app/helpers/renalware/prescriptions_helper.rb', line 10 def new_patient_prescription_path(patient, treatable = nil) treatable ||= patient super(patient, treatable_type: treatable.class.to_s, treatable_id: treatable.id) end |
#patient_medications_prescription_termination_path(patient, prescription, treatable = nil) ⇒ Object
15 16 17 18 |
# File 'app/helpers/renalware/prescriptions_helper.rb', line 15 def patient_medications_prescription_termination_path(patient, prescription, treatable = nil) treatable ||= patient super(patient, prescription, treatable_type: treatable.class.to_s, treatable_id: treatable.id) end |
#patient_prescriptions_path(patient, treatable = nil, params = {}) ⇒ Object
5 6 7 8 |
# File 'app/helpers/renalware/prescriptions_helper.rb', line 5 def patient_prescriptions_path(patient, treatable = nil, params = {}) treatable ||= patient super(patient, params.merge(treatable_type: treatable.class.to_s, treatable_id: treatable.id)) end |
#validation_fail(prescription) ⇒ Object
33 34 35 |
# File 'app/helpers/renalware/prescriptions_helper.rb', line 33 def validation_fail(prescription) prescription.errors.any? ? "show-form" : "content" end |