Skip to content

Tab menus

Mirv edited this page Jun 24, 2017 · 2 revisions

http://techiferous.com/2011/03/tutorial-for-adding-tabs-to-rails-using-tabulous/ https://github.com/weppos/tabs_on_rails Making custom tabs work with tabsonrails https://stackoverflow.com/questions/3386128/custom-tab-builder-with-tabs-on-rails-plugin

  • <%= link_to "Home", home_path %>
  • <%= link_to "Workouts", workouts_path %>
  • <%= link_to "Recipes", recipes_path %>
  • <%= link_to "Users", users_path %>
  • <%= link_to "FAQ", faq_url %>
  • <%= link_to "About", about_path %>
    <%= navigation_data.each do |x, y| %> <%= link_to x <% end %>

############################################################

############################################################

def navigation_data pages = {} pages.merge!({"Home" => 'home_path'}) pages.merge!({"Workouts" => 'workouts_path'}) pages.merge!({"Recipes" => 'recipes_path'}) pages.merge!({"Users" => 'users_path' }) pages.merge!({"FAQ" => 'faq_url'}) pages.merge!({"About" => 'about_path'})

# return pages

end

def call_n(astring) navigation_data.each { |x,y| test_active_string(x, astring) } end

def test_active_string(x, astring) (astring == x) ? (puts "Good") : (puts "#{x} holding #{x.value}") end

def call_nav(astring) navigation_data.each do |x,y| if astring == x puts "Good" end puts "#{x} holding #{y}" end end ############################################################ ############################################################

Clone this wiki locally