module BootstrapRailsEngine::ActionViewExtensions

Constants

BOOTSTRAP_VERSION
CDNS
FONTAWESOME_VERSION
OFFLINE

Public Instance Methods

bootstrap_javascript_include_tag(name, options = {}) click to toggle source

to be used with bootstrap-rails-engine gem

# File lib/bootstrap-rails-engine.rb, line 39
def bootstrap_javascript_include_tag(name, options = {})
  options.reverse_merge! :local_copy => false

  bootstrap_j = 'bootstrap/bootstrap'
  bootstrap_j = bootstrap_j + '.min' if options.delete(:compressed)

  if OFFLINE and !options.delete(:force)
    options.delete(:local_copy) # not used in OFFLINE mode
    return javascript_include_tag(bootstrap_j, options)
  else
    local_copy = options.delete(:local_copy)
    j = [ javascript_include_tag(bootstrap_javascript_url(name), options) ]
    if local_copy
      j << javascript_tag("typeof $().carousel == 'function' || document.write(unescape('#{javascript_include_tag(bootstrap_j, options).gsub('<','%3C')}'))")
    end
    j.join("\n").html_safe
  end
end
bootstrap_javascript_url(name) click to toggle source
# File lib/bootstrap-rails-engine.rb, line 22
def bootstrap_javascript_url(name)
  return CDNS[:bootstrap_js][name]
end
bootstrap_stylesheet_include_tag(name, options = {}) click to toggle source
# File lib/bootstrap-rails-engine.rb, line 58
def bootstrap_stylesheet_include_tag(name, options = {})
  bootstrap_c = 'bootstrap/bootstrap'
  bootstrap_c = bootstrap_c + '.min' if options.delete(:compressed)

  if OFFLINE and !options.delete(:force)
    return stylesheet_link_tag(bootstrap_c, options)
  else
    # Bootstrap do not offer way to check existing
    [ stylesheet_link_tag(bootstrap_stylesheet_url(name), options),
    ].join("\n").html_safe
  end
end
bootstrap_stylesheet_url(name) click to toggle source
# File lib/bootstrap-rails-engine.rb, line 26
def bootstrap_stylesheet_url(name)
  return CDNS[:bootstrap_css][name]
end
bootstrap_theme_stylesheet_include_tag(name, options = {}) click to toggle source
# File lib/bootstrap-rails-engine.rb, line 71
def bootstrap_theme_stylesheet_include_tag(name, options = {})
  bootstrap_t = 'bootstrap/bootstrap-theme'
  bootstrap_t = bootstrap_t + '.min' if options.delete(:compressed)

  if OFFLINE and !options.delete(:force)
    return stylesheet_link_tag(bootstrap_t, options)
  else
    # Bootstrap Theme do not offer way to check existing
    [ stylesheet_link_tag(bootstrap_theme_stylesheet_url(name), options),
    ].join("\n").html_safe
  end
end
bootstrap_theme_stylesheet_url(name) click to toggle source
# File lib/bootstrap-rails-engine.rb, line 30
def bootstrap_theme_stylesheet_url(name)
  return CDNS[:bootstrap_theme_css][name]
end
fontawesome_stylesheet_include_tag(name, options = {}) click to toggle source
# File lib/bootstrap-rails-engine.rb, line 84
def fontawesome_stylesheet_include_tag(name, options = {})
  if OFFLINE and !options.delete(:force)
    # To be used with font-awesome-rails gem.
    return stylesheet_link_tag('font-awesome', options)
  else
    # Fontawesome do not offer way to check existing
    [ stylesheet_link_tag(fontawesome_stylesheet_url(name), options),
    ].join("\n").html_safe
  end
end
fontawesome_stylesheet_url(name) click to toggle source
# File lib/bootstrap-rails-engine.rb, line 34
def fontawesome_stylesheet_url(name)
  return CDNS[:fontawesome_css][name]
end