Class: Interview::NestedFormRemoveLink

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

Instance Attribute Summary collapse

Attributes inherited from Control

#parent

Instance Method Summary collapse

Methods inherited from Control

#ancestors, build, definition, #find_attribute, #find_attribute!, inherited, #initialize, #set_attributes, #set_defaults

Constructor Details

This class inherits a constructor from Interview::Control

Instance Attribute Details

#styleObject

Returns the value of attribute style.



4
5
6
# File 'lib/interview/nested_form_remove_link.rb', line 4

def style
  @style
end

Instance Method Details

#renderObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/interview/nested_form_remove_link.rb', line 6

def render
  if @style and @style.to_sym == :horizontal_form
    html = Builder::XmlMarkup.new
    html.div class: 'row' do
      html.div class: 'col-xs-9 col-xs-offset-3' do
        html << render_link
      end
    end
    return html.target!
  else
    return render_link
  end
end


20
21
22
23
24
25
# File 'lib/interview/nested_form_remove_link.rb', line 20

def render_link
  assoc_object = find_attribute! :assoc_object
  assoc_method = find_attribute!(:assoc_method).to_s
  text = h.t('views.nested_form_remove', association: assoc_object.class.human_attribute_name(assoc_method.singularize)) # todo: in view auslagern
  return h. :a, text, href: '#', class: 'nested_form_remove_link'
end