Class: Editor::Component
- Inherits:
-
Lookbook::BaseComponent
- Object
- Lookbook::BaseComponent
- Editor::Component
- Defined in:
- app/components/lookbook/display_options/editor/component.rb,
app/components/lookbook/params/editor/component.rb
Class Method Summary collapse
Instance Method Summary collapse
- #before_render ⇒ Object
-
#initialize(**html_attrs) ⇒ Component
constructor
A new instance of Component.
- #param_styles ⇒ Object
Constructor Details
#initialize(**html_attrs) ⇒ Component
Returns a new instance of Component.
9 10 11 12 13 |
# File 'app/components/lookbook/params/editor/component.rb', line 9 def initialize(**html_attrs) @field_count = -1 @@input_styles = {} super(**html_attrs) end |
Class Method Details
.add_styles(input, styles) ⇒ Object
25 26 27 28 |
# File 'app/components/lookbook/params/editor/component.rb', line 25 def self.add_styles(input, styles) @@input_styles = {} unless defined?(@@input_styles) @@input_styles[input] ||= styles end |
Instance Method Details
#before_render ⇒ Object
15 16 17 |
# File 'app/components/lookbook/params/editor/component.rb', line 15 def before_render fields end |
#param_styles ⇒ Object
19 20 21 22 23 |
# File 'app/components/lookbook/params/editor/component.rb', line 19 def param_styles @css_styles ||= @@input_styles.map do |input_name, styles| styles.map { |s| "[data-param-input=#{input_name}] #{s}" }.join("\n") end.join("\n") end |