Class: Navigation::Icon

Inherits:
Components::Base
  • Object
show all
Includes:
Phlex::Rails::Helpers::LinkTo
Defined in:
app/components/databasium/navigation/icon.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(element:) ⇒ Icon

Returns a new instance of Icon.



8
9
10
# File 'app/components/databasium/navigation/icon.rb', line 8

def initialize(element:)
  @element = element
end

Instance Attribute Details

#elementObject (readonly)

Returns the value of attribute element.



6
7
8
# File 'app/components/databasium/navigation/icon.rb', line 6

def element
  @element
end

Instance Method Details

#view_templateObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/components/databasium/navigation/icon.rb', line 12

def view_template
  case element[:method]
  when :frontend
    render Navigation::FrontendIcon.new(element: element, data_params: element[:data_params])
  when :get
    render Navigation::GetIcon.new(element: element, turbo_frame: element[:turbo_frame])
  when :post
    render Navigation::PostIcon.new(element: element)
  when :put
    render Navigation::PutIcon.new(element: element)
  else
    p { "Please provide method to icon component" }
  end
end