Class: DynamicFieldsets::TextareaField

Inherits:
Field
  • Object
show all
Defined in:
app/models/dynamic_fieldsets/textarea_field.rb

Overview

Textarea input

Note that this one is a little different than normal because the textarea does not store it’s data in a value attribute

Instance Method Summary collapse

Methods inherited from Field

#collect_default_values, #collect_field_records_by_fsa_and_fsc, descendant_collection, descendants, #display_type, #form_footer_partial, #form_header_partial, #form_partial, #get_value_for_show, #get_values_using_fsa_and_fsc, #has_defaults?, #in_use?, #show_footer_partial, #show_header_partial, #show_partial, #show_partial_locals, #update_field_records, #use_form_footer_partial?, #use_form_header_partial?, #use_show_footer_partial?, #use_show_header_partial?, #uses_field_options?

Instance Method Details

#default_colsInteger

Returns Default number of columns for the textarea.

Returns:

  • (Integer)

    Default number of columns for the textarea



10
11
12
# File 'app/models/dynamic_fieldsets/textarea_field.rb', line 10

def default_cols
  40
end

#default_rowsInteger

Returns Default number of rows for the textarea.

Returns:

  • (Integer)

    Default number of rows for the textarea



15
16
17
# File 'app/models/dynamic_fieldsets/textarea_field.rb', line 15

def default_rows
  6
end

#form_partial_locals(args) ⇒ Hash

Returns Data for the form partial.

Returns:

  • (Hash)

    Data for the form partial



32
33
34
35
36
37
# File 'app/models/dynamic_fieldsets/textarea_field.rb', line 32

def form_partial_locals(args)
  output = super
  output[:content] = value_or_default_for_form(args[:value])
  output[:attrs][:name] = output[:name]
  return output
end

#html_attribute_hashHash

Returns Html attributes for the textarea with default cols and rows if none are set.

Returns:

  • (Hash)

    Html attributes for the textarea with default cols and rows if none are set



20
21
22
23
24
25
26
27
28
29
# File 'app/models/dynamic_fieldsets/textarea_field.rb', line 20

def html_attribute_hash
  # this should get overriden by attributes the user sets
  # with the call to super
  output = {
    :cols => default_cols,
    :rows => default_rows,
  }
  output.merge!(super)
  return output
end