Skip to content

Instantly share code, notes, and snippets.

@merbjedi
Created March 12, 2010 14:55
Show Gist options
  • Save merbjedi/330368 to your computer and use it in GitHub Desktop.
Save merbjedi/330368 to your computer and use it in GitHub Desktop.
# Return a hidden attribute hash (useful in Haml tags - %div{hidden})
def hide(options = {})
if options.has_key?(:unless) && options[:unless]
return {}
end
if options.has_key?(:if) && !options[:if]
return {}
end
{:style => "display:none"}
end
alias :hidden :hide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment