Module: Autoselect::Levels::ColRecordInfo
- Includes:
- ColSourceMark
- Defined in:
- lib/autoselect/levels/col_record_info.rb
Constant Summary
Constants included from ColSourceMark
Autoselect::Levels::ColSourceMark::COL_ICON, Autoselect::Levels::ColSourceMark::TW_ICON
Instance Method Summary collapse
Methods included from ColSourceMark
#col_existing_record?, #col_source_icon, #col_source_tag
Instance Method Details
#record_info(record) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/autoselect/levels/col_record_info.rb', line 12 def record_info(record) col_ext = record._col_extension return [] unless col_ext [ col_ext[:col_status].presence, col_ext[:col_rank].presence, col_ext[:col_code_acronym] ].compact end |
#record_info_html(record) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/autoselect/levels/col_record_info.rb', line 22 def record_info_html(record) col_ext = record._col_extension return '' unless col_ext h = ApplicationController.helpers parts = [] if (status = col_ext[:col_status].presence) # Anything other than an accepted name (synonym, ambiguous synonym, # misapplied, …) gets a more aggressive alert style to draw # attention to the nomenclatural caveat. type = status.to_s.casecmp?('accepted') ? :info : :warning parts << h.feedback_badge_tag(status, type) end if (rank = col_ext[:col_rank].presence) parts << h.feedback_badge_tag(rank, :light) end # Only when the results span more than one code, see ColCodeBadge. if (acronym = col_ext[:col_code_acronym]) parts << h.feedback_badge_tag(acronym, :light) end col_source_icon(record) + parts.join(' ') end |