Module: Formidable::Renderers::LabeledElementMixin

Included in:
LabeledInputRenderer, LabeledTagRenderer
Defined in:
lib/formidable/renderers/string.rb

Overview

Point of this mixin is that we want to have two classes with the same functionality, but different superclass (so super call will render input or tag, depending on what we want).

Instance Method Summary collapse

Instance Method Details

#renderObject



58
59
60
61
62
# File 'lib/formidable/renderers/string.rb', line 58

def render
  id = element.attributes[:id] || (element.attributes[:id] = "random-#{element.object_id}")
  buffer = tag(:label, for: id) { element.attributes[:label] || element.attributes[:title] || element.attributes[:placeholder] } + "\n"
  buffer + super
end