Module: BatchesHelper
- Defined in:
- app/helpers/batches_helper.rb
Overview
rubocop:todo Style/Documentation
Instance Method Summary collapse
- #batch_link(batch, options) ⇒ Object
-
#output_aliquot(xml, aliquot) ⇒ Object
Used by both assets/show.xml.builder and batches/show.xml.builder.
- #purpose_for_labware(labware) ⇒ Object
- #workflow_name(batch) ⇒ Object
Instance Method Details
#batch_link(batch, options) ⇒ Object
43 44 45 46 47 48 |
# File 'app/helpers/batches_helper.rb', line 43 def batch_link(batch, ) link_text = tag.strong("Batch #{batch.id} ") << tag.span(batch.pipeline.name, class: 'pipline-name') << ' ' << badge(batch.state, type: 'batch-state') link_to(link_text, batch_path(batch), ) end |
#output_aliquot(xml, aliquot) ⇒ Object
Used by both assets/show.xml.builder and batches/show.xml.builder
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/helpers/batches_helper.rb', line 7 def output_aliquot(xml, aliquot) xml.sample( sample_id: aliquot.sample_id, library_id: aliquot.library_id, library_name: aliquot.library_name, library_type: aliquot.library_type, study_id: aliquot.study_id, project_id: aliquot.project_id, consent_withdrawn: aliquot.sample. ) do # NOTE: XmlBuilder has a method called 'tag' so we have to say we want the element 'tag'! xml.tag!(:tag, tag_id: aliquot.tag.id) do xml.index aliquot.aliquot_index_value || aliquot.tag.map_id xml.expected_sequence aliquot.tag.oligo xml.tag_group_id aliquot.tag.tag_group_id end unless aliquot.tag.nil? xml.tag(tag2_id: aliquot.tag2.id) do xml.expected_sequence aliquot.tag2.oligo xml.tag_group_id aliquot.tag2.tag_group_id end unless aliquot.tag2.nil? xml.bait(id: aliquot.bait_library.id) do xml.name aliquot.bait_library.name end if aliquot.bait_library.present? xml.insert_size(from: aliquot.insert_size.from, to: aliquot.insert_size.to) if aliquot.insert_size.present? end end |
#purpose_for_labware(labware) ⇒ Object
2 3 4 |
# File 'app/helpers/batches_helper.rb', line 2 def purpose_for_labware(labware) labware.purpose&.name.presence || 'Unassigned' end |
#workflow_name(batch) ⇒ Object
37 38 39 40 41 |
# File 'app/helpers/batches_helper.rb', line 37 def workflow_name(batch) return unless batch && batch.workflow batch.workflow.name.gsub(/Cluster formation | \([^)]*\)/, '') end |