Skip to content

Instantly share code, notes, and snippets.

@RobertFischer
Created December 3, 2014 12:54
Show Gist options
  • Select an option

  • Save RobertFischer/bc46bfe2e8459325ba79 to your computer and use it in GitHub Desktop.

Select an option

Save RobertFischer/bc46bfe2e8459325ba79 to your computer and use it in GitHub Desktop.
Tabbed Helper
-# Here are the assumptions.
-# 1. We have a consistent UI concept of 'tabbed pages', which have a consistent frame (at least in terms of Haml).
-# 2. Each component of the tabbed pages can be represented as a partial.
-#
-# Given that, I propose that we create a helper that you would call like this.
= tabs {:first => "First Tab!", :second => "2nd Tab", :third => "last tab"}
-# The argument to that function we will call "tab_hash"
-# It would then first load the tab UI component, roughly equivalent to something like this.
= partial "partials/tabs", {:locals => tab_hash}
-# That partial would be responsible for loading the frame of the tabs.
-# The tabs would have the labels "First Tab!", "2nd Tab", and "last tab".
-# For the body of the tabbed document, we would then call partials based on the source file name.
-# So, if 'tabs' was called from "./source/awesome_page.html.haml", given the tab_hash above,
-# then we would expect to find the partials at:
-# ./source/awesome_page/_first.html.haml
-# ./source/awesome_page/_second.html.haml
-# ./source/awesome_page/_third.html.haml
-#
-# Each of those partials would be wrapped in the appropriate structure for our tabs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment