Sha256: ec715e24d7fff2048079dd702b1f273c45e4362c77a42765e2446675643075df

Contents?: true

Size: 469 Bytes

Versions: 1

Compression:

Stored size: 469 Bytes

Contents

module TabsHelper
  # Create a tab as <li> and give it the id "current" if the current action matches that tab
  def tab(name, url, options = {})
    if controller.action_name =~ (options[:highlight] = /#{name}/i)  && controller.controller_name == url[:controller]
      content_tag :li, link_to(options[:label] || name.to_s.capitalize, url, {:id => "current"})
    else
      content_tag :li, link_to(options[:label] || name.to_s.capitalize, url)
    end    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shopify_app-2.0.0 lib/generators/shopify_app/templates/app/helpers/tabs_helper.rb