Class: Trestle::Mobility::Fields::TextArea

Inherits:
Form::Field
  • Object
show all
Defined in:
lib/trestle/mobility/fields/text_area.rb

Instance Method Summary collapse

Instance Method Details

#defaultsObject



5
6
7
# File 'lib/trestle/mobility/fields/text_area.rb', line 5

def defaults
  super.merge(rows: 5)
end

#fieldObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/trestle/mobility/fields/text_area.rb', line 9

def field
  label = options[:label] || name.to_s.humanize
  locales = options[:locales] || I18n.available_locales.sort
  selected = options[:selected] || Trestle.config.mobility.selected.call || locales.first
  deepl_query_params =  options[:deepl_query_params] || {}

  @template.render partial: "trestle/mobility/text_area",
                   locals: {
                     options: options,
                     field_name: name,
                     label: label,
                     locales: locales,
                     selected: selected,
                     deepl_query_params: deepl_query_params
                   }
end