Module: StudiesHelper

Defined in:
app/helpers/studies_helper.rb

Instance Method Summary collapse

Instance Method Details

#display_file_icon(document) ⇒ Object


22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/helpers/studies_helper.rb', line 22

def display_file_icon(document)
  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


10
11
12
# File 'app/helpers/studies_helper.rb', line 10

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

#label_asset_state(asset) ⇒ Object


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

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

2
3
4
5
6
7
8
# File 'app/helpers/studies_helper.rb', line 2

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

41
42
43
44
45
# File 'app/helpers/studies_helper.rb', line 41

def study_link(study, options)
  link_text = (:strong, study.name) << ' ' <<
              (:span, study.state, class: "study-state badge badge-#{study.state}")
  link_to(link_text, study_path(study), options)
end