Module: Coupler::Extensions::Results::Helpers

Defined in:
lib/coupler/extensions/results.rb

Instance Method Summary collapse

Instance Method Details

#resource_optgroup_tag(resource_id) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/coupler/extensions/results.rb', line 5

def resource_optgroup_tag(resource_id)
  if resource_id.is_a?(String)
    id, which = resource_id.split(/_/).collect(&:to_i)
    %{<optgroup class="resource-#{id}" label="#{@resources[id].name} [#{which+1}]">}
  else
    %{<optgroup class="resource-#{resource_id}" label="#{@resources[resource_id].name}">}
  end
end