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.rc38 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc37 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc36 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc35 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc34 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc33 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc32 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc31 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc30 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc29 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc27 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc26 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc25 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc24 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc23 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc22 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc21 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc20 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc19 lib/fanforce/app_factory/sinatra/helpers/assets.rb
fanforce-app-factory-2.0.0.rc18 lib/fanforce/app_factory/sinatra/helpers/assets.rb