Module: StudiesHelper

Defined in:
app/helpers/studies_helper.rb

Instance Method Summary collapse

Instance Method Details

#display_file_icon(document) ⇒ Object

rubocop:todo Metrics/MethodLength



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/helpers/studies_helper.rb', line 19

def display_file_icon(document) # rubocop:todo Metrics/MethodLength
  return icon('fas', 'exclamation-circle', class: 'text-danger') unless document

  case document.content_type
  when /pdf/
    icon('far', 'file-pdf', title: 'PDF')
  when /word/
    icon('far', 'file-word', title: 'Word')
  when /excel/
    icon('far', 'file-excel', title: 'Excel')
  else
    icon('far', 'file-alt')
  end
end

#display_owners(study) ⇒ Object



7
8
9
# File 'app/helpers/studies_helper.rb', line 7

def display_owners(study)
  owners_for_display(study.owners)
end

#label_asset_state(asset) ⇒ Object



34
35
36
# File 'app/helpers/studies_helper.rb', line 34

def label_asset_state(asset)
  asset.closed? ? 'closed' : 'open'
end


3
4
5
# File 'app/helpers/studies_helper.rb', line 3

def status_link_title(study)
  study.inactive? || study.pending? ? 'Open' : 'Close'
end


38
39
40
41
# File 'app/helpers/studies_helper.rb', line 38

def study_link(study, options)
  link_text = tag.strong(study.name) << ' ' << badge(study.state, type: 'study-state')
  link_to(link_text, study_path(study), options)
end