Sha256: b45dd1ec516ca0c1af240983e97bf046fb772d2a91e516b8e601fea58189e52c

Contents?: true

Size: 1.08 KB

Versions: 121

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

require_dependency "renalware"

# Note we rely on template inheritance with this MDM Base class i.e. subclasses (e.g.
# HD::MDMPatientsController) can override templates and partials (e.g. add a _filters partial
# or override the _patient partial to replace what is displayed in the table).
# Otherwise the default template location is of course app/views/renalware/mdm_patients.
module Renalware
  class MDMPatientsController < BaseController
    include PresenterHelper
    include Renalware::Concerns::Pageable

    protected

    def render_index(**args)
      presenter = build_presenter(params: params, **args)
      authorize presenter.patients
      render :index, locals: { presenter: presenter }
    end

    def build_presenter(**args)
      query = args.fetch(:query)

      MDMPatientsPresenter.new(
        patients: query.call.page(page).per(per_page),
        page_title: args.fetch(:page_title),
        view_proc: args.fetch(:view_proc),
        q: query.search,
        patient_presenter_class: args[:patient_presenter_class]
      )
    end
  end
end

Version data entries

121 entries across 121 versions & 1 rubygems

Version Path
renalware-core-2.0.127 app/controllers/renalware/mdm_patients_controller.rb
renalware-core-2.0.126 app/controllers/renalware/mdm_patients_controller.rb
renalware-core-2.0.125 app/controllers/renalware/mdm_patients_controller.rb
renalware-core-2.0.124 app/controllers/renalware/mdm_patients_controller.rb
renalware-core-2.0.123 app/controllers/renalware/mdm_patients_controller.rb
renalware-core-2.0.121 app/controllers/renalware/mdm_patients_controller.rb
renalware-core-2.0.120 app/controllers/renalware/mdm_patients_controller.rb
renalware-core-2.0.119 app/controllers/renalware/mdm_patients_controller.rb
renalware-core-2.0.118 app/controllers/renalware/mdm_patients_controller.rb
renalware-core-2.0.117 app/controllers/renalware/mdm_patients_controller.rb
renalware-core-2.0.116 app/controllers/renalware/mdm_patients_controller.rb
renalware-core-2.0.115 app/controllers/renalware/mdm_patients_controller.rb
renalware-core-2.0.113 app/controllers/renalware/mdm_patients_controller.rb
renalware-core-2.0.112 app/controllers/renalware/mdm_patients_controller.rb
renalware-core-2.0.111 app/controllers/renalware/mdm_patients_controller.rb
renalware-core-2.0.110 app/controllers/renalware/mdm_patients_controller.rb
renalware-core-2.0.109 app/controllers/renalware/mdm_patients_controller.rb
renalware-core-2.0.108 app/controllers/renalware/mdm_patients_controller.rb
renalware-core-2.0.106 app/controllers/renalware/mdm_patients_controller.rb
renalware-core-2.0.105 app/controllers/renalware/mdm_patients_controller.rb