Class: Avo::Resources::Controls::BaseControl

Inherits:
Object
  • Object
show all
Defined in:
lib/avo/resources/controls/base_control.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ BaseControl

Returns a new instance of BaseControl.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/avo/resources/controls/base_control.rb', line 7

def initialize(**args)
  @label = args[:label]
  @title = args[:title]
  @color = args[:color] || :gray
  @style = args[:style] || :text
  @icon = args[:icon]
  @icon_class = @style == :icon ? " text-gray-600 h-6 hover:text-gray-600" : ""
  @confirmation_message = args[:confirmation_message]
  @size = args[:size] || :md
  @as_index_control = args[:as_index_control]
end

Instance Attribute Details

#as_index_controlObject (readonly)

Returns the value of attribute as_index_control.



5
6
7
# File 'lib/avo/resources/controls/base_control.rb', line 5

def as_index_control
  @as_index_control
end

#colorObject (readonly)

Returns the value of attribute color.



5
6
7
# File 'lib/avo/resources/controls/base_control.rb', line 5

def color
  @color
end

#confirmation_messageObject (readonly)

Returns the value of attribute confirmation_message.



5
6
7
# File 'lib/avo/resources/controls/base_control.rb', line 5

def confirmation_message
  @confirmation_message
end

#iconObject (readonly)

Returns the value of attribute icon.



5
6
7
# File 'lib/avo/resources/controls/base_control.rb', line 5

def icon
  @icon
end

#icon_classObject (readonly)

Returns the value of attribute icon_class.



5
6
7
# File 'lib/avo/resources/controls/base_control.rb', line 5

def icon_class
  @icon_class
end

#labelObject (readonly)

Returns the value of attribute label.



5
6
7
# File 'lib/avo/resources/controls/base_control.rb', line 5

def label
  @label
end

#sizeObject (readonly)

Returns the value of attribute size.



5
6
7
# File 'lib/avo/resources/controls/base_control.rb', line 5

def size
  @size
end

#styleObject (readonly)

Returns the value of attribute style.



5
6
7
# File 'lib/avo/resources/controls/base_control.rb', line 5

def style
  @style
end

#titleObject (readonly)

Returns the value of attribute title.



5
6
7
# File 'lib/avo/resources/controls/base_control.rb', line 5

def title
  @title
end

Instance Method Details

#typeObject



19
20
21
# File 'lib/avo/resources/controls/base_control.rb', line 19

def type
  self.class.name.demodulize.underscore.to_sym
end