Class: Avo::Sidebar::LinkComponent
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- Avo::Sidebar::LinkComponent
- Defined in:
- app/components/avo/sidebar/link_component.rb
Instance Method Summary collapse
- #classes ⇒ Object
- #is_external? ⇒ Boolean
-
#link_caller ⇒ Object
Backwards compatibility with ViewComponent 3.x.
-
#link_method ⇒ Object
For external links active_link_to marks them all as active.
Instance Method Details
#classes ⇒ Object
39 40 41 |
# File 'app/components/avo/sidebar/link_component.rb', line 39 def classes "px-4 pr-0 flex-1 flex mx-6 leading-none py-2 text-black rounded font-medium hover:bg-gray-100 gap-1" end |
#is_external? ⇒ Boolean
18 19 20 21 22 23 |
# File 'app/components/avo/sidebar/link_component.rb', line 18 def is_external? # If the path contains the scheme, check if it includes the root path or not return !@path.include?(helpers.mount_path) if URI(@path).scheme.present? false end |
#link_caller ⇒ Object
Backwards compatibility with ViewComponent 3.x
31 32 33 34 35 36 37 |
# File 'app/components/avo/sidebar/link_component.rb', line 31 def link_caller if Gem::Version.new(ViewComponent::VERSION::STRING) >= Gem::Version.new("4.0.0") helpers else self end end |
#link_method ⇒ Object
For external links active_link_to marks them all as active.
26 27 28 |
# File 'app/components/avo/sidebar/link_component.rb', line 26 def link_method is_external? ? :link_to : :active_link_to end |