Class: Interview::List
- Includes:
- HasControls
- Defined in:
- lib/interview/list.rb
Instance Attribute Summary collapse
-
#empty_message ⇒ Object
Returns the value of attribute empty_message.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#objects ⇒ Object
Returns the value of attribute objects.
Attributes included from HasControls
Attributes inherited from Control
Instance Method Summary collapse
Methods included from HasControls
#add_control, #add_controls, included, #initialize, #siblings
Methods inherited from Control
#ancestors, build, definition, #find_attribute, #find_attribute!, inherited, #initialize, #set_attributes, #set_defaults
Instance Attribute Details
#empty_message ⇒ Object
Returns the value of attribute empty_message.
5 6 7 |
# File 'lib/interview/list.rb', line 5 def @empty_message end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
6 7 8 |
# File 'lib/interview/list.rb', line 6 def object @object end |
#objects ⇒ Object
Returns the value of attribute objects.
5 6 7 |
# File 'lib/interview/list.rb', line 5 def objects @objects end |
Instance Method Details
#render ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/interview/list.rb', line 8 def render objects = @objects || find_attribute!(:objects) puts "objects: #{objects.size}" html = Builder::XmlMarkup.new objects.each do |object| @object = object @controls.each do |control| # todo: controls neu initialisieren? html << control.render end end if objects.empty? and @empty_message != :hide object = find_attribute!(:object) = @empty_message || "Keine #{object.class.human_name(count: 2)} vorhanden." html.p , class: 'text-center text-muted' end return html.target! end |