Class: Interview::NestedFormAddLink

Inherits:
Control
  • Object
show all
Defined in:
lib/interview/controls/nested_form_add_link.rb

Instance Attribute Summary

Attributes inherited from Control

#parent

Instance Method Summary collapse

Methods inherited from Control

#ancestors, #build_child, #build_with_params, #find_attribute, #find_attribute!, #initialize, #set_attributes, #set_defaults

Constructor Details

This class inherits a constructor from Interview::Control

Instance Method Details

#build(b) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/interview/controls/nested_form_add_link.rb', line 4

def build(b)
  form_builder = find_attribute! :form_builder
  assoc_method = find_attribute!(:assoc_method).to_sym
  text = h.t('views.nested_form_add', association: find_attribute!(:singular_title))
  html = render_form(b, form_builder, assoc_method)
  b.link capion: text, html_options: { href: '#', class: 'nested_form_add_link', data: { content: CGI::escapeHTML(html) } }
end