Class: Maquina::Navbar::ProfileMenuItemLink

Inherits:
Phlex::HTML
  • Object
show all
Includes:
ApplicationView
Defined in:
app/views/maquina/navbar/profile_menu_item_link.rb

Instance Method Summary collapse

Methods included from ApplicationView

#attribute_human_name, #button_to, #image_tag, #link_to, #model_human_name, #svg_icon

Constructor Details

#initialize(option, path, attributes, desktop: true, active: false) ⇒ ProfileMenuItemLink

Returns a new instance of ProfileMenuItemLink.



9
10
11
12
13
14
15
# File 'app/views/maquina/navbar/profile_menu_item_link.rb', line 9

def initialize(option, path, attributes, desktop: true, active: false)
  @option = option
  @path = path
  @attributes = attributes
  @desktop = desktop
  @active = active
end

Instance Method Details

#view_templateObject



17
18
19
20
21
22
23
24
# File 'app/views/maquina/navbar/profile_menu_item_link.rb', line 17

def view_template
  link_method = link_attributes.dig(:method)
  if link_method == :delete
    button_to t("menu.profile.#{@option}"), @path, method: :delete, **link_attributes
  else
    a(href: @path, **link_attributes) { t("menu.profile.#{@option}") }
  end
end