Class: Renalware::Letters::Mailshots::PatientPreviewsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- BaseController
- Renalware::Letters::Mailshots::PatientPreviewsController
- Includes:
- Pagy::Backend
- Defined in:
- app/controllers/renalware/letters/mailshots/patient_previews_controller.rb
Overview
Called via ajax from the new mailshot form, and responsible for taking the SQL view the user has chosen as the mailshot datasource, and returning a list of patients that the user can see and check before going on to create the mailshot.
Instance Method Summary collapse
-
#index ⇒ Object
Note we use data-remote as we want the table where the previewed patients are displayed to have pagination links that work via ajax and do not refresh the page.
Methods inherited from BaseController
Methods inherited from BaseController
Instance Method Details
#index ⇒ Object
Note we use data-remote as we want the table where the previewed patients are displayed to have pagination links that work via ajax and do not refresh the page.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/renalware/letters/mailshots/patient_previews_controller.rb', line 16 def index Patient, :index? pagy, patients = pagy( Mailshot.new(sql_view_name: sql_view_name).recipient_patients, link_extra: "data-remote='true'" ) render locals: { patients: patients, pagy: pagy, datasource: DataSource.find_by(viewname: sql_view_name) } end |