Module: Wallaby::ApplicationHelper
- Defined in:
- lib/helpers/wallaby/application_helper.rb
Overview
Application helper
Instance Method Summary collapse
-
#javascript_include_tag(*sources) ⇒ String
Add turbolinks options when it’s enabled.
-
#stylesheet_link_tag(*sources) ⇒ String
Add turbolinks options when it’s enabled.
-
#url_for(options = nil) ⇒ String
Override ‘actionview/lib/action_view/routing_url_for.rb#url_for` to handle the url_for properly for wallaby engine when options contains values of both `:resources` and `:action`.
Instance Method Details
#javascript_include_tag(*sources) ⇒ String
Add turbolinks options when it’s enabled
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/helpers/wallaby/application_helper.rb', line 38 def javascript_include_tag(*sources) = if Wallaby.configuration.features.turbolinks_enabled { 'data-turbolinks-track' => true, 'data-turbolinks-eval' => false } else {} end = .merge!(sources..stringify_keys) super(*sources, ) end |
#stylesheet_link_tag(*sources) ⇒ String
Add turbolinks options when it’s enabled
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/helpers/wallaby/application_helper.rb', line 23 def stylesheet_link_tag(*sources) = if Wallaby.configuration.features.turbolinks_enabled { 'data-turbolinks-track' => true } else {} end = .merge!(sources..stringify_keys) super(*sources, ) end |
#url_for(options = nil) ⇒ String
Override ‘actionview/lib/action_view/routing_url_for.rb#url_for` to handle the url_for properly for wallaby engine when options contains values of both `:resources` and `:action`
9 10 11 12 13 14 15 16 17 |
# File 'lib/helpers/wallaby/application_helper.rb', line 9 def url_for( = nil) # possible Hash or Parameters if .respond_to?(:to_h) \ && [:resources].present? && [:action].present? UrlFor.handle wallaby_engine, else super end end |