Module: BootswatchRails::ActionViewExtensions
- Defined in:
- lib/bootswatch_rails/engine.rb
Constant Summary collapse
- OFFLINE =
(Rails.env.development? or Rails.env.test?)
Instance Method Summary collapse
- #bootstrap_include_tag(options = {}) ⇒ Object
- #bootswatch_link_tag(theme = nil, options = {}) ⇒ Object
- #dataTables_include_tag(options = {}) ⇒ Object
- #dataTables_link_tag(options = {}) ⇒ Object
- #dataTables_responsive_include_tag(options = {}) ⇒ Object
- #dataTables_responsive_link_tag(options = {}) ⇒ Object
Instance Method Details
#bootstrap_include_tag(options = {}) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/bootswatch_rails/engine.rb', line 27 def bootstrap_include_tag( = {}) return javascript_include_tag(:bootstrap) if !.delete(:force) and OFFLINE bootstrap_url = "//maxcdn.bootstrapcdn.com/bootstrap/#{BootswatchRails::BOOTSTRAP}/js/bootstrap.min.js" [ javascript_include_tag(bootstrap_url, ), javascript_tag("window.jQuery || document.write(unescape('#{javascript_include_tag(:bootstrap).gsub('<','%3C')}'))") ].join("\n").html_safe end |
#bootswatch_link_tag(theme = nil, options = {}) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/bootswatch_rails/engine.rb', line 7 def bootswatch_link_tag(theme = nil, = {}) theme ||= BootswatchRails::THEMES[BootswatchRails::DEFAULT].to_s return stylesheet_link_tag(theme) if !.delete(:force) and OFFLINE bootswatch_url = "//maxcdn.bootstrapcdn.com/bootswatch/#{BootswatchRails::BOOTSWATCH}/#{theme}/bootstrap.min.css" fontawesome_url = "//maxcdn.bootstrapcdn.com/font-awesome/#{BootswatchRails::FONT_AWESOME}/css/font-awesome.min.css" stylesheet_link_tag(bootswatch_url) + "\n " + stylesheet_link_tag(fontawesome_url) end |
#dataTables_include_tag(options = {}) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/bootswatch_rails/engine.rb', line 35 def dataTables_include_tag( = {}) return javascript_include_tag('jquery.dataTables') if !.delete(:force) and OFFLINE dataTables_url = "//cdn.datatables.net/#{BootswatchRails::DATATABLES}/js/jquery.dataTables.js" [ javascript_include_tag(dataTables_url, ), javascript_tag("window.jQuery || document.write(unescape('#{javascript_include_tag('jquery.dataTables').gsub('<','%3C')}'))") ].join("\n").html_safe end |
#dataTables_link_tag(options = {}) ⇒ Object
15 16 17 18 19 |
# File 'lib/bootswatch_rails/engine.rb', line 15 def dataTables_link_tag( = {}) return stylesheet_link_tag('jquery.dataTables') if !.delete(:force) and OFFLINE dataTables_url = "//cdn.datatables.net/#{BootswatchRails::DATATABLES}/css/jquery.dataTables.css" stylesheet_link_tag(dataTables_url) end |
#dataTables_responsive_include_tag(options = {}) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/bootswatch_rails/engine.rb', line 43 def dataTables_responsive_include_tag( = {}) return javascript_include_tag('dataTables.responsive') if !.delete(:force) and OFFLINE responsive_url = "//cdn.datatables.net/responsive/#{BootswatchRails::RESPONSIVE}/js/dataTables.responsive.js" [ javascript_include_tag(responsive_url, ), javascript_tag("window.jQuery || document.write(unescape('#{javascript_include_tag('dataTables.responsive').gsub('<','%3C')}'))") ].join("\n").html_safe end |
#dataTables_responsive_link_tag(options = {}) ⇒ Object
21 22 23 24 25 |
# File 'lib/bootswatch_rails/engine.rb', line 21 def dataTables_responsive_link_tag( = {}) return stylesheet_link_tag('responsive.dataTables') if !.delete(:force) and OFFLINE responsive_url = "//cdn.datatables.net/responsive/#{BootswatchRails::RESPONSIVE}/css/responsive.dataTables.css" stylesheet_link_tag(responsive_url) end |