Module: SamplesHelper
- Defined in:
- app/helpers/samples_helper.rb
Instance Method Summary collapse
- #samples_not_accessioned(samples) ⇒ Object
-
#save_text(sample) ⇒ Object
Indicate to the user that saving the sample will also accession it This will not happen if the study has not been accessioned.
Instance Method Details
#samples_not_accessioned(samples) ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/helpers/samples_helper.rb', line 14 def samples_not_accessioned(samples) return 'No samples accessioned' if samples.empty? || samples.none?(&:accession_number?) return 'All samples accessioned' if samples.all?(&:accession_number?) count = samples.count { |sample| !sample.accession_number? } "#{pluralize(count, 'sample')} not accessioned" end |
#save_text(sample) ⇒ Object
Indicate to the user that saving the sample will also accession it This will not happen if the study has not been accessioned
6 7 8 9 10 11 12 |
# File 'app/helpers/samples_helper.rb', line 6 def save_text(sample) if [accessioning_enabled?, sample.should_be_accessioned?, permitted_to_accession?(sample)].all? return 'Save and Accession' end 'Save Sample' end |