Module: Crystal::JavascriptHelper
- Defined in:
- lib/crystal/html/view_helpers/javascript_helper.rb
Instance Method Summary collapse
- #javascript_include_tag(*scripts) ⇒ Object
- #javascript_tag(value = nil, &block) ⇒ Object
-
#js(obj) ⇒ Object
Escape.
Instance Method Details
#javascript_include_tag(*scripts) ⇒ Object
3 4 5 6 7 |
# File 'lib/crystal/html/view_helpers/javascript_helper.rb', line 3 def javascript_include_tag *scripts Array(scripts).collect{|script| tag :script, '', :src => "#{config && config.url_root!}#{script}", :type => "text/javascript" }.join("\n") end |
#javascript_tag(value = nil, &block) ⇒ Object
9 10 11 12 13 |
# File 'lib/crystal/html/view_helpers/javascript_helper.rb', line 9 def javascript_tag value = nil, &block args = [{:type => "text/javascript"}] args.unshift value if value tag :script, *args, &block end |
#js(obj) ⇒ Object
Escape
16 |
# File 'lib/crystal/html/view_helpers/javascript_helper.rb', line 16 def js obj; obj.to_s.js_escape end |