Class: Matestack::Ui::Bootstrap::Form::Textarea

Inherits:
VueJs::Components::Form::Textarea
  • Object
show all
Defined in:
lib/matestack/ui/bootstrap/form/textarea.rb

Instance Method Summary collapse

Instance Method Details

#bootstrap_textarea_attributesObject



20
21
22
23
24
25
26
27
# File 'lib/matestack/ui/bootstrap/form/textarea.rb', line 20

def bootstrap_textarea_attributes
  {
    class: (options[:class] || "") << (" form-control"),
    rows: context.rows,
    cols: context.cols,
    disabled: context.disabled
  }
end

#input_error_classObject



37
38
39
# File 'lib/matestack/ui/bootstrap/form/textarea.rb', line 37

def input_error_class
  'is-invalid'
end

#render_errorsObject



29
30
31
32
33
34
35
# File 'lib/matestack/ui/bootstrap/form/textarea.rb', line 29

def render_errors
  if display_errors?
    div class: 'invalid-feedback', 'v-for': "error in #{error_key}" do
      plain '{{ error }}'
    end
  end
end

#render_form_textObject



41
42
43
44
45
# File 'lib/matestack/ui/bootstrap/form/textarea.rb', line 41

def render_form_text
  div class: "form-text form-text-for-#{attribute_key}" do
    plain context.form_text
  end
end

#responseObject



11
12
13
14
15
16
17
18
# File 'lib/matestack/ui/bootstrap/form/textarea.rb', line 11

def response
  div class: "matestack-ui-bootstrap-textarea" do
    label input_label, ":for": id,  class: "form-label" if input_label
    textarea options.merge(textarea_attributes).merge(bootstrap_textarea_attributes)
    render_errors
    render_form_text if context.form_text
  end
end