Class: Renalware::PD::PeritonitisEpisodesController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- BaseController
- Renalware::PD::PeritonitisEpisodesController
- Includes:
- PresenterHelper, Concerns::PdfRenderable
- Defined in:
- app/controllers/renalware/pd/peritonitis_episodes_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #edit ⇒ Object
- #new ⇒ Object
- #save_episode(episode) ⇒ Object
- #save_failure(episode) ⇒ Object
- #save_success(episode) ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods included from PresenterHelper
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
25 26 27 |
# File 'app/controllers/renalware/pd/peritonitis_episodes_controller.rb', line 25 def create save_episode(new_episode) end |
#edit ⇒ Object
29 30 31 32 33 34 |
# File 'app/controllers/renalware/pd/peritonitis_episodes_controller.rb', line 29 def edit render locals: { peritonitis_episode: current_episode, patient: patient } end |
#new ⇒ Object
18 19 20 21 22 23 |
# File 'app/controllers/renalware/pd/peritonitis_episodes_controller.rb', line 18 def new render locals: { peritonitis_episode: new_episode, patient: patient } end |
#save_episode(episode) ⇒ Object
40 41 42 43 44 |
# File 'app/controllers/renalware/pd/peritonitis_episodes_controller.rb', line 40 def save_episode(episode) command = SavePeritonitisEpisode.new(patient: patient, episode: episode) command.subscribe(self) command.call(params: peritonitis_episode_params) end |
#save_failure(episode) ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'app/controllers/renalware/pd/peritonitis_episodes_controller.rb', line 58 def save_failure(episode) flash.now[:error] = t(".failed", model_name: "peritonitis episode") action = action_name.to_sym == :create ? :new : :edit render action, locals: { peritonitis_episode: episode, patient: patient } end |
#save_success(episode) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/renalware/pd/peritonitis_episodes_controller.rb', line 46 def save_success(episode) respond_to do |format| format.js do render locals: { peritonitis_episode: present(episode, PeritonitisEpisodePresenter), patient: patient } end format.html { redirect_after_successful_save(episode) } end end |
#show ⇒ Object
11 12 13 14 15 16 |
# File 'app/controllers/renalware/pd/peritonitis_episodes_controller.rb', line 11 def show respond_to do |format| format.html { render_show } format.pdf { render_show_as_pdf } end end |
#update ⇒ Object
36 37 38 |
# File 'app/controllers/renalware/pd/peritonitis_episodes_controller.rb', line 36 def update save_episode(current_episode) end |