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



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

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

Returns !! No HTML !!

The label used in exports.

Returns:

  • (String)

    !! No HTML !!

    The label used in exports
    


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

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



32
33
34
35
36
# File 'app/helpers/observation_matrix_rows_helper.rb', line 32

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



25
26
27
28
29
30
# File 'app/helpers/observation_matrix_rows_helper.rb', line 25

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