Class: Formstrap::TextView

Inherits:
ViewModel show all
Includes:
Autocompletable, Hintable, InputGroupable, Labelable, Listable, Placeholderable, Validatable, Wrappable
Defined in:
app/models/formstrap/text_view.rb

Instance Method Summary collapse

Methods inherited from ViewModel

#attributes, #initialize, #to_hash

Constructor Details

This class inherits a constructor from ViewModel

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ViewModel

Instance Method Details

#input_group_optionsObject



19
20
21
22
23
24
# File 'app/models/formstrap/text_view.rb', line 19

def input_group_options
  default_input_group_options
    .deep_merge(autocomplete_input_group_options)
    .deep_merge(label_input_group_options)
    .deep_merge(@input_group || {})
end

#input_optionsObject



12
13
14
15
16
17
# File 'app/models/formstrap/text_view.rb', line 12

def input_options
  keys = attributes - %i[append attribute collection float form input_group label prepend validate wrapper]
  options = to_h.slice(*keys)
  options = default_input_options.deep_merge(options)
  options.deep_merge(autocomplete_input_options)
end

#wrapper_optionsObject



26
27
28
29
30
# File 'app/models/formstrap/text_view.rb', line 26

def wrapper_options
  default_wrapper_options.deep_merge({
    class: ["mb-3", ("form-floating" if float)]
  }).deep_merge(@wrapper || {})
end