Class: Layouts::CrudComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Layouts::CrudComponent
- Defined in:
- app/components/layouts/crud_component.rb
Instance Method Summary collapse
- #body_options_attrs ⇒ Object
- #footer_options_attrs ⇒ Object
- #form_options_attrs ⇒ Object
-
#initialize(title, description: nil, count: nil, icon: nil, icon_class: nil, toggle_text: nil, options: {}, count_options: {}, body_options: {}, form_options: {}, toggle_options: {}, footer_options: {}) ⇒ CrudComponent
constructor
A new instance of CrudComponent.
- #toggle_button_options_attrs ⇒ Object
Constructor Details
#initialize(title, description: nil, count: nil, icon: nil, icon_class: nil, toggle_text: nil, options: {}, count_options: {}, body_options: {}, form_options: {}, toggle_options: {}, footer_options: {}) ⇒ CrudComponent
Returns a new instance of CrudComponent.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/components/layouts/crud_component.rb', line 17 def initialize( title, description: nil, count: nil, icon: nil, icon_class: nil, toggle_text: nil, options: {}, count_options: {}, body_options: {}, form_options: {}, toggle_options: {}, footer_options: {} ) @title = title @description = description @count = count @icon = icon @icon_class = icon_class @toggle_text = toggle_text @options = @count_options = @body_options = @form_options = @toggle_options = @footer_options = end |
Instance Method Details
#body_options_attrs ⇒ Object
43 44 45 46 47 48 49 |
# File 'app/components/layouts/crud_component.rb', line 43 def default_testid = 'crud-body' default_classes = [ ('gl-rounded-b-base' unless ) ] @body_options.merge(default_attrs(@body_options, default_testid, default_classes)) end |
#footer_options_attrs ⇒ Object
66 67 68 69 |
# File 'app/components/layouts/crud_component.rb', line 66 def default_testid = 'crud-footer' @footer_options.merge(default_attrs(@footer_options, default_testid)) end |
#form_options_attrs ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'app/components/layouts/crud_component.rb', line 57 def default_testid = 'crud-form' default_classes = [ ('js-toggle-content' if @toggle_text), ('gl-hidden' if @toggle_text && !@form_options[:form_errors]) ] @form_options.merge(default_attrs(@form_options, default_testid, default_classes)) end |
#toggle_button_options_attrs ⇒ Object
51 52 53 54 55 |
# File 'app/components/layouts/crud_component.rb', line 51 def default_testid = 'crud-action-toggle' default_classes = ['js-toggle-button js-toggle-content'] @toggle_options.merge(default_attrs(@toggle_options, default_testid, default_classes)) end |