Module: Druid::PagePopulator
- Included in:
- Druid
- Defined in:
- lib/druid/page_populator.rb
Instance Method Summary collapse
-
#populate_page_with(data) ⇒ Object
This method will populate all matched page TextFields, TextAreas, SelectLists, FileFields, Checkboxes, and Radio Buttons from the Hash passed as an argument.
Instance Method Details
#populate_page_with(data) ⇒ Object
This method will populate all matched page TextFields, TextAreas, SelectLists, FileFields, Checkboxes, and Radio Buttons from the Hash passed as an argument. The way it find an element is by matching the Hash key to the name you provided when declaring the element on your page.
Checkbox and Radio Button values must be true or false.
can be either a string or a symbol. The value must be a string for TextField, TextArea, SelectList and FileField must be true or false for a Checkbox or RadioButton.
31 32 33 34 35 36 37 38 39 |
# File 'lib/druid/page_populator.rb', line 31 def populate_page_with(data) data.each do |key, value| populate_checkbox(key, value) if is_checkbox?(key) and is_enabled?(key) (key, value) if (key) (key, value) if (key) and is_enabled?(key) populate_select_list(key, value) if is_select_list?(key) populate_text(key, value) if is_text?(key) and is_enabled?(key) end end |