Module: ObservationMatrixColumnsHelper

Defined in:
app/helpers/observation_matrix_columns_helper.rb

Instance Method Summary collapse

Instance Method Details

#label_for_observation_matrix_column(matrix_column) ⇒ Object



8
9
10
11
# File 'app/helpers/observation_matrix_columns_helper.rb', line 8

def label_for_observation_matrix_column(matrix_column)
  return nil if matrix_column.nil?
  matrix_column.descriptor.name
end

#observation_matrix_column_destroyable?(observation_matrix_column) ⇒ ObservationMatrixColumn#id?

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

Returns:

  • (ObservationMatrixColumn#id, nil)

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



20
21
22
23
24
# File 'app/helpers/observation_matrix_columns_helper.rb', line 20

def observation_matrix_column_destroyable?(observation_matrix_column)
  if !observation_matrix_column.cached_observation_matrix_column_item_id.blank? && observation_matrix_column.reference_count == 1
    return observation_matrix_column.cached_observation_matrix_column_item_id
  end
end


13
14
15
16
# File 'app/helpers/observation_matrix_columns_helper.rb', line 13

def observation_matrix_column_link(matrix_column)
  return nil if matrix_column.nil?
  link_to(observation_matrix_column_tag(matrix_column).html_safe, matrix_column)
end

#observation_matrix_column_tag(matrix_column) ⇒ Object



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

def observation_matrix_column_tag(matrix_column)
  return nil if matrix_column.nil?
  matrix_column.descriptor.name
end