Created
December 14, 2010 05:36
-
-
Save muloka/740045 to your computer and use it in GitHub Desktop.
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
# layout_helper.rb | |
module LayoutHelper | |
def headjs | |
["/javascripts/jquery.js","/javascripts/rails.js","/javascripts/application.js"] | |
end | |
def headjs_show | |
"<script type='text/javascript'> | |
head.js('#{headjs.join('\',\'')}'); | |
</script>" | |
end | |
def javascript(script) | |
headjs << script | |
end | |
end | |
# _javascript.html.haml | |
- javascript 'foo1.js' | |
- javascript 'foo2.js' | |
= headjs_show | |
# ouputs | |
# <script type='text/javascript'> | |
# head.js('/javascripts/jquery.js','/javascripts/rails.js','/javascripts/application.js'); | |
# </script> | |
# would be nice if it did this | |
# <script type='text/javascript'> | |
# head.js('/javascripts/jquery.js','/javascripts/rails.js','/javascripts/application.js','foo1.js','foo2.js'); | |
# </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment