Class: Formatic::String

Inherits:
Base show all
Defined in:
app/components/formatic/string.rb

Overview

Text input for one-liners.

Instance Method Summary collapse

Methods inherited from Base

#input_name, #param_key, #value, #wrapper

Methods inherited from ApplicationComponent

#initialize

Constructor Details

This class inherits a constructor from Formatic::ApplicationComponent

Instance Method Details

#css_classesObject



45
46
47
48
49
50
# File 'app/components/formatic/string.rb', line 45

def css_classes
  classes = i[c-formatic-string__input js-formatic-string]
  classes.push(:'is-terminal') if terminal?
  classes.push(:'is-autosubmit') if async_submit
  classes
end

#input_optionsObject



33
34
35
36
37
38
39
40
41
42
43
# File 'app/components/formatic/string.rb', line 33

def input_options
  result = {
    placeholder: wrapper.placeholder,
    autofocus:,
    class: css_classes
  }

  (result[:value] = value) if value

  result
end