Class: NdrUi::Bootstrap::InlineErrorsAndWarnings::HelpBlock

Inherits:
ActionView::Helpers::Tags::Base
  • Object
show all
Defined in:
app/builders/ndr_ui/bootstrap/inline_errors_and_warnings.rb

Overview

Tag::Base subclass for generating bootstrap span.help-block. Allows us to use generate the tag_id properly.

Instance Method Summary collapse

Instance Method Details

#render(&block) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'app/builders/ndr_ui/bootstrap/inline_errors_and_warnings.rb', line 8

def render(&block)
  feedback_for =
    if respond_to?(:name_and_id_index, true)
      tag_id(name_and_id_index(@options))
    else
      add_default_name_and_id(@options.fetch('html', {}))
    end

  options = { class: 'help-block', data:  { feedback_for: feedback_for } }
  (:span, @template_object.capture(&block), options)
end