Class: Maglev::Uikit::AppLayout::Topbar::PageInfoComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/maglev/uikit/app_layout/topbar/page_info_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(page:, paths:, live_page_url:, prefix_page_path:) ⇒ PageInfoComponent

Returns a new instance of PageInfoComponent.



10
11
12
13
14
15
# File 'app/components/maglev/uikit/app_layout/topbar/page_info_component.rb', line 10

def initialize(page:, paths:, live_page_url:, prefix_page_path:)
  @page = page
  @paths = paths
  @live_page_url = live_page_url
  @prefix_page_path = prefix_page_path
end

Instance Attribute Details

#live_page_urlObject (readonly)

Returns the value of attribute live_page_url.



8
9
10
# File 'app/components/maglev/uikit/app_layout/topbar/page_info_component.rb', line 8

def live_page_url
  @live_page_url
end

#pageObject (readonly)

Returns the value of attribute page.



8
9
10
# File 'app/components/maglev/uikit/app_layout/topbar/page_info_component.rb', line 8

def page
  @page
end

#pathsObject (readonly)

Returns the value of attribute paths.



8
9
10
# File 'app/components/maglev/uikit/app_layout/topbar/page_info_component.rb', line 8

def paths
  @paths
end

#prefix_page_pathObject (readonly)

Returns the value of attribute prefix_page_path.



8
9
10
# File 'app/components/maglev/uikit/app_layout/topbar/page_info_component.rb', line 8

def prefix_page_path
  @prefix_page_path
end

Instance Method Details

#icon_nameObject



17
18
19
# File 'app/components/maglev/uikit/app_layout/topbar/page_info_component.rb', line 17

def icon_name
  page.index? ? 'home' : 'file'
end

#page_pathObject



21
22
23
# File 'app/components/maglev/uikit/app_layout/topbar/page_info_component.rb', line 21

def page_path
  "#{prefix_page_path}#{page.path.presence || page.default_path}"
end