populate-me 0.0.25 → 0.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -79,7 +79,14 @@ module PopulateMe
79
79
  "%s%s<input type='file' name='%s' id='%s' class='%s' />%s\n" % [m.to_thumb(c), deleter, o[:input_name], m.field_id_for(c), o[:input_class], o[:required]]
80
80
  end,
81
81
  :select => proc do |m,c,o|
82
- out = "<select name='%s%s' id='%s' class='%s' %s title='-- Select --'>\n" % [o[:input_name], ('[]' if o[:multiple]), m.field_id_for(c), o[:input_class], ('multiple' if o[:multiple])]
82
+ # starter ensures it sends something when multiple is empty
83
+ # Otherwise it is not sent and therefore not updated
84
+ starter = if o[:multiple]
85
+ "<input type='hidden' name='%s[]' value='nil' class='multiple-select-starter' />\n" % [o[:input_name]]
86
+ else
87
+ ''
88
+ end
89
+ out = "%s<select name='%s%s' id='%s' class='%s' %s title='-- Select --'>\n" % [starter, o[:input_name], ('[]' if o[:multiple]), m.field_id_for(c), o[:input_class], ('multiple' if o[:multiple])]
83
90
  o[:select_options] = m.__send__(o[:select_options]) unless o[:select_options].kind_of?(Array)
84
91
  select_options = o[:select_options].dup
85
92
  if (o[:multiple] && !o[:input_value].nil? && o[:input_value].size>1)
@@ -242,6 +242,14 @@ module PopulateMe
242
242
  end
243
243
  end
244
244
  end
245
+ def fix_type_select(k,v)
246
+ if v.is_a?(Array)
247
+ @doc[k] = v - ['nil']
248
+ end
249
+ end
250
+ def fix_type_children(k,v)
251
+ self.fix_type_select(k,v)
252
+ end
245
253
 
246
254
  def save
247
255
  return nil unless valid?
data/populate-me.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'populate-me'
3
- s.version = "0.0.25"
3
+ s.version = "0.0.26"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.summary = "ALPHA !!! Populate Me is relatively complete but simple CMS"
6
6
  s.description = "ALPHA !!! Populate Me is relatively complete but simple CMS. It includes a Rack middleware for putting in your Rack stack, and a bespoke MongoDB ODM. But Populate Me is not really finished yet."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: populate-me
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.25
4
+ version: 0.0.26
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-04-04 00:00:00.000000000 Z
12
+ date: 2016-04-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack-golem