tofulcrum 0.0.9 → 0.0.10
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.
- checksums.yaml +4 -4
- data/lib/tofulcrum/fulcrum-xls-form/xls_reader.rb +7 -2
- data/lib/tofulcrum/version.rb +1 -1
- data/lib/tofulcrum.rb +10 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cdccba628f7783f1ded38335699b0a770e1bba2
|
4
|
+
data.tar.gz: f060e5eee7c99b3dd3a4c3a2047336f9699e2c5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a533b713128d20206f4ac0c21ed85459960b8ef3bb73a3c53a8134f84e7d46b3acbc3098fb0354bd22770d27ee3b1fad1d300ba20a60747c9eba542cd8745c30
|
7
|
+
data.tar.gz: adf26f956fbc31d4b5863d58d1ee2dcc038957a74e8c1259da52630528265ccadabca19e3cbd847eab3fcde588fbe92d32b5a7bdb4142baffe7ec3d0a0b3eedd
|
@@ -11,7 +11,8 @@ module Fulcrum
|
|
11
11
|
'date',
|
12
12
|
'address',
|
13
13
|
'signature',
|
14
|
-
'photos'
|
14
|
+
'photos',
|
15
|
+
'label'
|
15
16
|
]
|
16
17
|
|
17
18
|
def self.read(file)
|
@@ -93,9 +94,12 @@ module Fulcrum
|
|
93
94
|
hash[:elements] = [] if %w(Section Repeatable).include?(hash[:type])
|
94
95
|
hash[:key] = SecureRandom.hex(2)
|
95
96
|
|
96
|
-
|
97
|
+
case hash[:type]
|
98
|
+
when 'ChoiceField'
|
97
99
|
hash[:choices] = @choices[row['choices']] if hash[:type] == 'ChoiceField'
|
98
100
|
hash[:allow_other] = boolean_value(row[:allow_other])
|
101
|
+
when 'AddressField'
|
102
|
+
hash[:auto_populate] = boolean_value(row[:auto_populate], true)
|
99
103
|
end
|
100
104
|
end
|
101
105
|
end
|
@@ -121,6 +125,7 @@ module Fulcrum
|
|
121
125
|
when 'address' then 'AddressField'
|
122
126
|
when 'signature' then 'SignatureField'
|
123
127
|
when 'photos' then 'PhotoField'
|
128
|
+
when 'label' then 'Label'
|
124
129
|
else nil
|
125
130
|
end
|
126
131
|
end
|
data/lib/tofulcrum/version.rb
CHANGED
data/lib/tofulcrum.rb
CHANGED
@@ -55,6 +55,16 @@ module Tofulcrum
|
|
55
55
|
case map[:field]['type']
|
56
56
|
when 'ChoiceField'
|
57
57
|
value = { choice_values: row[map[:index]].split(',').map(&:strip) } rescue nil
|
58
|
+
when 'PhotoField'
|
59
|
+
value = []
|
60
|
+
row[map[:index]].split(',').map(&:strip).each do |photo|
|
61
|
+
if File.exist?(photo)
|
62
|
+
key = SecureRandom.uuid
|
63
|
+
file = File.open(photo)
|
64
|
+
Fulcrum::Photo.create(file, "image/jpeg", key, "")
|
65
|
+
value << { "photo_id" => key }
|
66
|
+
end
|
67
|
+
end
|
58
68
|
else
|
59
69
|
value = row[map[:index]]
|
60
70
|
end
|