gfrom 0.1.5 → 0.1.6

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.
Files changed (4) hide show
  1. data/gfrom.gemspec +1 -1
  2. data/lib/gfrom.rb +7 -6
  3. data/readme.md +1 -1
  4. metadata +1 -1
data/gfrom.gemspec CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  Gem::Specification.new do |spec|
6
6
  spec.platform = Gem::Platform::RUBY
7
7
  spec.name = "gfrom"
8
- spec.version = "0.1.5"
8
+ spec.version = "0.1.6"
9
9
  spec.authors = ["Marvin Marcelo"]
10
10
  spec.email = ["mrclmrvn@gmail.com"]
11
11
  spec.description = %q{Render unathenticated Google Form in your website. Useful for collecting data from your users without a database. Just create a google form from your google account. If you are using Google Apps, please read form options}
data/lib/gfrom.rb CHANGED
@@ -62,12 +62,7 @@ class Gfrom
62
62
  object = Hash.new
63
63
  object[:element] = node.name
64
64
  node.attributes.each do |k,v|
65
- if (k == "name" and v.value == "checkbox" and node.search("//input[@name=\"#{v.value}\"]").length > 1)
66
- # checkbox needs name to be array'ed
67
- object[k.to_sym] = "#{v.value}[]"
68
- else
69
- object[k.to_sym] = v.value
70
- end
65
+ object[k.to_sym] = v.value
71
66
  if k == "id"
72
67
  label = node.search("//label[@for=\"#{v.value}\"]").first
73
68
  if label
@@ -79,6 +74,12 @@ class Gfrom
79
74
  object[:label] = node.attributes["value"].value
80
75
  end
81
76
  end
77
+ # override when element has all the attributes
78
+ if (object[:type] == "checkbox" and node.search("//input[@name=\"#{object[:name]}\"]").length > 1)
79
+ # checkbox needs name to be array'ed
80
+ object[:name] = "#{object[:name]}[]"
81
+ end
82
+
82
83
  object
83
84
  end
84
85
 
data/readme.md CHANGED
@@ -41,7 +41,7 @@ result = @myform.submit(params)
41
41
  ## TODO
42
42
 
43
43
  * Support for Authenticated forms (requires login to organization/google apps)
44
- * <del>Ensure radio buttons and checkboxes are grouped (not sure if this works in current version - 0.1.2)</del>
44
+ * ~~Ensure radio buttons and checkboxes are grouped (not sure if this works in current version - 0.1.2)~~
45
45
  * Label for grouped form tags - checkbox and radio
46
46
  * Supply an RDOC
47
47
  * Tests
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gfrom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: