populate-me 0.0.7 → 0.0.8

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.
@@ -34,13 +34,10 @@ module PopulateMe
34
34
  end,
35
35
  :boolean => proc do |m,c,o|
36
36
  crushid = m.field_id_for(c)
37
- s = ['checked', nil]
38
- s.reverse! unless o[:input_value]
39
- out = "<span class='%s'>"
40
- out += "<input type='radio' name='%s' value='true' id='%s' %s /> <label for='%s'>Yes</label> "
41
- out += "<input type='radio' name='%s' value='false' id='%s-no' %s /> <label for='%s-no'>No</label>"
42
- out += "</span>\n"
43
- out % [o[:input_class], o[:input_name], crushid, s[0], crushid, o[:input_name], crushid, s[1], crushid]
37
+ checked = 'checked' if o[:input_value]
38
+ out = "<input type='hidden' name='%s' value='false' id='%s-off' />\n"
39
+ out += "<input type='checkbox' name='%s' value='true' id='%s' class='%s' %s />\n"
40
+ out % [o[:input_name], crushid, o[:input_name], crushid, o[:input_class], checked]
44
41
  end,
45
42
  :text => proc do |m,c,o|
46
43
  "<textarea name='%s' id='%s' class='%s' %s>%s</textarea>%s\n" % [o[:input_name], m.field_id_for(c), o[:input_class], o[:required]&&'required', o[:input_value], o[:required]]
@@ -196,6 +193,7 @@ module PopulateMe
196
193
  # crushyfield is crushyinput but with label+error
197
194
  def crushyfield(col, o={})
198
195
  return '' if (o[:type]==:none || model.schema[col][:type]==:none)
196
+ return crushyinput(col,o) if (o[:input_type]=='hidden' || model.schema[col][:input_type]=='hidden')
199
197
  default_field_name = col[/^id_/] ? Kernel.const_get(col.sub(/^id_/, '')).human_name : col.tr('_', ' ').capitalize
200
198
  field_name = o[:name] || model.schema[col][:name] || default_field_name
201
199
  error_list = errors_on(col).map{|e|" - #{e}"} if !errors_on(col).nil?
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'populate-me'
3
- s.version = "0.0.7"
3
+ s.version = "0.0.8"
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.7
4
+ version: 0.0.8
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: 2013-02-10 00:00:00.000000000 Z
12
+ date: 2013-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack-golem