Module: DescriptorsHelper

Defined in:
app/helpers/descriptors_helper.rb

Instance Method Summary (collapse)

Instance Method Details



12
13
14
15
# File 'app/helpers/descriptors_helper.rb', line 12

def descriptor_link(descriptor)
  return nil if descriptor.nil?
  link_to(descriptor_tag(descriptor).html_safe, descriptor.metamorphosize)
end

- (String?) descriptor_matrix_character_states_label(descriptor)

Returns state labels formatted for matrix export

Returns:

  • (String, nil)

    state labels formatted for matrix export



30
31
32
33
34
35
36
# File 'app/helpers/descriptors_helper.rb', line 30

def descriptor_matrix_character_states_label(descriptor)
  if descriptor.qualitative?
    descriptor.character_states.map{|state| state.name.gsub(/[\W]/ , "_")}.join(" ")
  else 
    nil
  end
end


17
18
19
20
# File 'app/helpers/descriptors_helper.rb', line 17

def descriptor_matrix_column_link(descriptor)
  z = [descriptor.short_name, descriptor.name].compact.first
  link_to(z, new_descriptor_task_path(descriptor.metamorphosize), data: {help: descriptor.name})
end

- (String) descriptor_matrix_label(descriptor)

Returns the column/descriptor name presented in the exported matrix

Returns:

  • (String)

    the column/descriptor name presented in the exported matrix



24
25
26
# File 'app/helpers/descriptors_helper.rb', line 24

def descriptor_matrix_label(descriptor)
  descriptor.name.gsub(/[\W]/ , "_")
end

- (Object) descriptor_tag(descriptor)



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

def descriptor_tag(descriptor)
  return nil if descriptor.nil?
  descriptor.name
end

- (Object) descriptors_search_form



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

def descriptors_search_form
  render('/descriptors/quick_search_form')
end