upgrade_surveyor 1.4.2

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 (203) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +30 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +18 -0
  5. data/CHANGELOG.md +253 -0
  6. data/Gemfile +5 -0
  7. data/Gemfile.rails_version +25 -0
  8. data/MIT-LICENSE +20 -0
  9. data/README.md +164 -0
  10. data/Rakefile +65 -0
  11. data/app/controllers/surveyor_controller.rb +5 -0
  12. data/app/helpers/results_helper.rb +20 -0
  13. data/app/helpers/survey_form_builder.rb +37 -0
  14. data/app/helpers/surveyor_helper.rb +3 -0
  15. data/app/inputs/quiet_input.rb +5 -0
  16. data/app/inputs/surveyor_check_boxes_input.rb +35 -0
  17. data/app/inputs/surveyor_radio_input.rb +18 -0
  18. data/app/models/answer.rb +3 -0
  19. data/app/models/dependency.rb +3 -0
  20. data/app/models/dependency_condition.rb +3 -0
  21. data/app/models/permitted_params.rb +102 -0
  22. data/app/models/question.rb +3 -0
  23. data/app/models/question_group.rb +3 -0
  24. data/app/models/response.rb +4 -0
  25. data/app/models/response_set.rb +3 -0
  26. data/app/models/survey.rb +3 -0
  27. data/app/models/survey_section.rb +4 -0
  28. data/app/models/survey_translation.rb +4 -0
  29. data/app/models/validation.rb +3 -0
  30. data/app/models/validation_condition.rb +3 -0
  31. data/app/views/layouts/results.html.erb +13 -0
  32. data/app/views/layouts/surveyor_default.html.erb +12 -0
  33. data/app/views/partials/_answer.html.haml +25 -0
  34. data/app/views/partials/_dependents.html.haml +5 -0
  35. data/app/views/partials/_question.html.haml +28 -0
  36. data/app/views/partials/_question_group.html.haml +44 -0
  37. data/app/views/partials/_section.html.haml +12 -0
  38. data/app/views/partials/_section_menu.html.haml +12 -0
  39. data/app/views/surveyor/edit.html.haml +21 -0
  40. data/app/views/surveyor/export.json.rabl +85 -0
  41. data/app/views/surveyor/new.html.haml +24 -0
  42. data/app/views/surveyor/show.html.haml +74 -0
  43. data/app/views/surveyor/show.json.rabl +15 -0
  44. data/config/routes.rb +8 -0
  45. data/doc/REPRESENTATIONS.md +34 -0
  46. data/doc/api_id_schema.json +7 -0
  47. data/doc/question types.png +0 -0
  48. data/doc/response_set_schema.json +54 -0
  49. data/doc/surveyor question combinations.png +0 -0
  50. data/doc/surveyor reject or delete decision matrix.png +0 -0
  51. data/doc/surveyor_models.png +0 -0
  52. data/doc/surveyor_models2.png +0 -0
  53. data/doc/surveyor_timestamp_schema.json +9 -0
  54. data/lib/assets/images/surveyor/next.gif +0 -0
  55. data/lib/assets/images/surveyor/prev.gif +0 -0
  56. data/lib/assets/images/surveyor/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  57. data/lib/assets/images/surveyor/ui-bg_flat_75_ffffff_40x100.png +0 -0
  58. data/lib/assets/images/surveyor/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  59. data/lib/assets/images/surveyor/ui-bg_glass_65_ffffff_1x400.png +0 -0
  60. data/lib/assets/images/surveyor/ui-bg_glass_75_dadada_1x400.png +0 -0
  61. data/lib/assets/images/surveyor/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  62. data/lib/assets/images/surveyor/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  63. data/lib/assets/images/surveyor/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  64. data/lib/assets/images/surveyor/ui-icons_222222_256x240.png +0 -0
  65. data/lib/assets/images/surveyor/ui-icons_2e83ff_256x240.png +0 -0
  66. data/lib/assets/images/surveyor/ui-icons_454545_256x240.png +0 -0
  67. data/lib/assets/images/surveyor/ui-icons_888888_256x240.png +0 -0
  68. data/lib/assets/images/surveyor/ui-icons_cd0a0a_256x240.png +0 -0
  69. data/lib/assets/javascripts/surveyor/jquery-1.9.0.js +9555 -0
  70. data/lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js +14850 -0
  71. data/lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js +1919 -0
  72. data/lib/assets/javascripts/surveyor/jquery.maskedinput.js +338 -0
  73. data/lib/assets/javascripts/surveyor/jquery.selectToUISlider.js +240 -0
  74. data/lib/assets/javascripts/surveyor/jquery.surveyor.js +154 -0
  75. data/lib/assets/stylesheets/surveyor/jquery-ui-1.10.0.custom.sass +1380 -0
  76. data/lib/assets/stylesheets/surveyor/jquery-ui-timepicker-addon.css +11 -0
  77. data/lib/assets/stylesheets/surveyor/reset.css +48 -0
  78. data/lib/assets/stylesheets/surveyor/results.css +125 -0
  79. data/lib/assets/stylesheets/surveyor/ui.slider.extras.css +110 -0
  80. data/lib/assets/stylesheets/surveyor.sass +132 -0
  81. data/lib/generators/surveyor/custom_generator.rb +18 -0
  82. data/lib/generators/surveyor/install_generator.rb +98 -0
  83. data/lib/generators/surveyor/templates/app/assets/javascripts/surveyor_all.js +6 -0
  84. data/lib/generators/surveyor/templates/app/assets/stylesheets/surveyor_all.css +9 -0
  85. data/lib/generators/surveyor/templates/app/controllers/surveyor_controller.rb +40 -0
  86. data/lib/generators/surveyor/templates/app/views/layouts/surveyor_custom.html.erb +13 -0
  87. data/lib/generators/surveyor/templates/config/locales/surveyor_en.yml +19 -0
  88. data/lib/generators/surveyor/templates/config/locales/surveyor_es.yml +19 -0
  89. data/lib/generators/surveyor/templates/config/locales/surveyor_he.yml +19 -0
  90. data/lib/generators/surveyor/templates/config/locales/surveyor_ko.yml +19 -0
  91. data/lib/generators/surveyor/templates/db/migrate/add_api_id_to_question_groups.rb +10 -0
  92. data/lib/generators/surveyor/templates/db/migrate/add_api_ids.rb +14 -0
  93. data/lib/generators/surveyor/templates/db/migrate/add_api_ids_to_response_sets_and_responses.rb +12 -0
  94. data/lib/generators/surveyor/templates/db/migrate/add_correct_answer_id_to_questions.rb +10 -0
  95. data/lib/generators/surveyor/templates/db/migrate/add_default_value_to_answers.rb +10 -0
  96. data/lib/generators/surveyor/templates/db/migrate/add_display_order_to_surveys.rb +10 -0
  97. data/lib/generators/surveyor/templates/db/migrate/add_display_type_to_answers.rb +14 -0
  98. data/lib/generators/surveyor/templates/db/migrate/add_index_to_response_sets.rb +10 -0
  99. data/lib/generators/surveyor/templates/db/migrate/add_index_to_surveys.rb +10 -0
  100. data/lib/generators/surveyor/templates/db/migrate/add_input_mask_attributes_to_answer.rb +12 -0
  101. data/lib/generators/surveyor/templates/db/migrate/add_section_id_to_responses.rb +12 -0
  102. data/lib/generators/surveyor/templates/db/migrate/add_unique_index_on_access_code_and_version_in_surveys.rb +10 -0
  103. data/lib/generators/surveyor/templates/db/migrate/add_unique_indicies.rb +18 -0
  104. data/lib/generators/surveyor/templates/db/migrate/add_version_to_surveys.rb +10 -0
  105. data/lib/generators/surveyor/templates/db/migrate/api_ids_must_be_unique.rb +23 -0
  106. data/lib/generators/surveyor/templates/db/migrate/create_answers.rb +38 -0
  107. data/lib/generators/surveyor/templates/db/migrate/create_dependencies.rb +23 -0
  108. data/lib/generators/surveyor/templates/db/migrate/create_dependency_conditions.rb +30 -0
  109. data/lib/generators/surveyor/templates/db/migrate/create_question_groups.rb +28 -0
  110. data/lib/generators/surveyor/templates/db/migrate/create_questions.rb +37 -0
  111. data/lib/generators/surveyor/templates/db/migrate/create_response_sets.rb +23 -0
  112. data/lib/generators/surveyor/templates/db/migrate/create_responses.rb +34 -0
  113. data/lib/generators/surveyor/templates/db/migrate/create_survey_sections.rb +30 -0
  114. data/lib/generators/surveyor/templates/db/migrate/create_survey_translations.rb +19 -0
  115. data/lib/generators/surveyor/templates/db/migrate/create_surveys.rb +32 -0
  116. data/lib/generators/surveyor/templates/db/migrate/create_validation_conditions.rb +33 -0
  117. data/lib/generators/surveyor/templates/db/migrate/create_validations.rb +21 -0
  118. data/lib/generators/surveyor/templates/db/migrate/drop_unique_index_on_access_code_in_surveys.rb +10 -0
  119. data/lib/generators/surveyor/templates/db/migrate/update_blank_api_ids_on_question_group.rb +22 -0
  120. data/lib/generators/surveyor/templates/db/migrate/update_blank_versions_on_surveys.rb +13 -0
  121. data/lib/generators/surveyor/templates/surveys/EXTENDING_SURVEYOR.md +52 -0
  122. data/lib/generators/surveyor/templates/surveys/MODIFYING_SURVEYOR.md +91 -0
  123. data/lib/generators/surveyor/templates/surveys/date_survey.rb +16 -0
  124. data/lib/generators/surveyor/templates/surveys/kitchen_sink_survey.rb +280 -0
  125. data/lib/generators/surveyor/templates/surveys/languages.rb +14 -0
  126. data/lib/generators/surveyor/templates/surveys/quiz.rb +11 -0
  127. data/lib/generators/surveyor/templates/surveys/translations/languages.es.yml +18 -0
  128. data/lib/generators/surveyor/templates/surveys/translations/languages.he.yml +18 -0
  129. data/lib/generators/surveyor/templates/surveys/translations/languages.ko.yml +18 -0
  130. data/lib/generators/surveyor/templates/vendor/assets/stylesheets/custom.sass +5 -0
  131. data/lib/surveyor/acts_as_response.rb +19 -0
  132. data/lib/surveyor/common.rb +59 -0
  133. data/lib/surveyor/engine.rb +15 -0
  134. data/lib/surveyor/helpers/formtastic_custom_input.rb +13 -0
  135. data/lib/surveyor/helpers/surveyor_helper_methods.rb +86 -0
  136. data/lib/surveyor/models/answer_methods.rb +76 -0
  137. data/lib/surveyor/models/dependency_condition_methods.rb +65 -0
  138. data/lib/surveyor/models/dependency_methods.rb +57 -0
  139. data/lib/surveyor/models/question_group_methods.rb +62 -0
  140. data/lib/surveyor/models/question_methods.rb +103 -0
  141. data/lib/surveyor/models/response_methods.rb +125 -0
  142. data/lib/surveyor/models/response_set_methods.rb +187 -0
  143. data/lib/surveyor/models/survey_methods.rb +95 -0
  144. data/lib/surveyor/models/survey_section_methods.rb +48 -0
  145. data/lib/surveyor/models/survey_translation_methods.rb +28 -0
  146. data/lib/surveyor/models/validation_condition_methods.rb +42 -0
  147. data/lib/surveyor/models/validation_methods.rb +41 -0
  148. data/lib/surveyor/mustache_context.rb +13 -0
  149. data/lib/surveyor/parser.rb +427 -0
  150. data/lib/surveyor/redcap_parser.rb +288 -0
  151. data/lib/surveyor/surveyor_controller_methods.rb +237 -0
  152. data/lib/surveyor/unparser.rb +161 -0
  153. data/lib/surveyor/version.rb +3 -0
  154. data/lib/surveyor.rb +13 -0
  155. data/lib/tasks/surveyor_tasks.rake +88 -0
  156. data/rails/init.rb +1 -0
  157. data/spec/controllers/surveyor_controller_spec.rb +304 -0
  158. data/spec/factories.rb +166 -0
  159. data/spec/features/ajax_spec.rb +205 -0
  160. data/spec/features/api_spec.rb +157 -0
  161. data/spec/features/duplicate_prevention_spec.rb +50 -0
  162. data/spec/features/translations_spec.rb +116 -0
  163. data/spec/features/ui_spec.rb +466 -0
  164. data/spec/fixtures/REDCapDemoDatabase_DataDictionary.csv +127 -0
  165. data/spec/fixtures/chinese_survey.rb +14 -0
  166. data/spec/fixtures/everything.rb +215 -0
  167. data/spec/fixtures/favorites-ish.rb +22 -0
  168. data/spec/fixtures/favorites.rb +22 -0
  169. data/spec/fixtures/feelings.rb +38 -0
  170. data/spec/fixtures/lifestyle.rb +55 -0
  171. data/spec/fixtures/numbers.rb +21 -0
  172. data/spec/fixtures/redcap_new_headers.csv +1 -0
  173. data/spec/fixtures/redcap_siblings.csv +1 -0
  174. data/spec/fixtures/redcap_whitespace.csv +1 -0
  175. data/spec/helpers/formtastic_custom_input_spec.rb +15 -0
  176. data/spec/helpers/surveyor_helper_spec.rb +114 -0
  177. data/spec/lib/common_spec.rb +37 -0
  178. data/spec/lib/parser_spec.rb +393 -0
  179. data/spec/lib/rake_kitchen_sink.rb +40 -0
  180. data/spec/lib/redcap_parser_spec.rb +129 -0
  181. data/spec/lib/tasks_spec.rake +26 -0
  182. data/spec/lib/unparser_spec.rb +126 -0
  183. data/spec/models/answer_spec.rb +144 -0
  184. data/spec/models/dependency_condition_spec.rb +428 -0
  185. data/spec/models/dependency_spec.rb +90 -0
  186. data/spec/models/question_group_spec.rb +66 -0
  187. data/spec/models/question_spec.rb +176 -0
  188. data/spec/models/response_set_spec.rb +447 -0
  189. data/spec/models/response_spec.rb +205 -0
  190. data/spec/models/survey_section_spec.rb +58 -0
  191. data/spec/models/survey_spec.rb +155 -0
  192. data/spec/models/validation_condition_spec.rb +98 -0
  193. data/spec/models/validation_spec.rb +64 -0
  194. data/spec/rcov.opts +2 -0
  195. data/spec/spec.opts +4 -0
  196. data/spec/spec_helper.rb +99 -0
  197. data/spec/support/shared.rb +5 -0
  198. data/spec/support/surveyor_api_helpers.rb +15 -0
  199. data/spec/support/surveyor_ui_helpers.rb +108 -0
  200. data/spec/support/wait_for_ajax.rb +11 -0
  201. data/surveyor.gemspec +40 -0
  202. data/switch.sh +53 -0
  203. metadata +510 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 16c2ad060be3244c3ab2b659ae8ada4e956f52faf4c6e26458aacaed0d8aa91f
4
+ data.tar.gz: f7f40245aba558d5fc737267dfb14f92e9a6e4016a3d7702bdff39caafa9acb8
5
+ SHA512:
6
+ metadata.gz: 3a30c29e3d73d9e551f6f5144185629b8ce85c5e2b50d313311440d0719a3088de0e270b8c95bfdfda01666571b2524b3aa8407881f54a313763de552b11d6b5
7
+ data.tar.gz: '090337fdd9d63bfd09e26961ecd23941e889d9209bc204fc084618e89065e5896becdeb80ea4b4fb59c66302a5a70d44b1f32ae7d372d17d58906ddecea00655'
data/.gitignore ADDED
@@ -0,0 +1,30 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+ Gemfile.lock
21
+ reports
22
+ chromedriver.log
23
+ .ruby-version
24
+ .ruby-gemset
25
+
26
+ ## PROJECT::SPECIFIC
27
+ testbed
28
+ surveys/fixtures/*.yml
29
+ .rvmrc
30
+ .sass-cache/**/*.sassc
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color -fn
data/.travis.yml ADDED
@@ -0,0 +1,18 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 2.1.1
5
+ env:
6
+ - "RAILS_VERSION=3.2.0"
7
+ - "RAILS_VERSION=4.0.0"
8
+ script:
9
+ - bundle exec rake testbed
10
+ - bundle exec rake spec
11
+ notifications:
12
+ email:
13
+ recipients:
14
+ - yoon@northwestern.edu
15
+ - j-dzak@northwestern.edu
16
+ - frank.lockom@northwestern.edu
17
+ on_success: change # [always|never|change] # default: change
18
+ on_failure: always # [always|never|change] # default: always
data/CHANGELOG.md ADDED
@@ -0,0 +1,253 @@
1
+ History for Surveyor
2
+ ====================
3
+
4
+ 1.5.0
5
+ -----
6
+
7
+ ### Features
8
+
9
+ * Putting social contract up front
10
+ * Support strong parameters in Rails 4.0, whitelisted attributes in Rails 3.2
11
+ * allow full version specifications in ENV, e.g. RAILS_VERSION=3.2.0
12
+
13
+ ### Testing
14
+
15
+ * moving CI to Travis
16
+ * moving integration tests to RSpec from cucumber
17
+ * using PhantomJS and Poltergeist for headless JS testing
18
+
19
+ ### Dependencies
20
+
21
+ * Adding support for Rails 4.0 and removing support for Rails 3.1. Applications requiring Rails 3.1 should use Surveyor v1.4.1
22
+ * Removing support for Ruby 1.8.7 and Ruby 1.9.3. Applications requiring Ruby 1.x shoudl use Survyeor v1.4.1
23
+
24
+ ### Fixes
25
+
26
+ * updating README and stacktests
27
+ * moving redcap feature to redcap spec
28
+ * removing surveyor_parser.feature (integrated into parser_spec)
29
+ * moving parser cucumber feature to parser spec. moving fixture surveys to fixture directory
30
+ * respect :clean_with_truncation
31
+ * remove benchmark spec
32
+ * default rails version (#472)
33
+ * fix deprecation warnings about Hash#diff
34
+ * fix deprecation warnings about find_all_by_ dynamic finder
35
+ * fix deprecation warnings about the :value option
36
+ * fix deprecation warnings about #find(:first)
37
+ * fix regexp serialization
38
+ * kludge: load formtastic enhancements explicitly
39
+ * fix slow_updates monkey patch
40
+ * Hash#diff is deprecated
41
+ * use surveyor common operators instead of aliasing them through a class method in ValidationCondition
42
+ * refactoring classes with ActiveSupport::Concern
43
+ * fixing next section button
44
+ * remove already disabled section caching
45
+ * fix code that figures out if the asset pipeline is enabled
46
+ * move images to where sprockets expects them to be
47
+ * removed "unloadable" declarations
48
+ * fix deprecation warnings relating to has_many declarations
49
+ * fix deprecation warnings about calling scope() with a hash
50
+ * fix deprecation warnings about calling find_by with options
51
+ * refactor call to find(:first) to quiet deprecation warnings
52
+ * replace Relation#all with other methods to quiet deprecation warnings
53
+ * replace rspec stub!() with stub() to quiet deprecation warnings
54
+ * Make #to_formatted_s handle nils in datetime_value (#459)
55
+ * Update kitchen_sink_survey.r (#458)
56
+ * Fix migration (#454)
57
+ * Allow date_value= and time_value= to handle nils (#450)
58
+
59
+ 1.4.1
60
+ -----
61
+
62
+ ### Fixes
63
+
64
+ - Handle `nil` in `ResponseMethods#date_value=` and `ResponseMethods#time_value`.
65
+ (#450)
66
+ - Handle `nil` datetime values in `ResponseMethods#to_formatted_s`. (#459)
67
+
68
+ ### Dependencies
69
+
70
+ - Removing support for Ruby 1.8.7. Applications requiring Ruby 1.8.7 should use Surveyor v1.4.0
71
+
72
+ 1.4.0
73
+ -----
74
+ ### Features
75
+
76
+ - Routes are namespaced (e.g. `surveyor.available_surveys_path`) and may be mounted at a different root (e.g. `mount Surveyor::Engine, :at => '/instruments'`) (#398, #421)
77
+ - Surveyor::Parser.parse_file takes an options[:filename] parameter, used to locate translations (#429)
78
+ - Surveyor::Parser allows translations to be specified inline using a hash (#429)
79
+ - require locale of survey when translations are present (#426)
80
+ - locale selection in survey UI (#427)
81
+
82
+ ### Fixes
83
+
84
+ - Remove default order on Response. (#423)
85
+ - Bug fix for RedCap Parser for DependencyConditions. thanks @ariel-perez-birchbox
86
+ - Make Surveyor::Parser accept Answer#reference_identifier via underscore or hash syntax (#439)
87
+ - Fix show action and have it use new translation view methods (#438, #442) thanks @alanjcfs
88
+ - Fix times showing in UTC when time zone is specified in Rails (#435)
89
+
90
+ ### Dependencies
91
+
92
+ - Removing support for Rails 3.0. Applications requiring Rails 3.0 should use Surveyor v1.3.0
93
+
94
+ 1.3.0
95
+ -----
96
+
97
+ ### Features
98
+
99
+ - Upgrade to jQuery UI 1.10.0, jQuery 1.9.0, jQueryUI timepicker addons 1.2, and remove jQuery tools (#409)
100
+ - Upgrade reset css
101
+ - Added surveyor_translations table to support YAML-based localizations of surveys. (#420)
102
+ - Add extension point for pre-JSON-export survey modifications (#416)
103
+ - Add input mask for text entry fields (#415)
104
+
105
+ ### Fixes
106
+
107
+ - Export null when datetime response has null datetime value
108
+ - Move the help text to be after the answer text (#401)
109
+ - Fix response serialization for date pick one answers (#400)
110
+ - Remove ordering default scope on survey section methods (#417, #290)
111
+ - Answers of labels should not be shown, within or without groups (#304)
112
+ - Inline group questions should display inline (#303)
113
+ - Evaluate all submitted questions for depdencies (#396)
114
+ - Pick one answers with dates should display their dates correctly (#378)
115
+
116
+ ### Infrastructure
117
+
118
+ - Added stacktests.sh shell script for testing different stacks
119
+
120
+ 1.2.0
121
+ -----
122
+
123
+ ### Features
124
+
125
+ - Allow rendering of simple hash contexts with Mustache (#296)
126
+ - Allow configuration of question numbering (#136)
127
+ - Allow references to question_ and answer_ in dependency conditions (#345)
128
+
129
+ ### Fixes
130
+
131
+ - Surveyor will never require 'fastercsv' on Ruby 1.9. (#381)
132
+ - Add question_groups/question/answer/reference_identifier to JSON
133
+ serialization for Survey. (#390)
134
+ - Evaluate dependencies even when the last response is removed (#362, #215)
135
+ - Add answer help text (#373)
136
+ - SurveyorController#export now renders 404 when surveys are not found (#391)
137
+
138
+ 1.1.0
139
+ -----
140
+
141
+ ### Features
142
+
143
+ - Breaking change: Question#is_mandatory => false by default. For those who found it useful to have
144
+ all questions mandatory, the parser accepts `:default_mandatory => true` as an argument to the survey.
145
+
146
+ ### Fixes
147
+
148
+ - fixing and documenting count operators on dependency conditions
149
+
150
+ ### Infrastructure
151
+
152
+ - basic spec for the surveyor task
153
+
154
+ 1.0.1
155
+ ------
156
+
157
+ ### Features
158
+
159
+ - Question#display_type == "hidden" and QuestionGroup#display_type == "hidden"
160
+ now exclude the question or question group from the DOM. These display types are
161
+ used to inject data (responses) into surveys. Note, custom_class => "hidden" doesn't
162
+ have any effect until a custom css rule is created by the end user. (#197)
163
+
164
+ - more readable parser and more strict parser method aliases (#278)
165
+
166
+ ### Fixes
167
+
168
+ - Replaced deprecated ActiveRecord::Errors#each_full with ActiveRecord::Errors#full_messages. (#363)
169
+
170
+ - fixing dependency condition evaluation where #Response.*_value is nil. (#297)
171
+
172
+ - fixing grid answers leak, introduced in 5baa7ac3. thanks @jsurrett (#375, #377)
173
+
174
+ 1.0.0
175
+ ------
176
+
177
+ ### Features
178
+
179
+ - Official support for Rails 3.2, including declaring of all mass-assignable
180
+ attributes with `attr_accessible`.
181
+
182
+ - Breaking change: Surveys are now explicitly versioned. If you loaded a survey
183
+ when another survey with the same title/access code had already been loaded,
184
+ Surveyor would previously have appended a serial number to the title. As of
185
+ this version, Surveyor keeps the serial number in a separate `survey_version`
186
+ field. (#262)
187
+
188
+ - Add encoding comments for generated files. (#329)
189
+
190
+ - Asset pipeline support for Rails 3.1+. Rails 3.0 is still supported.
191
+ (#307, #314, #315)
192
+
193
+ - Upgrade to Formtastic 2.1. (#227)
194
+
195
+ - `:pick => :one` and `:pick => :any` questions may now have date, time,
196
+ datetime, integer, or float values, in addition to the already-supported
197
+ string values. (#207)
198
+
199
+ - Added Survey#as_json, ResponseSet#as_json. (#291)
200
+
201
+ - Changed defaults for and interpretation of for Survey#active_at and
202
+ Survey#inactive_at. (#258)
203
+
204
+ - JSON export representation of DateTimes is 2010-04-08T10:30+00:00 and Dates is
205
+ 2010-04-08 and Times is 10:30. (#355)
206
+
207
+ - JSON representation of Response includes response_group. (#349)
208
+
209
+ - Use Object#extend to inject SuryeyorParser and SurveyorRedcapParser methods into
210
+ instances of models instead of reopening classes. Move responsibility for keeping
211
+ track of and reporting duplicate and bad references from the models to the parsers.
212
+ Upgrade SurveyorRedcapParser to trace only when rake --trace is specified. (#341)
213
+
214
+ - export Question#data_export_identifier, Answer#data_export_identifier,
215
+ Answer#reference_identifier in survey JSON export. (#368)
216
+
217
+ ### Fixes
218
+
219
+ - Ensure response set is available to `render_context` (#320)
220
+
221
+ - Hide dependent rows of grids. (#343)
222
+
223
+ - Dependency condition with '!=' now returns true if there is no response. (#337)
224
+
225
+ - Properly handle multiple "exclusive" checkboxes in a single question. (#336)
226
+
227
+ - Correct storing of "correct" answers when parsing a survey. (#326)
228
+
229
+ - Restore "slider" renderer. (#230)
230
+
231
+ - Ensure that duplicate responses cannot be created by parallel AJAX requests.
232
+ (#328)
233
+
234
+ - Create default identifiers in before_create, not in the initializer. (#369)
235
+
236
+ - Eliminate unnecessary (and incorrect) access code uniqueness checks.
237
+ Use SecureRandom for generating access codes. (#370)
238
+
239
+ - Use json_spec for testing JSON responses, instead of
240
+ Surveyor::Common#deep_compare_excluding_wildcards. (#350)
241
+
242
+ - Parser now sets Question#correct_answer_id correctly. The association is changed from
243
+ Question :has_one correct_answer => Question :belongs_to correct_answer. (#365)
244
+
245
+ ### Infrastructure
246
+
247
+ - Enabled Selenium-backed cucumber features in CI. (#333)
248
+
249
+ - Added `testbed:surveys` task to load all sample surveys in the testbed.
250
+
251
+ - Begin formal changelog.
252
+
253
+ - Change test infra so that tx behavior can be tested. (#360)
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://www.rubygems.org'
2
+
3
+ gemspec
4
+
5
+ eval(File.read File.expand_path('../Gemfile.rails_version', __FILE__))
@@ -0,0 +1,25 @@
1
+ # For testing against different releases of Rails. This is in a
2
+ # separate fragment so that it can be sourced from the test
3
+ # application's Gemfile in addition to the main development Gemfile.
4
+
5
+ env_rails_version = ENV["RAILS_VERSION"] || "default"
6
+
7
+ case env_rails_version
8
+ when "master"
9
+ {github: "rails/rails"}
10
+ when "default"
11
+ gem "rails", "~> 6.1.3"
12
+ # A JS runtime is required for Rails 4.0+
13
+ gem 'therubyracer', platforms: :ruby
14
+ when /^3.2/
15
+ gem "rails", "~> #{env_rails_version}"
16
+ # A JS runtime is required for Rails 3.1+
17
+ gem 'therubyracer', '~> 0.12.1'
18
+ gem 'strong_parameters'
19
+ when /^4.0/
20
+ gem "rails", "~> #{env_rails_version}"
21
+ # A JS runtime is required for Rails 4.0+
22
+ gem 'therubyracer', platforms: :ruby
23
+ else
24
+ fail "Unsupported Rails version #{ENV['RAILS_VERSION']}"
25
+ end
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008-2010 Brian Chamberlain and Mark Yoon
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,164 @@
1
+ ### Status
2
+ [![Gem Version](https://badge.fury.io/rb/surveyor.svg)](http://badge.fury.io/rb/surveyor)
3
+ [![Build Status](https://travis-ci.org/NUBIC/surveyor.svg)](https://travis-ci.org/NUBIC/surveyor)
4
+ [![Code Climate](https://codeclimate.com/github/NUBIC/surveyor.png)](https://codeclimate.com/github/NUBIC/surveyor)
5
+
6
+ ## Why surveyor?
7
+
8
+ Surveyor is a developer tool to deliver surveys in Rails applications.
9
+ Surveys are written in the surveyor DSL (Domain Specific
10
+ Language). A DSL makes it significantly easier to import long surveys
11
+ (one of the motivations for building surveyor was copy/paste fatigue).
12
+ It enables non-programmers to write out, edit, and review surveys.
13
+
14
+ If your Rails app needs to asks users questions as part of a survey, quiz,
15
+ or questionnaire then you should consider using surveyor. This gem was
16
+ designed to deliver clinical research surveys to large populations,
17
+ but it can be used for any type of survey.
18
+
19
+ Surveyor is a Rails engine distributed as a ruby gem, meaning it is
20
+ straightforward to override or extend its behaviors in your Rails app
21
+ without maintaining a fork.
22
+
23
+ ## Requirements
24
+
25
+ Surveyor works with:
26
+
27
+ * Ruby 2.0.0 and 2.1.1
28
+ * Rails 3.2 and 4.0
29
+
30
+ In keeping with the Rails team maintenance [policy] we no longer support Rails 3.1 (stick with v1.4.0 if you need Rails 3.1) or Ruby 1.9.3 (stick with v1.4.0 if you need Ruby 1.8.7 or 1.9.3).
31
+
32
+ Some key dependencies are:
33
+
34
+ * HAML
35
+ * Sass
36
+ * Formtastic
37
+
38
+ A more exhaustive list can be found in the [gemspec][].
39
+
40
+ [gemspec]: https://github.com/NUBIC/surveyor/blob/master/surveyor.gemspec
41
+ [policy]: http://weblog.rubyonrails.org/2013/2/24/maintenance-policy-for-ruby-on-rails/
42
+
43
+ ## Install
44
+
45
+ Add surveyor to your Gemfile:
46
+
47
+ gem "surveyor"
48
+
49
+ Bundle, install, and migrate:
50
+
51
+ bundle install
52
+ script/rails generate surveyor:install
53
+ bundle exec rake db:migrate
54
+
55
+ Parse the "kitchen sink" survey ([kitchen sink](http://en.wiktionary.org/wiki/everything_but_the_kitchen_sink) means almost everything)
56
+
57
+ bundle exec rake surveyor FILE=surveys/kitchen_sink_survey.rb
58
+
59
+ Start up your app, visit `/surveys`, compare what you see to [kitchen\_sink\_survey.rb][kitchensink] and try responding to the survey.
60
+
61
+ [kitchensink]: http://github.com/NUBIC/surveyor/blob/master/lib/generators/surveyor/templates/surveys/kitchen_sink_survey.rb
62
+
63
+ ## Customize surveyor
64
+
65
+ Surveyor's controller, helper, models, and views may be overridden by classes in your `app` folder. To generate a sample custom controller and layout run:
66
+
67
+ script/rails generate surveyor:custom
68
+
69
+ and read the instructions generated in [`surveys/EXTENDING_SURVEYOR.MD`][extending]
70
+
71
+ [extending]: https://github.com/NUBIC/surveyor/blob/master/lib/generators/surveyor/templates/surveys/EXTENDING_SURVEYOR.md
72
+
73
+ ## Upgrade surveyor
74
+
75
+ To get the latest version of surveyor, bundle, install and migrate:
76
+
77
+ bundle update surveyor
78
+ script/rails generate surveyor:install
79
+ bundle exec rake db:migrate
80
+
81
+ and review the [changelog][] for changes that may affect your customizations.
82
+
83
+ [changelog]: https://github.com/NUBIC/surveyor/blob/master/CHANGELOG.md
84
+
85
+ ## What surveyor does and doesn't do
86
+
87
+ ### Does do
88
+ * use a DSL to parse large surveys without hours of copy/paste into a gui builder
89
+ * support complex, rule-based dependencies (skip-logic)
90
+ * JSON export of both surveys and response sets
91
+ * allow customization of all models, views, and controller, as well as helpers and routes
92
+ * follow semantic versioning
93
+ * exclusive checkboxes - a checkbox that when checked, unchecks all the others
94
+
95
+ ### Doesn't do
96
+ * Enforce mandatory questions... yet (although it does have some[1] methods[2] on ResponseSet to support that)
97
+ * Dependencies within repeaters... yet [#235](http://github.com/NUBIC/surveyor/issues/235)
98
+ * Validations within the UI... yet [#34](http://github.com/NUBIC/surveyor/issues/34), although it does have model support and database representations
99
+ * GUI creating, editing, deleting and administration of surveys... yet [#414](http://github.com/NUBIC/surveyor/issues/414)
100
+ * Consistently support HTML tags in title, text, help_text attributes. We intend to move to markdown support [#413](http://github.com/NUBIC/surveyor/issues/413) so that same survey definition can be used with [nu_surveyor](http://github.com/NUBIC/nu_surveyor).
101
+
102
+ [1]: http://github.com/NUBIC/surveyor/blob/master/lib/surveyor/models/response_set_methods.rb#L94
103
+ [2]: http://github.com/NUBIC/surveyor/blob/master/lib/surveyor/models/response_set_methods.rb#L97
104
+
105
+
106
+ ## Users of spork
107
+
108
+ There is [an issue with spork and custom inputs in formatstic (#851)][851]. A workaround (thanks rmm5t!):
109
+
110
+ Spork.prefork do
111
+ # ...
112
+ surveyor_path = Gem.loaded_specs['surveyor'].full_gem_path
113
+ Dir["#{surveyor_path}/app/inputs/*_input.rb"].each { |f| require File.basename(f) }
114
+ # ...
115
+ end
116
+
117
+ [851]: https://github.com/justinfrench/formtastic/issues/851
118
+
119
+ ## Follow master
120
+
121
+ If you are following pre-release versions of surveyor using a `:git`
122
+ source in your Gemfile, be particularly careful about reviewing migrations after
123
+ updating surveyor and re-running the generator. We will never change a migration
124
+ between two released versions of surveyor. However, we may on rare occasions
125
+ change a migration which has been merged into master. When this happens, you'll
126
+ need to assess the differences and decide on an appropriate course of action for
127
+ your app. If you aren't sure what this means, we do not recommend that you deploy an app
128
+ that's locked to surveyor master into production.
129
+
130
+ ## Support
131
+
132
+ For general discussion (e.g., "how do I do this?"), please send a message to the
133
+ [surveyor-dev][] group. This group is moderated to keep out spam; don't be
134
+ surprised if your message isn't posted immediately.
135
+
136
+ For reproducible bugs, please file an issue on the [GitHub issue tracker][issues].
137
+ Please include a minimal test case (a detailed description of
138
+ how to trigger the bug in a clean rails application). If you aren't sure how to
139
+ isolate the bug, send a message to [surveyor-dev][] with what you know and we'll
140
+ try to help.
141
+
142
+ For build status see our [continuous integration page][ci].
143
+
144
+ Take a look at our [screencast][] (a bit dated now).
145
+
146
+ [surveyor-dev]: https://groups.google.com/group/surveyor-dev
147
+ [issues]: https://github.com/NUBIC/surveyor/issues
148
+ [ci]:https://travis-ci.org/NUBIC/surveyor
149
+ [screencast]:http://vimeo.com/7051279
150
+
151
+ ## Contribute, test
152
+
153
+ To work on the code, fork this github project. Install [bundler][] if
154
+ you don't have it, then bundle, generate the app in `testbed`, and run the specs and features
155
+
156
+ $ bundle update
157
+ $ bundle exec rake testbed
158
+ $ bundle exec rake spec
159
+
160
+ [bundler]: http://gembundler.com/
161
+
162
+ Copyright (c) 2008-2013 Brian Chamberlain and Mark Yoon, released under the [MIT license][mit]
163
+
164
+ [mit]: https://github.com/NUBIC/surveyor/blob/master/MIT-LICENSE