red_cap 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/red_cap/form/fields.rb +21 -9
- data/lib/red_cap/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa2bdc0735b838f2fd8f193c93c60b7e3cc365f5
|
4
|
+
data.tar.gz: 3b0e83dcace8e17baf0d367fe4ad8fdbf32ccece
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c75397662f37a89705320130c0c4c6ce93226412d29afaaa05915c8fcd52a0a9e444a2cceadf5c3f4610aad53b156c90a0e85ee2515163b451915a59e22647c
|
7
|
+
data.tar.gz: 0ddac355f3b6757a9ed17df062a31fba45b575d1d12207da616623d58eee4c6345ecc6efe46f05f60caba29c72c952c1a13b019e6fd72d3aaa98a939fd145e16
|
data/lib/red_cap/form/fields.rb
CHANGED
@@ -51,7 +51,11 @@ module REDCap
|
|
51
51
|
end
|
52
52
|
|
53
53
|
class Text < Field; end
|
54
|
-
class Notes <
|
54
|
+
class Notes < Text
|
55
|
+
def text?
|
56
|
+
true
|
57
|
+
end
|
58
|
+
end
|
55
59
|
class Descriptive < Field; end
|
56
60
|
class Dropdown < Field; end
|
57
61
|
class Sql < Field; end
|
@@ -109,16 +113,20 @@ module REDCap
|
|
109
113
|
class CheckboxesWithOther < Checkboxes
|
110
114
|
def value
|
111
115
|
selected_options.map do |key, value|
|
112
|
-
if key
|
113
|
-
"#{value}: #{other_text_field
|
116
|
+
if other?(key)
|
117
|
+
"#{value}: #{other_text_field(key).value}"
|
114
118
|
else
|
115
119
|
value
|
116
120
|
end
|
117
121
|
end
|
118
122
|
end
|
119
123
|
|
120
|
-
def other_text_field
|
121
|
-
associated_fields_for_key(
|
124
|
+
def other_text_field key
|
125
|
+
associated_fields_for_key(key).find(&:text?)
|
126
|
+
end
|
127
|
+
|
128
|
+
def other? key
|
129
|
+
other_text_field(key)
|
122
130
|
end
|
123
131
|
end
|
124
132
|
|
@@ -127,11 +135,15 @@ module REDCap
|
|
127
135
|
|
128
136
|
class CheckboxesWithRadioButtonsOrOther < CheckboxesWithOther
|
129
137
|
def value
|
130
|
-
|
131
|
-
|
138
|
+
radio_or_other_values = selected_options.keys.map do |key|
|
139
|
+
if other?(key)
|
140
|
+
other_text_field(key)&.value
|
141
|
+
else
|
142
|
+
radio_field_for(key)&.value
|
143
|
+
end
|
132
144
|
end
|
133
145
|
|
134
|
-
Hash[
|
146
|
+
Hash[selected_options.values.zip(radio_or_other_values)]
|
135
147
|
end
|
136
148
|
|
137
149
|
private
|
@@ -150,7 +162,7 @@ module REDCap
|
|
150
162
|
end
|
151
163
|
|
152
164
|
if selected_options.keys.include?("501")
|
153
|
-
right[-1] = [other_text_field&.value]
|
165
|
+
right[-1] = [other_text_field("501")&.value]
|
154
166
|
end
|
155
167
|
|
156
168
|
Hash[left.zip(right)]
|
data/lib/red_cap/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: red_cap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micah Geisel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|