Module: WorkflowsHelper
- Defined in:
- app/helpers/workflows_helper.rb
Overview
A few helpers used in pipeline workflows
Instance Method Summary collapse
- #batch_tag_index ⇒ Object
- #gel_qc_select_box(request, status, html_options = {}) ⇒ Object
-
#link_to_comments(request) ⇒ Object
Returns a link to any available request comments with “None” as a default value.
- #qc_select_box(request, status, html_options = {}) ⇒ Object
- #tag_index_for(request) ⇒ Object
Instance Method Details
#batch_tag_index ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'app/helpers/workflows_helper.rb', line 17 def batch_tag_index @tag_hash ||= Tag .joins(:aliquots) .where(aliquots: { receptacle_id: @batch.requests.map(&:asset_id) }) .pluck(:receptacle_id, :map_id) .to_h .tap { |th| th.default = '-' } end |
#gel_qc_select_box(request, status, html_options = {}) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/helpers/workflows_helper.rb', line 36 def gel_qc_select_box(request, status, = {}) .delete(:generate_blank) status = 'OK' if status.blank? || status == 'Pass' select_tag( "wells[#{request.id}][qc_state]", ( { 'Pass' => 'OK', 'Fail' => 'Fail', 'Weak' => 'Weak', 'No Band' => 'Band Not Visible', 'Degraded' => 'Degraded' }, status ), ) end |
#link_to_comments(request) ⇒ Object
Returns a link to any available request comments with “None” as a default value.
7 8 9 10 11 |
# File 'app/helpers/workflows_helper.rb', line 7 def link_to_comments(request) link_to_if(request.comments.present?, pluralize(request.comments.size, 'comment'), request_comments_url(request)) do 'None' end end |
#qc_select_box(request, status, html_options = {}) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'app/helpers/workflows_helper.rb', line 27 def qc_select_box(request, status, = {}) = %w[pass fail] select_tag( "#{request.id}[qc_state]", (, status), .merge(class: 'qc_state') ) end |
#tag_index_for(request) ⇒ Object
13 14 15 |
# File 'app/helpers/workflows_helper.rb', line 13 def tag_index_for(request) batch_tag_index[request.asset_id] end |