Module: ObservationMatrixRowsHelper

Defined in:
app/helpers/observation_matrix_rows_helper.rb

Instance Method Summary collapse

Instance Method Details

#observation_matrix_row_destroyable?(observation_matrix_row) ⇒ ObservationMatrixRow#id?

ONLY CACHE IF count == 1 ?!

Returns:

  • (ObservationMatrixRow#id, nil)

    if destroyable (represented by only a single OMRI of type Single) then return the ID



44
45
46
47
48
# File 'app/helpers/observation_matrix_rows_helper.rb', line 44

def observation_matrix_row_destroyable?(observation_matrix_row)
  if !observation_matrix_row.cached_observation_matrix_row_item_id.blank? && observation_matrix_row.reference_count == 1
    return observation_matrix_row.cached_observation_matrix_row_item_id
  end
end

#observation_matrix_row_label(observation_matrix_row) ⇒ String Also known as: label_for_observation_matrix_row

TODO: remove for pattern below/in helpers README

Returns:

  • (String)

    !! No HTML !!

    The label used in exports
    


18
19
20
21
22
23
24
# File 'app/helpers/observation_matrix_rows_helper.rb', line 18

def observation_matrix_row_label(observation_matrix_row)
  return observation_matrix_row.name unless observation_matrix_row.name.blank?
  o = observation_matrix_row.row_object
  s = label_for(o) 
  s.gsub!(/[^\w]/, '_')
  s[0..11] + "_#{o.id}"
end

#observation_matrix_row_label_nexml(observation_matrix_row) ⇒ Object



35
36
37
38
39
# File 'app/helpers/observation_matrix_rows_helper.rb', line 35

def observation_matrix_row_label_nexml(observation_matrix_row)
  return observation_matrix_row.name unless observation_matrix_row.name.blank?
  o = observation_matrix_row.row_object
  s = label_for(o)
end

#observation_matrix_row_label_nexus(observation_matrix_row) ⇒ Object



28
29
30
31
32
33
# File 'app/helpers/observation_matrix_rows_helper.rb', line 28

def observation_matrix_row_label_nexus(observation_matrix_row)
  return observation_matrix_row.name unless observation_matrix_row.name.blank?
  o = observation_matrix_row.row_object
  s = label_for(o)
  s.gsub!(/[^\w]/, '_')
end


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

def observation_matrix_row_link(observation_matrix_row)
  return nil if observation_matrix_row.nil?
  link_to(observation_matrix_row_tag(observation_matrix_row).html_safe, observation_matrix_row)
end

#observation_matrix_row_tag(observation_matrix_row) ⇒ Object

Display in app



4
5
6
7
# File 'app/helpers/observation_matrix_rows_helper.rb', line 4

def observation_matrix_row_tag(observation_matrix_row)
  return nil if observation_matrix_row.nil?
  object_tag(observation_matrix_row.row_object)
end