Class: Renalware::PD::PETResultsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- BaseController
- Renalware::PD::PETResultsController
- Defined in:
- app/controllers/renalware/pd/pet_results_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/renalware/pd/pet_results_controller.rb', line 17 def create pet = PETResult.new(pet_result_params) pet if pet.save_by(current_user) redirect_to patient_pd_dashboard_path(patient), notice: success_msg_for("PET result") else render_new(pet) end end |
#destroy ⇒ Object
55 56 57 58 |
# File 'app/controllers/renalware/pd/pet_results_controller.rb', line 55 def destroy .destroy! redirect_to patient_pd_dashboard_path(patient), notice: success_msg_for("Result") end |
#edit ⇒ Object
42 43 44 |
# File 'app/controllers/renalware/pd/pet_results_controller.rb', line 42 def edit render locals: { pet: } end |
#index ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/renalware/pd/pet_results_controller.rb', line 28 def index respond_to do |format| format.json do # Graphing data PETResult, :index? render json: pet_graph_data end format.js do results = patient.pet_results.ordered results render locals: { results: results } end end end |
#new ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'app/controllers/renalware/pd/pet_results_controller.rb', line 8 def new pet = PETResult.new( patient: patient, performed_on: Date.current ) pet render_new(pet) end |
#update ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'app/controllers/renalware/pd/pet_results_controller.rb', line 46 def update pet = if pet.update_by(current_user, pet_result_params) redirect_to patient_pd_dashboard_path(patient), notice: success_msg_for("PET result") else render_edit(pet) end end |