Module: Sinatra::RequireJSHelper

Defined in:
lib/visage-app/helpers.rb

Instance Method Summary collapse

Instance Method Details

#include_required_jsObject



43
44
45
46
47
48
49
50
51
# File 'lib/visage-app/helpers.rb', line 43

def include_required_js
  if @js_filenames
    @js_filenames.map { |filename|
      "<script type='text/javascript' src='#{link_to("/javascripts/#{filename}.js")}'></script>"
    }.join("\n")
  else
    ""
  end
end

#require_js(filename) ⇒ Object



38
39
40
41
# File 'lib/visage-app/helpers.rb', line 38

def require_js(filename)
  @js_filenames ||= []
  @js_filenames << filename
end