Sha256: 8296f5594fd766e552c93b79f316e0e2c6b3bccfc0ba4d1675f93fbc9f6c73db
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.2.2/js/bootstrap.min.js" }, :bootstrap_css => { :default => "//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/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.2 | lib/bootstrap-rails-engine.rb |