Class: Avo::Sidebar::LinkComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/avo/sidebar/link_component.rb

Instance Method Summary collapse

Instance Method Details

#classesObject



28
29
30
# File 'app/components/avo/sidebar/link_component.rb', line 28

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

Returns:

  • (Boolean)


16
17
18
19
20
21
# File 'app/components/avo/sidebar/link_component.rb', line 16

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

For external links active_link_to marks them all as active.



24
25
26
# File 'app/components/avo/sidebar/link_component.rb', line 24

def link_method
  is_external? ? :link_to : :active_link_to
end