From d88697ab320112ec2ae6a7aaa946d5588432fa06 Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Mon, 12 Jan 2015 22:18:30 -0600 Subject: [PATCH] MultiValueInput#collection is responsible for what to draw. MultiValueInput#input is responsible for how to draw it. --- app/inputs/multi_value_input.rb | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/app/inputs/multi_value_input.rb b/app/inputs/multi_value_input.rb index cb6ca80..54a0dd9 100644 --- a/app/inputs/multi_value_input.rb +++ b/app/inputs/multi_value_input.rb @@ -10,20 +10,14 @@ def input(wrapper_options) HTML collection.each do |value| - unless value.to_s.strip.blank? - markup << <<-HTML -
  • - #{build_text_field(value)} -
  • - HTML - end + markup << <<-HTML +
  • + #{build_text_field(value)} +
  • + HTML end - # One blank line at the end markup << <<-HTML -
  • - #{build_text_field('')} -
  • HTML @@ -61,7 +55,7 @@ def input_dom_id end def collection - @collection ||= Array.wrap(object[attribute_name]) + @collection ||= Array.wrap(object[attribute_name]).reject { |value| value.to_s.strip.blank? } + [''] end def multiple?; true; end