Module: ObservationMatrixRowsHelper

Defined in:
app/helpers/observation_matrix_rows_helper.rb

Instance Method Summary (collapse)

Instance Method Details

- (Id?) observation_matrix_row_destroyable?(observation_matrix_row)

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

Returns:

  • (Id, nil)

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



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

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

- (String) observation_matrix_row_label(observation_matrix_row)

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


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

- (Object) observation_matrix_row_tag(observation_matrix_row)

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