Module: BootstrapRailsEngine::ActionViewExtensions
- Defined in:
- lib/bootstrap-rails-engine.rb
Constant Summary collapse
- OFFLINE =
(::Rails.env.development? or ::Rails.env.test?)
- CDNS =
{ :bootstrap_js => { :default => "//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/js/bootstrap.min.js" }, :bootstrap_css => { :default => "//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/css/bootstrap-combined.min.css" }, }
Instance Method Summary collapse
-
#bootstrap_javascript_include_tag(name, options = {}) ⇒ Object
to be used with bootstrap-rails-engine gem.
- #bootstrap_javascript_url(name) ⇒ Object
- #bootstrap_stylesheet_include_tag(name, options = {}) ⇒ Object
- #bootstrap_stylesheet_url(name) ⇒ Object
Instance Method Details
#bootstrap_javascript_include_tag(name, options = {}) ⇒ Object
to be used with bootstrap-rails-engine gem
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/bootstrap-rails-engine.rb', line 23 def bootstrap_javascript_include_tag(name, = {}) bootstrap_j = 'bootstrap/bootstrap' bootstrap_j = bootstrap_j + '.min' if .delete(:compressed) if OFFLINE and !.delete(:force) return javascript_include_tag(bootstrap_j, ) else # Bootstrap do not offer way to check existing [ javascript_include_tag(bootstrap_javascript_url(name)), javascript_tag("typeof $().carousel == 'function' || document.write(unescape('#{javascript_include_tag(bootstrap_j, options).gsub('<','%3C')}'))") ].join("\n").html_safe end end |
#bootstrap_javascript_url(name) ⇒ Object
14 15 16 |
# File 'lib/bootstrap-rails-engine.rb', line 14 def bootstrap_javascript_url(name) return CDNS[:bootstrap_js][name] end |
#bootstrap_stylesheet_include_tag(name, options = {}) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/bootstrap-rails-engine.rb', line 37 def bootstrap_stylesheet_include_tag(name, = {}) if OFFLINE and !.delete(:force) return stylesheet_link_tag('bootstrap/bootstrap', ) else # Bootstrap do not offer way to check existing [ stylesheet_link_tag(bootstrap_stylesheet_url(name), ), ].join("\n").html_safe end end |
#bootstrap_stylesheet_url(name) ⇒ Object
18 19 20 |
# File 'lib/bootstrap-rails-engine.rb', line 18 def bootstrap_stylesheet_url(name) return CDNS[:bootstrap_css][name] end |