Class: Arara::StepComponent
- Inherits:
-
ActionView::Component::Base
- Object
- ActionView::Component::Base
- Arara::StepComponent
- Includes:
- BaseComponent
- Defined in:
- app/components/arara/step_component.rb
Instance Attribute Summary collapse
-
#active ⇒ Object
readonly
Returns the value of attribute active.
-
#alternative_label ⇒ Object
readonly
Returns the value of attribute alternative_label.
-
#completed ⇒ Object
readonly
Returns the value of attribute completed.
-
#connector ⇒ Object
readonly
Returns the value of attribute connector.
-
#disabled ⇒ Object
readonly
Returns the value of attribute disabled.
-
#editable ⇒ Object
readonly
Returns the value of attribute editable.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#orientation ⇒ Object
readonly
Returns the value of attribute orientation.
-
#sub_title ⇒ Object
readonly
Returns the value of attribute sub_title.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #connector_line_options ⇒ Object
- #connector_root_options ⇒ Object
- #default_html_class ⇒ Object
- #has_connector? ⇒ Boolean
- #has_vertical_content? ⇒ Boolean
- #icon_container_options ⇒ Object
- #icon_options ⇒ Object
- #icon_tag ⇒ Object
-
#initialize(title: "", sub_title: nil, orientation: "horizontal", alternative_label: false, active: false, completed: false, disabled: false, editable: false, link: nil, order: 0, connector: false, **kw) ⇒ StepComponent
constructor
A new instance of StepComponent.
- #label_root_options ⇒ Object
- #step_label_options ⇒ Object
Methods included from BaseComponent
#default_data_controller, #default_html_tag, #html_class, #html_content, #html_data, #html_options, #html_tag, included
Constructor Details
#initialize(title: "", sub_title: nil, orientation: "horizontal", alternative_label: false, active: false, completed: false, disabled: false, editable: false, link: nil, order: 0, connector: false, **kw) ⇒ StepComponent
Returns a new instance of StepComponent.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/components/arara/step_component.rb', line 5 def initialize(title: "", sub_title: nil, orientation: "horizontal", alternative_label: false, active: false, completed: false, disabled: false, editable: false, link: nil, order: 0, connector: false, **kw) @orientation = orientation @alternative_label = alternative_label @active = active @completed = completed @disabled = disabled @editable = editable @link = link @title = title @sub_title = sub_title @order = order @connector = connector super(tag: "div", **kw) end |
Instance Attribute Details
#active ⇒ Object (readonly)
Returns the value of attribute active.
3 4 5 |
# File 'app/components/arara/step_component.rb', line 3 def active @active end |
#alternative_label ⇒ Object (readonly)
Returns the value of attribute alternative_label.
3 4 5 |
# File 'app/components/arara/step_component.rb', line 3 def alternative_label @alternative_label end |
#completed ⇒ Object (readonly)
Returns the value of attribute completed.
3 4 5 |
# File 'app/components/arara/step_component.rb', line 3 def completed @completed end |
#connector ⇒ Object (readonly)
Returns the value of attribute connector.
3 4 5 |
# File 'app/components/arara/step_component.rb', line 3 def connector @connector end |
#disabled ⇒ Object (readonly)
Returns the value of attribute disabled.
3 4 5 |
# File 'app/components/arara/step_component.rb', line 3 def disabled @disabled end |
#editable ⇒ Object (readonly)
Returns the value of attribute editable.
3 4 5 |
# File 'app/components/arara/step_component.rb', line 3 def editable @editable end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
3 4 5 |
# File 'app/components/arara/step_component.rb', line 3 def link @link end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
3 4 5 |
# File 'app/components/arara/step_component.rb', line 3 def order @order end |
#orientation ⇒ Object (readonly)
Returns the value of attribute orientation.
3 4 5 |
# File 'app/components/arara/step_component.rb', line 3 def orientation @orientation end |
#sub_title ⇒ Object (readonly)
Returns the value of attribute sub_title.
3 4 5 |
# File 'app/components/arara/step_component.rb', line 3 def sub_title @sub_title end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'app/components/arara/step_component.rb', line 3 def title @title end |
Instance Method Details
#connector_line_options ⇒ Object
91 92 93 94 95 |
# File 'app/components/arara/step_component.rb', line 91 def classes = %w(MuiStepConnector-line) classes.push('MuiStepConnector-lineHorizontal') if orientation == "horizontal" { class: classes.join(" ") } end |
#connector_root_options ⇒ Object
82 83 84 85 86 87 88 89 |
# File 'app/components/arara/step_component.rb', line 82 def classes = %w(MuiStepConnector-root) classes.push('MuiStepConnector-horizontal') if orientation == "horizontal" classes.push('MuiStepConnector-vertical') if orientation == "vertical" classes.push('MuiStepConnector-alternativeLabel') if alternative_label classes.push('MuiStepConnector-active') { class: classes.join(" ") } end |
#default_html_class ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'app/components/arara/step_component.rb', line 20 def default_html_class classes = %w(MuiStep-root) classes.push("MuiStep-horizontal") if orientation == "horizontal" classes.push("MuiStep-vertical") if orientation == "vertical" classes.push("MuiStep-alternativeLabel") if alternative_label classes.push("MuiStep-completed") if completed classes.join(" ") end |
#has_connector? ⇒ Boolean
78 79 80 |
# File 'app/components/arara/step_component.rb', line 78 def has_connector? connector end |
#has_vertical_content? ⇒ Boolean
97 98 99 |
# File 'app/components/arara/step_component.rb', line 97 def has_vertical_content? orientation == "vertical" && active && !html_content.empty? end |
#icon_container_options ⇒ Object
39 40 41 42 43 44 45 |
# File 'app/components/arara/step_component.rb', line 39 def classes = %w(MuiStepLabel-iconContainer) classes.push("MuiStepLabel-alternativeLabel") if alternative_label { class: classes.join(" "), } end |
#icon_options ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/components/arara/step_component.rb', line 47 def classes = %w(MuiSvgIcon-root MuiStepIcon-root) classes.push("MuiStepIcon-completed") if completed classes.push("MuiStepIcon-active") if active { class: classes.join(" "), focusable: false, 'view-box': "0 0 24 24", 'aria-hidden': true, role: "presentation" } end |
#icon_tag ⇒ Object
60 61 62 63 64 65 66 67 |
# File 'app/components/arara/step_component.rb', line 60 def icon_tag if completed return content_tag(:path, nil, d: "M12 0a12 12 0 1 0 0 24 12 12 0 0 0 0-24zm-2 17l-5-5 1.4-1.4 3.6 3.6 7.6-7.6L19 8l-9 9z") end content_tag(:circle, nil, cx: 12, cy: 12, r: 12) + content_tag(:text, order, class: "MuiStepIcon-text", x: "12", y: "16", 'text-anchor': "middle") end |
#label_root_options ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'app/components/arara/step_component.rb', line 29 def classes = %w(MuiStepLabel-root) classes.push("MuiStepLabel-horizontal") if orientation == "horizontal" classes.push("MuiStepLabel-vertical") if orientation == "vertical" classes.push("MuiStepLabel-alternativeLabel") if alternative_label { class: classes.join(" ") } end |
#step_label_options ⇒ Object
69 70 71 72 73 74 75 76 |
# File 'app/components/arara/step_component.rb', line 69 def classes = %w(MuiTypography-root MuiStepLabel-label) classes.push('MuiStepLabel-alternativeLabel') if alternative_label classes.push('MuiStepLabel-completed') if completed classes.push('MuiStepLabel-active') if active classes.push('MuiTypography-body2 MuiTypography-displayBlock') { class: classes.join(" ") } end |