Sha256: fed9f9625a52314917bb8340a08b33be51db957ea834deda1c1b221f660e4367
Contents?: true
Size: 1.65 KB
Versions: 1
Compression:
Stored size: 1.65 KB
Contents
module BootstrapRailsEngine module ActionViewExtensions OFFLINE = (::Rails.env.development? or ::Rails.env.test?) CDNS = { :bootstrap_js => { :default => "//netdna.bootstrapcdn.com/twitter-bootstrap/2.3/js/bootstrap.min.js" }, :bootstrap_css => { :default => "//netdna.bootstrapcdn.com/twitter-bootstrap/2.3/css/bootstrap-combined.min.css" }, } def bootstrap_javascript_url(name, options = {}) return CDNS[:bootstrap_js][name] end def bootstrap_stylesheet_url(name, options = {}) return CDNS[:bootstrap_css][name] end # to be used with bootstrap-rails-engine gem def bootstrap_javascript_include_tag(name, options = {}) bootstrap_j = 'bootstrap/bootstrap' bootstrap_j = bootstrap_j + '.min' if options[:compressed] if OFFLINE and !options[:force] return javascript_include_tag(bootstrap_j) else # Bootstrap do not offer way to check existing [ javascript_include_tag(bootstrap_javascript_url(name, options)), ].join("\n").html_safe end end def bootstrap_stylesheet_include_tag(name, options = {}) if OFFLINE and !options[:force] return stylesheet_link_tag('bootstrap/bootstrap') else # Bootstrap do not offer way to check existing [ stylesheet_link_tag(bootstrap_stylesheet_url(name, options)), ].join("\n").html_safe end end end class Engine < ::Rails::Engine initializer 'bootstrap-rails-engine.action_view' do |app| ActiveSupport.on_load(:action_view) do include BootstrapRailsEngine::ActionViewExtensions end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bootstrap-rails-engine-1.2.9 | lib/bootstrap-rails-engine.rb |