Module: CollectionProfilesHelper

Defined in:
app/helpers/collection_profiles_helper.rb

Instance Method Summary collapse

Instance Method Details

#collection_profile_attribute_status_tag(collection_profile, attribute) ⇒ Object

def collection_profiles_search_form

render('/collection_profiles/quick_search_form')

end



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

def collection_profile_attribute_status_tag(collection_profile, attribute)
  v = collection_profile.send(attribute)
  v ||= COLLECTION_PROFILE_INDICES[:Favret][collection_profile.collection_type.to_sym][attribute].keys.first
  "#{v} - " + COLLECTION_PROFILE_INDICES[:Favret][collection_profile.collection_type.to_sym][attribute][v]
end


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

def collection_profile_link(collection_profile)
  return nil if collection_profile.nil?
  link_to(collection_profile_tag(collection_profile).html_safe, collection_profile)
end

#collection_profile_select(collection_profile, attribute) ⇒ Object



30
31
32
# File 'app/helpers/collection_profiles_helper.rb', line 30

def collection_profile_select(collection_profile, attribute)
  select_tag("collection_profile[#{attribute}]", collection_profile_select_options(collection_profile.collection_type, attribute, collection_profile.send(attribute))  )
end

#collection_profile_select_options(collection_type, attribute, selected) ⇒ Object



23
24
25
26
27
28
# File 'app/helpers/collection_profiles_helper.rb', line 23

def collection_profile_select_options(collection_type, attribute, selected)
  options_for_select(
    COLLECTION_PROFILE_INDICES[:Favret][collection_type.to_sym][attribute].collect{|i,t| ["#{i} - #{t}", i]},
    selected: selected
  )
end

#collection_profile_tag(collection_profile) ⇒ Object



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

def collection_profile_tag(collection_profile)
  return nil if collection_profile.blank?
  [container_tag(collection_profile.container), otu_tag(collection_profile.otu)].compact.join(': ').html_safe
end