Sha256: 3f17b790aafaeadbf8fd6afdc6b14c13aa08c2bae5146488e291226c1a2fa692

Contents?: true

Size: 603 Bytes

Versions: 35

Compression:

Stored size: 603 Bytes

Contents

module Fanforce::App::Sinatra::AssetHelpers

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

  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

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

  def image_path(source)
    asset_path(source)
  end

end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
fanforce-app-factory-2.0.0.rc17 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc16 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc15 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc14 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc13 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc12 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc11 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc10 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc9 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc8 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc7 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc5 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc4 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc2 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc1 lib/fanforce/app_factory/sinatra/helpers/assets.rb