Sha256: f889ed147944a621e65106371ab434622bc1f0da312b67c125ac155f5c843dae

Contents?: true

Size: 1.01 KB

Versions: 13

Compression:

Stored size: 1.01 KB

Contents

require_dependency("renalware/renal")

module Renalware
  module Renal
    class AKIAlertsController < BaseController
      include Renalware::Concerns::Pageable

      def index
        alerts = AKIAlert.includes(:updated_by, :action, :hospital_ward, :patient)
                         .ordered.page(page).per(per_page)
        authorize alerts
        render locals: { alerts: alerts }
      end

      def edit
        authorize alert
        render_edit(alert)
      end

      def update
        authorize alert
        if alert.update_attributes(aki_alert_params.merge(by: current_user))
          redirect_to renal_aki_alerts_path
        else
          render_edit(alert)
        end
      end

      private

      def render_edit(alert)
        render :edit, locals: { alert: alert }
      end

      def alert
        @alert ||= AKIAlert.find(params[:id])
      end

      def aki_alert_params
        params.require(:renal_aki_alert).permit(:notes, :action_id, :hotlist, :hospital_ward_id)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.rc10 app/controllers/renalware/renal/aki_alerts_controller.rb
renalware-core-2.0.0.pre.rc9 app/controllers/renalware/renal/aki_alerts_controller.rb
renalware-core-2.0.0.pre.rc8 app/controllers/renalware/renal/aki_alerts_controller.rb
renalware-core-2.0.0.pre.rc7 app/controllers/renalware/renal/aki_alerts_controller.rb
renalware-core-2.0.0.pre.rc6 app/controllers/renalware/renal/aki_alerts_controller.rb
renalware-core-2.0.0.pre.rc5 app/controllers/renalware/renal/aki_alerts_controller.rb
renalware-core-2.0.0.pre.rc4 app/controllers/renalware/renal/aki_alerts_controller.rb
renalware-core-2.0.0.pre.rc3 app/controllers/renalware/renal/aki_alerts_controller.rb
renalware-core-2.0.0.pre.rc1 app/controllers/renalware/renal/aki_alerts_controller.rb
renalware-core-2.0.0.pre.beta12 app/controllers/renalware/renal/aki_alerts_controller.rb
renalware-core-2.0.0.pre.beta11 app/controllers/renalware/renal/aki_alerts_controller.rb
renalware-core-2.0.0.pre.beta10 app/controllers/renalware/renal/aki_alerts_controller.rb
renalware-core-2.0.0.pre.beta9 app/controllers/renalware/renal/aki_alerts_controller.rb