Class: Superview::Helpers::Turbo::MetaTags
- Inherits:
-
ApplicationComponent
- Object
- ApplicationComponent
- Superview::Helpers::Turbo::MetaTags
- Defined in:
- lib/superview/helpers/turbo/meta_tags.rb
Overview
Renders the metatags for setting up Turbo Drive.
Constant Summary collapse
- METHOD =
:replace
- SCROLL =
:reset
Instance Attribute Summary collapse
-
#exempts_page_from_cache ⇒ Object
Returns the value of attribute exempts_page_from_cache.
-
#exempts_page_from_preview ⇒ Object
Returns the value of attribute exempts_page_from_preview.
-
#method ⇒ Object
Returns the value of attribute method.
-
#page_requires_reload ⇒ Object
Returns the value of attribute page_requires_reload.
-
#scroll ⇒ Object
Returns the value of attribute scroll.
Instance Method Summary collapse
-
#initialize(method: METHOD, scroll: SCROLL, exempts_page_from_preview: nil, exempts_page_from_cache: nil, page_requires_reload: nil) ⇒ MetaTags
constructor
A new instance of MetaTags.
- #refreshes_with(method: METHOD, scroll: SCROLL) ⇒ Object
- #view_template ⇒ Object
Constructor Details
#initialize(method: METHOD, scroll: SCROLL, exempts_page_from_preview: nil, exempts_page_from_cache: nil, page_requires_reload: nil) ⇒ MetaTags
Returns a new instance of MetaTags.
16 17 18 19 20 21 |
# File 'lib/superview/helpers/turbo/meta_tags.rb', line 16 def initialize(method: METHOD, scroll: SCROLL, exempts_page_from_preview: nil, exempts_page_from_cache: nil, page_requires_reload: nil) refreshes_with method: method, scroll: scroll @exempts_page_from_cache = exempts_page_from_cache @exempts_page_from_preview = exempts_page_from_preview @page_requires_reload = page_requires_reload end |
Instance Attribute Details
#exempts_page_from_cache ⇒ Object
Returns the value of attribute exempts_page_from_cache.
6 7 8 |
# File 'lib/superview/helpers/turbo/meta_tags.rb', line 6 def exempts_page_from_cache @exempts_page_from_cache end |
#exempts_page_from_preview ⇒ Object
Returns the value of attribute exempts_page_from_preview.
6 7 8 |
# File 'lib/superview/helpers/turbo/meta_tags.rb', line 6 def exempts_page_from_preview @exempts_page_from_preview end |
#method ⇒ Object
Returns the value of attribute method.
6 7 8 |
# File 'lib/superview/helpers/turbo/meta_tags.rb', line 6 def method @method end |
#page_requires_reload ⇒ Object
Returns the value of attribute page_requires_reload.
6 7 8 |
# File 'lib/superview/helpers/turbo/meta_tags.rb', line 6 def page_requires_reload @page_requires_reload end |
#scroll ⇒ Object
Returns the value of attribute scroll.
6 7 8 |
# File 'lib/superview/helpers/turbo/meta_tags.rb', line 6 def scroll @scroll end |
Instance Method Details
#refreshes_with(method: METHOD, scroll: SCROLL) ⇒ Object
31 32 33 34 |
# File 'lib/superview/helpers/turbo/meta_tags.rb', line 31 def refreshes_with(method: METHOD, scroll: SCROLL) self.method = method self.scroll = scroll end |
#view_template ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/superview/helpers/turbo/meta_tags.rb', line 23 def view_template (name: "turbo-refresh-method", content: @method) (name: "turbo-refresh-scroll", content: @scroll) (name: "turbo-cache-control", content: "no-cache") if @exempts_page_from_cache (name: "turbo-cache-control", content: "no-preview") if @exempts_page_from_preview (name: "turbo-visit-control", content: "reload") if @page_requires_reload end |