Class: Studies::InformationController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Studies::InformationController
- Defined in:
- app/controllers/studies/information_controller.rb
Overview
Responsible for displaying overcomplicated reporting pages
Constant Summary collapse
- BASIC_TABS =
[ %w[summary Summary], ['sample-progress', 'Sample progress'], ['assets-progress', 'Assets progress'], ['accession-statuses', 'Accession statuses'] ].freeze
- PAGED_TABLE_LAYOUT =
'studies/information/layouts/paged_table'
Instance Method Summary collapse
- #show ⇒ Object
-
#show_summary ⇒ Object
Dynamically load the contents of this endpoint via ajax_handling.js to populate the summary tab tables.
- #summary ⇒ Object
Instance Method Details
#show ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/studies/information_controller.rb', line 18 def show @page_name = @study.name @summary = params[:summary] || 'sample-progress' @request_types = RequestType.where(id: @study.requests.distinct.pluck(:request_type_id)).standard.order(:order, :id) @summaries = BASIC_TABS + @request_types.pluck(:key, :name) @submissions = @study.submissions @awaiting_submissions = @study.submissions.where.not(state: 'ready') # We need to propagate the extra_parameters - as page - to the summary partial @extra_params = params.except(%i[summary study_id id action controller]) respond_to do |format| format.html format.xml format.json { render json: Study.all.to_json } end end |
#show_summary ⇒ Object
Dynamically load the contents of this endpoint via ajax_handling.js to populate the summary tab tables.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/controllers/studies/information_controller.rb', line 39 def show_summary page_params = { page: params[:page] || 1, per_page: params[:per_page] || 50 } if request.xhr? @summary = params[:summary] || 'assets-progress' case @summary when 'summary' render_summary(page_params) when 'sample-progress' render_sample_progress(page_params) when 'assets-progress' render_assets_progress(page_params) when 'accession-statuses' render_accession_statuses(page_params) else render_request_type_summary(page_params) end else page_params[:summary] = params[:summary] redirect_to study_information_path(@study, page_params) end end |