Created
April 13, 2009 18:17
-
-
Save ryanfb/94591 to your computer and use it in GitHub Desktop.
Recursive Haml abuse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- p = Proc.new do |element, hidden, block| | |
- tab_up | |
%div{:id => element.div_id, :class => element.error_class, :style => "display:#{hidden ? 'none' : ''};"} | |
= element.name + " (" + element.length.to_s + " instances)" | |
.toggle_button | |
%a{:onclick => "toggle_div('#{element.div_id}-examples');"} | |
Examples | |
.examples{:id => element.div_id + "-examples", :style => "display:none;"} | |
- for example in element.examples | |
.filename | |
= example.xml_file | |
.xml | |
%code= html_escape(example.xml_content) | |
.leiden | |
= example.text | |
- if element.children? | |
Children: | |
- for child in element.children | |
.toggle_button | |
%a{:onclick => "toggle_div('#{child.div_id}');"} | |
= child.name | |
- block.call(child, true, block) | |
- tab_down | |
- for ddb_element in ddb_elements | |
- p.call(ddb_element, false, p) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment