Class: ActiveElement::Components::Button
- Inherits:
-
Object
- Object
- ActiveElement::Components::Button
- Defined in:
- lib/active_element/components/button.rb
Overview
A clickable button.
Instance Method Summary collapse
-
#initialize(controller, record, flag_or_options, confirm: false, type: :primary, method: nil, float: nil, icon: nil, tooltip: false, nested_for: nil, **kwargs, &block) ⇒ Button
constructor
rubocop:disable Metrics/MethodLength.
-
#locals ⇒ Object
rubocop:disable Metrics/MethodLength.
-
#template ⇒ Object
rubocop:enable Metrics/MethodLength.
Constructor Details
#initialize(controller, record, flag_or_options, confirm: false, type: :primary, method: nil, float: nil, icon: nil, tooltip: false, nested_for: nil, **kwargs, &block) ⇒ Button
rubocop:disable Metrics/MethodLength
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/active_element/components/button.rb', line 8 def initialize(controller, record, , confirm: false, type: :primary, method: nil, float: nil, icon: nil, tooltip: false, nested_for: nil, **kwargs, &block) @controller = controller @record = record.is_a?(ActiveRecord::Relation) ? record.klass.new : record @flag_or_options = @float = float @kwargs = kwargs @kwargs_class = kwargs.delete(:class) @confirm = confirm @type = type @method = method @icon = icon @block_given = block_given? @content = block.call if block_given? @tooltip = tooltip @nested_for = nested_for end |
Instance Method Details
#locals ⇒ Object
rubocop:disable Metrics/MethodLength
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/active_element/components/button.rb', line 31 def locals # rubocop:disable Metrics/MethodLength { controller: controller, method: link_method, path: resource_path, confirm: confirm, type: type, title: title, float_class: float_class, icon: icon, button_class: , kwargs_class: kwargs_class, kwargs: kwargs, content: content, block_given: block_given, tooltip: tooltip } end |
#template ⇒ Object
rubocop:enable Metrics/MethodLength
27 28 29 |
# File 'lib/active_element/components/button.rb', line 27 def template 'active_element/components/button' end |