Module: Sinatra::AssetHelpers

Defined in:
lib/fanforce/app_factory/config/helpers/assets.rb

Instance Method Summary collapse

Instance Method Details

#asset_path(source, options = {}) ⇒ Object



15
16
17
# File 'lib/fanforce/app_factory/config/helpers/assets.rb', line 15

def asset_path(source, options={})
  source = ('/assets/' + source).gsub('//', '/').gsub('/assets/assets/', '/assets/')
end

#image_path(source) ⇒ Object



19
20
21
# File 'lib/fanforce/app_factory/config/helpers/assets.rb', line 19

def image_path(source)
  asset_path(source)
end

#javascript(s) ⇒ Object



9
10
11
12
13
# File 'lib/fanforce/app_factory/config/helpers/assets.rb', line 9

def javascript(s)
  s += '.js' unless s.include?('.js')
  s = asset_path(s) unless s =~ /^https?:\// or s =~ /^\/\/.+/
  "<script type='text/javascript' src='#{s}'></script>"
end

#stylesheet(s) ⇒ Object



3
4
5
6
7
# File 'lib/fanforce/app_factory/config/helpers/assets.rb', line 3

def stylesheet(s)
  s += '.css' unless s.include?('.css')
  s = asset_path(s) unless s =~ /^https?:\// or s =~ /^\/\/.+/
  "<link rel='stylesheet' href='#{s}' />"
end