affectiva-surveyor 1.5.0.pre.disco.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +28 -0
- data/.rspec +1 -0
- data/CHANGELOG.md +198 -0
- data/Gemfile +5 -0
- data/Gemfile.rails_version +27 -0
- data/MIT-LICENSE +20 -0
- data/README.md +166 -0
- data/Rakefile +106 -0
- data/app/controllers/surveyor_controller.rb +5 -0
- data/app/helpers/results_helper.rb +20 -0
- data/app/helpers/survey_form_builder.rb +37 -0
- data/app/helpers/surveyor_helper.rb +3 -0
- data/app/inputs/quiet_input.rb +5 -0
- data/app/inputs/surveyor_check_boxes_input.rb +35 -0
- data/app/inputs/surveyor_radio_input.rb +18 -0
- data/app/models/answer.rb +3 -0
- data/app/models/dependency.rb +3 -0
- data/app/models/dependency_condition.rb +3 -0
- data/app/models/question.rb +3 -0
- data/app/models/question_group.rb +4 -0
- data/app/models/response.rb +4 -0
- data/app/models/response_set.rb +3 -0
- data/app/models/survey.rb +3 -0
- data/app/models/survey_section.rb +4 -0
- data/app/models/survey_section_sweeper.rb +15 -0
- data/app/models/survey_translation.rb +4 -0
- data/app/models/validation.rb +3 -0
- data/app/models/validation_condition.rb +3 -0
- data/app/views/layouts/results.html.erb +13 -0
- data/app/views/layouts/surveyor_default.html.erb +12 -0
- data/app/views/partials/_answer.html.haml +25 -0
- data/app/views/partials/_dependents.html.haml +5 -0
- data/app/views/partials/_question.html.haml +28 -0
- data/app/views/partials/_question_group.html.haml +44 -0
- data/app/views/partials/_section.html.haml +12 -0
- data/app/views/partials/_section_menu.html.haml +12 -0
- data/app/views/surveyor/edit.html.haml +24 -0
- data/app/views/surveyor/export.json.rabl +85 -0
- data/app/views/surveyor/new.html.haml +24 -0
- data/app/views/surveyor/show.html.haml +74 -0
- data/app/views/surveyor/show.json.rabl +15 -0
- data/ci-exec.sh +56 -0
- data/config/routes.rb +8 -0
- data/cucumber.yml +10 -0
- data/doc/REPRESENTATIONS.md +34 -0
- data/doc/api_id_schema.json +7 -0
- data/doc/question types.png +0 -0
- data/doc/response_set_schema.json +54 -0
- data/doc/surveyor question combinations.png +0 -0
- data/doc/surveyor reject or delete decision matrix.png +0 -0
- data/doc/surveyor_models.png +0 -0
- data/doc/surveyor_models2.png +0 -0
- data/doc/surveyor_timestamp_schema.json +9 -0
- data/features/ajax_submissions.feature +140 -0
- data/features/export_to_json.feature +344 -0
- data/features/internationalization.feature +121 -0
- data/features/no_duplicates.feature +110 -0
- data/features/show_survey.feature +71 -0
- data/features/step_definitions/parser_steps.rb +145 -0
- data/features/step_definitions/surveyor_steps.rb +325 -0
- data/features/step_definitions/ui_steps.rb +25 -0
- data/features/step_definitions/web_steps.rb +225 -0
- data/features/support/REDCapDemoDatabase_DataDictionary.csv +127 -0
- data/features/support/database_cleaner.rb +16 -0
- data/features/support/env.rb +56 -0
- data/features/support/hooks.rb +4 -0
- data/features/support/paths.rb +39 -0
- data/features/support/redcap_new_headers.csv +1 -0
- data/features/support/redcap_siblings.csv +1 -0
- data/features/support/redcap_whitespace.csv +1 -0
- data/features/support/selectors.rb +39 -0
- data/features/support/simultaneous_ajax.rb +101 -0
- data/features/support/single_quit_selenium_driver.rb +23 -0
- data/features/support/slow_updates.rb +18 -0
- data/features/surveyor.feature +895 -0
- data/features/surveyor_dependencies.feature +476 -0
- data/features/surveyor_parser.feature +504 -0
- data/features/z_redcap_parser.feature +62 -0
- data/lib/assets/images/surveyor/next.gif +0 -0
- data/lib/assets/images/surveyor/prev.gif +0 -0
- data/lib/assets/images/surveyor/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/lib/assets/images/surveyor/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/lib/assets/images/surveyor/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/lib/assets/images/surveyor/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/lib/assets/images/surveyor/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/lib/assets/images/surveyor/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/lib/assets/images/surveyor/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/lib/assets/images/surveyor/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/lib/assets/images/surveyor/ui-icons_222222_256x240.png +0 -0
- data/lib/assets/images/surveyor/ui-icons_2e83ff_256x240.png +0 -0
- data/lib/assets/images/surveyor/ui-icons_454545_256x240.png +0 -0
- data/lib/assets/images/surveyor/ui-icons_888888_256x240.png +0 -0
- data/lib/assets/images/surveyor/ui-icons_cd0a0a_256x240.png +0 -0
- data/lib/assets/javascripts/surveyor/jquery-1.9.0.js +9555 -0
- data/lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js +14850 -0
- data/lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js +1919 -0
- data/lib/assets/javascripts/surveyor/jquery.maskedinput.js +338 -0
- data/lib/assets/javascripts/surveyor/jquery.selectToUISlider.js +240 -0
- data/lib/assets/javascripts/surveyor/jquery.surveyor.js +154 -0
- data/lib/assets/stylesheets/surveyor.sass +132 -0
- data/lib/assets/stylesheets/surveyor/jquery-ui-1.10.0.custom.css +1174 -0
- data/lib/assets/stylesheets/surveyor/jquery-ui-timepicker-addon.css +11 -0
- data/lib/assets/stylesheets/surveyor/reset.css +48 -0
- data/lib/assets/stylesheets/surveyor/results.css +125 -0
- data/lib/assets/stylesheets/surveyor/ui.slider.extras.css +110 -0
- data/lib/generators/surveyor/custom_generator.rb +18 -0
- data/lib/generators/surveyor/install_generator.rb +101 -0
- data/lib/generators/surveyor/templates/app/assets/javascripts/surveyor_all.js +6 -0
- data/lib/generators/surveyor/templates/app/assets/stylesheets/surveyor_all.css +9 -0
- data/lib/generators/surveyor/templates/app/controllers/surveyor_controller.rb +40 -0
- data/lib/generators/surveyor/templates/app/views/layouts/surveyor_custom.html.erb +13 -0
- data/lib/generators/surveyor/templates/config/locales/surveyor_en.yml +19 -0
- data/lib/generators/surveyor/templates/config/locales/surveyor_es.yml +19 -0
- data/lib/generators/surveyor/templates/config/locales/surveyor_he.yml +19 -0
- data/lib/generators/surveyor/templates/config/locales/surveyor_ko.yml +19 -0
- data/lib/generators/surveyor/templates/db/migrate/add_api_id_to_question_groups.rb +10 -0
- data/lib/generators/surveyor/templates/db/migrate/add_api_ids.rb +14 -0
- data/lib/generators/surveyor/templates/db/migrate/add_api_ids_to_response_sets_and_responses.rb +12 -0
- data/lib/generators/surveyor/templates/db/migrate/add_correct_answer_id_to_questions.rb +10 -0
- data/lib/generators/surveyor/templates/db/migrate/add_default_value_to_answers.rb +10 -0
- data/lib/generators/surveyor/templates/db/migrate/add_display_order_to_surveys.rb +10 -0
- data/lib/generators/surveyor/templates/db/migrate/add_display_type_to_answers.rb +14 -0
- data/lib/generators/surveyor/templates/db/migrate/add_index_to_response_sets.rb +10 -0
- data/lib/generators/surveyor/templates/db/migrate/add_index_to_surveys.rb +10 -0
- data/lib/generators/surveyor/templates/db/migrate/add_input_mask_attributes_to_answer.rb +12 -0
- data/lib/generators/surveyor/templates/db/migrate/add_section_id_to_responses.rb +12 -0
- data/lib/generators/surveyor/templates/db/migrate/add_unique_index_on_access_code_and_version_in_surveys.rb +10 -0
- data/lib/generators/surveyor/templates/db/migrate/add_unique_indicies.rb +18 -0
- data/lib/generators/surveyor/templates/db/migrate/add_version_to_surveys.rb +10 -0
- data/lib/generators/surveyor/templates/db/migrate/api_ids_must_be_unique.rb +23 -0
- data/lib/generators/surveyor/templates/db/migrate/create_answers.rb +38 -0
- data/lib/generators/surveyor/templates/db/migrate/create_dependencies.rb +23 -0
- data/lib/generators/surveyor/templates/db/migrate/create_dependency_conditions.rb +30 -0
- data/lib/generators/surveyor/templates/db/migrate/create_question_groups.rb +28 -0
- data/lib/generators/surveyor/templates/db/migrate/create_questions.rb +37 -0
- data/lib/generators/surveyor/templates/db/migrate/create_response_sets.rb +23 -0
- data/lib/generators/surveyor/templates/db/migrate/create_responses.rb +34 -0
- data/lib/generators/surveyor/templates/db/migrate/create_survey_sections.rb +30 -0
- data/lib/generators/surveyor/templates/db/migrate/create_survey_translations.rb +19 -0
- data/lib/generators/surveyor/templates/db/migrate/create_surveys.rb +32 -0
- data/lib/generators/surveyor/templates/db/migrate/create_validation_conditions.rb +33 -0
- data/lib/generators/surveyor/templates/db/migrate/create_validations.rb +21 -0
- data/lib/generators/surveyor/templates/db/migrate/drop_unique_index_on_access_code_in_surveys.rb +10 -0
- data/lib/generators/surveyor/templates/db/migrate/update_blank_api_ids_on_question_group.rb +22 -0
- data/lib/generators/surveyor/templates/db/migrate/update_blank_versions_on_surveys.rb +13 -0
- data/lib/generators/surveyor/templates/surveys/EXTENDING_SURVEYOR.md +52 -0
- data/lib/generators/surveyor/templates/surveys/MODIFYING_SURVEYOR.md +91 -0
- data/lib/generators/surveyor/templates/surveys/date_survey.rb +16 -0
- data/lib/generators/surveyor/templates/surveys/kitchen_sink_survey.rb +280 -0
- data/lib/generators/surveyor/templates/surveys/languages.rb +14 -0
- data/lib/generators/surveyor/templates/surveys/quiz.rb +11 -0
- data/lib/generators/surveyor/templates/surveys/translations/languages.es.yml +18 -0
- data/lib/generators/surveyor/templates/surveys/translations/languages.he.yml +18 -0
- data/lib/generators/surveyor/templates/surveys/translations/languages.ko.yml +18 -0
- data/lib/generators/surveyor/templates/vendor/assets/stylesheets/custom.sass +5 -0
- data/lib/surveyor.rb +13 -0
- data/lib/surveyor/acts_as_response.rb +17 -0
- data/lib/surveyor/common.rb +59 -0
- data/lib/surveyor/engine.rb +10 -0
- data/lib/surveyor/helpers/asset_pipeline.rb +18 -0
- data/lib/surveyor/helpers/formtastic_custom_input.rb +13 -0
- data/lib/surveyor/helpers/surveyor_helper_methods.rb +103 -0
- data/lib/surveyor/models/answer_methods.rb +83 -0
- data/lib/surveyor/models/dependency_condition_methods.rb +69 -0
- data/lib/surveyor/models/dependency_methods.rb +57 -0
- data/lib/surveyor/models/question_group_methods.rb +58 -0
- data/lib/surveyor/models/question_methods.rb +112 -0
- data/lib/surveyor/models/response_methods.rb +126 -0
- data/lib/surveyor/models/response_set_methods.rb +188 -0
- data/lib/surveyor/models/survey_methods.rb +100 -0
- data/lib/surveyor/models/survey_section_methods.rb +53 -0
- data/lib/surveyor/models/survey_translation_methods.rb +30 -0
- data/lib/surveyor/models/validation_condition_methods.rb +54 -0
- data/lib/surveyor/models/validation_methods.rb +45 -0
- data/lib/surveyor/mustache_context.rb +11 -0
- data/lib/surveyor/parser.rb +427 -0
- data/lib/surveyor/redcap_parser.rb +288 -0
- data/lib/surveyor/surveyor_controller_methods.rb +236 -0
- data/lib/surveyor/unparser.rb +147 -0
- data/lib/surveyor/version.rb +3 -0
- data/lib/tasks/surveyor_tasks.rake +88 -0
- data/rails/init.rb +1 -0
- data/spec/controllers/surveyor_controller_spec.rb +311 -0
- data/spec/factories.rb +166 -0
- data/spec/helpers/formtastic_custom_input_spec.rb +15 -0
- data/spec/helpers/surveyor_helper_spec.rb +117 -0
- data/spec/lib/benchmark_spec.rb +22 -0
- data/spec/lib/chinese_survey.rb +14 -0
- data/spec/lib/common_spec.rb +34 -0
- data/spec/lib/parser_spec.rb +204 -0
- data/spec/lib/rake_kitchen_sink.rb +40 -0
- data/spec/lib/redcap_parser_spec.rb +75 -0
- data/spec/lib/tasks_spec.rake +26 -0
- data/spec/lib/unparser_spec.rb +126 -0
- data/spec/models/answer_spec.rb +174 -0
- data/spec/models/dependency_condition_spec.rb +439 -0
- data/spec/models/dependency_spec.rb +101 -0
- data/spec/models/question_group_spec.rb +93 -0
- data/spec/models/question_spec.rb +206 -0
- data/spec/models/response_set_spec.rb +477 -0
- data/spec/models/response_spec.rb +218 -0
- data/spec/models/survey_section_spec.rb +85 -0
- data/spec/models/survey_spec.rb +191 -0
- data/spec/models/validation_condition_spec.rb +113 -0
- data/spec/models/validation_spec.rb +74 -0
- data/spec/rcov.opts +2 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +56 -0
- data/stacktests.sh +65 -0
- data/surveyor.gemspec +53 -0
- metadata +601 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 65edfe53417f34da16090d36d8a27dfbae06f6cb
|
4
|
+
data.tar.gz: 4cb72b63767e646f45a87ce0dd256a5c9c268c4a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fe454b52ed5d568e09cfcaa410890dc9be51d71dfbe64d015c430dfc61e6ac62b2d40838ba97bcda502401e9f072f7548fb276c59cb10c5d930d6cb36635d743
|
7
|
+
data.tar.gz: 05728f3cbcf52cbf01025411a940486dc1aacf24fcd8be8f4a8f30a203f0f738c10b62e620bf7cd88b183a1775a3ef54eb3a91b632241ff6a69d54287ac61334
|
data/.gitignore
ADDED
@@ -0,0 +1,28 @@
|
|
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
|
+
|
24
|
+
## PROJECT::SPECIFIC
|
25
|
+
testbed
|
26
|
+
surveys/fixtures/*.yml
|
27
|
+
.rvmrc
|
28
|
+
.sass-cache/**/*.sassc
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color -fn
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,198 @@
|
|
1
|
+
History for Surveyor
|
2
|
+
====================
|
3
|
+
|
4
|
+
1.4.1
|
5
|
+
-----
|
6
|
+
|
7
|
+
### Fixes
|
8
|
+
|
9
|
+
- Handle `nil` in `ResponseMethods#date_value=` and `ResponseMethods#time_value`.
|
10
|
+
(#450)
|
11
|
+
- Handle `nil` datetime values in `ResponseMethods#to_formatted_s`. (#459)
|
12
|
+
|
13
|
+
### Dependencies
|
14
|
+
|
15
|
+
- Removing support for Ruby 1.8.7. Applications requiring Ruby 1.8.7 should use Surveyor v1.4.0
|
16
|
+
|
17
|
+
1.4.0
|
18
|
+
-----
|
19
|
+
### Features
|
20
|
+
|
21
|
+
- 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)
|
22
|
+
- Surveyor::Parser.parse_file takes an options[:filename] parameter, used to locate translations (#429)
|
23
|
+
- Surveyor::Parser allows translations to be specified inline using a hash (#429)
|
24
|
+
- require locale of survey when translations are present (#426)
|
25
|
+
- locale selection in survey UI (#427)
|
26
|
+
|
27
|
+
### Fixes
|
28
|
+
|
29
|
+
- Remove default order on Response. (#423)
|
30
|
+
- Bug fix for RedCap Parser for DependencyConditions. thanks @ariel-perez-birchbox
|
31
|
+
- Make Surveyor::Parser accept Answer#reference_identifier via underscore or hash syntax (#439)
|
32
|
+
- Fix show action and have it use new translation view methods (#438, #442) thanks @alanjcfs
|
33
|
+
- Fix times showing in UTC when time zone is specified in Rails (#435)
|
34
|
+
|
35
|
+
### Dependencies
|
36
|
+
|
37
|
+
- Removing support for Rails 3.0. Applications requiring Rails 3.0 should use Surveyor v1.3.0
|
38
|
+
|
39
|
+
1.3.0
|
40
|
+
-----
|
41
|
+
|
42
|
+
### Features
|
43
|
+
|
44
|
+
- Upgrade to jQuery UI 1.10.0, jQuery 1.9.0, jQueryUI timepicker addons 1.2, and remove jQuery tools (#409)
|
45
|
+
- Upgrade reset css
|
46
|
+
- Added surveyor_translations table to support YAML-based localizations of surveys. (#420)
|
47
|
+
- Add extension point for pre-JSON-export survey modifications (#416)
|
48
|
+
- Add input mask for text entry fields (#415)
|
49
|
+
|
50
|
+
### Fixes
|
51
|
+
|
52
|
+
- Export null when datetime response has null datetime value
|
53
|
+
- Move the help text to be after the answer text (#401)
|
54
|
+
- Fix response serialization for date pick one answers (#400)
|
55
|
+
- Remove ordering default scope on survey section methods (#417, #290)
|
56
|
+
- Answers of labels should not be shown, within or without groups (#304)
|
57
|
+
- Inline group questions should display inline (#303)
|
58
|
+
- Evaluate all submitted questions for depdencies (#396)
|
59
|
+
- Pick one answers with dates should display their dates correctly (#378)
|
60
|
+
|
61
|
+
### Infrastructure
|
62
|
+
|
63
|
+
- Added stacktests.sh shell script for testing different stacks
|
64
|
+
|
65
|
+
1.2.0
|
66
|
+
-----
|
67
|
+
|
68
|
+
### Features
|
69
|
+
|
70
|
+
- Allow rendering of simple hash contexts with Mustache (#296)
|
71
|
+
- Allow configuration of question numbering (#136)
|
72
|
+
- Allow references to question_ and answer_ in dependency conditions (#345)
|
73
|
+
|
74
|
+
### Fixes
|
75
|
+
|
76
|
+
- Surveyor will never require 'fastercsv' on Ruby 1.9. (#381)
|
77
|
+
- Add question_groups/question/answer/reference_identifier to JSON
|
78
|
+
serialization for Survey. (#390)
|
79
|
+
- Evaluate dependencies even when the last response is removed (#362, #215)
|
80
|
+
- Add answer help text (#373)
|
81
|
+
- SurveyorController#export now renders 404 when surveys are not found (#391)
|
82
|
+
|
83
|
+
1.1.0
|
84
|
+
-----
|
85
|
+
|
86
|
+
### Features
|
87
|
+
|
88
|
+
- Breaking change: Question#is_mandatory => false by default. For those who found it useful to have
|
89
|
+
all questions mandatory, the parser accepts `:default_mandatory => true` as an argument to the survey.
|
90
|
+
|
91
|
+
### Fixes
|
92
|
+
|
93
|
+
- fixing and documenting count operators on dependency conditions
|
94
|
+
|
95
|
+
### Infrastructure
|
96
|
+
|
97
|
+
- basic spec for the surveyor task
|
98
|
+
|
99
|
+
1.0.1
|
100
|
+
------
|
101
|
+
|
102
|
+
### Features
|
103
|
+
|
104
|
+
- Question#display_type == "hidden" and QuestionGroup#display_type == "hidden"
|
105
|
+
now exclude the question or question group from the DOM. These display types are
|
106
|
+
used to inject data (responses) into surveys. Note, custom_class => "hidden" doesn't
|
107
|
+
have any effect until a custom css rule is created by the end user. (#197)
|
108
|
+
|
109
|
+
- more readable parser and more strict parser method aliases (#278)
|
110
|
+
|
111
|
+
### Fixes
|
112
|
+
|
113
|
+
- Replaced deprecated ActiveRecord::Errors#each_full with ActiveRecord::Errors#full_messages. (#363)
|
114
|
+
|
115
|
+
- fixing dependency condition evaluation where #Response.*_value is nil. (#297)
|
116
|
+
|
117
|
+
- fixing grid answers leak, introduced in 5baa7ac3. thanks @jsurrett (#375, #377)
|
118
|
+
|
119
|
+
1.0.0
|
120
|
+
------
|
121
|
+
|
122
|
+
### Features
|
123
|
+
|
124
|
+
- Official support for Rails 3.2, including declaring of all mass-assignable
|
125
|
+
attributes with `attr_accessible`.
|
126
|
+
|
127
|
+
- Breaking change: Surveys are now explicitly versioned. If you loaded a survey
|
128
|
+
when another survey with the same title/access code had already been loaded,
|
129
|
+
Surveyor would previously have appended a serial number to the title. As of
|
130
|
+
this version, Surveyor keeps the serial number in a separate `survey_version`
|
131
|
+
field. (#262)
|
132
|
+
|
133
|
+
- Add encoding comments for generated files. (#329)
|
134
|
+
|
135
|
+
- Asset pipeline support for Rails 3.1+. Rails 3.0 is still supported.
|
136
|
+
(#307, #314, #315)
|
137
|
+
|
138
|
+
- Upgrade to Formtastic 2.1. (#227)
|
139
|
+
|
140
|
+
- `:pick => :one` and `:pick => :any` questions may now have date, time,
|
141
|
+
datetime, integer, or float values, in addition to the already-supported
|
142
|
+
string values. (#207)
|
143
|
+
|
144
|
+
- Added Survey#as_json, ResponseSet#as_json. (#291)
|
145
|
+
|
146
|
+
- Changed defaults for and interpretation of for Survey#active_at and
|
147
|
+
Survey#inactive_at. (#258)
|
148
|
+
|
149
|
+
- JSON export representation of DateTimes is 2010-04-08T10:30+00:00 and Dates is
|
150
|
+
2010-04-08 and Times is 10:30. (#355)
|
151
|
+
|
152
|
+
- JSON representation of Response includes response_group. (#349)
|
153
|
+
|
154
|
+
- Use Object#extend to inject SuryeyorParser and SurveyorRedcapParser methods into
|
155
|
+
instances of models instead of reopening classes. Move responsibility for keeping
|
156
|
+
track of and reporting duplicate and bad references from the models to the parsers.
|
157
|
+
Upgrade SurveyorRedcapParser to trace only when rake --trace is specified. (#341)
|
158
|
+
|
159
|
+
- export Question#data_export_identifier, Answer#data_export_identifier,
|
160
|
+
Answer#reference_identifier in survey JSON export. (#368)
|
161
|
+
|
162
|
+
### Fixes
|
163
|
+
|
164
|
+
- Ensure response set is available to `render_context` (#320)
|
165
|
+
|
166
|
+
- Hide dependent rows of grids. (#343)
|
167
|
+
|
168
|
+
- Dependency condition with '!=' now returns true if there is no response. (#337)
|
169
|
+
|
170
|
+
- Properly handle multiple "exclusive" checkboxes in a single question. (#336)
|
171
|
+
|
172
|
+
- Correct storing of "correct" answers when parsing a survey. (#326)
|
173
|
+
|
174
|
+
- Restore "slider" renderer. (#230)
|
175
|
+
|
176
|
+
- Ensure that duplicate responses cannot be created by parallel AJAX requests.
|
177
|
+
(#328)
|
178
|
+
|
179
|
+
- Create default identifiers in before_create, not in the initializer. (#369)
|
180
|
+
|
181
|
+
- Eliminate unnecessary (and incorrect) access code uniqueness checks.
|
182
|
+
Use SecureRandom for generating access codes. (#370)
|
183
|
+
|
184
|
+
- Use json_spec for testing JSON responses, instead of
|
185
|
+
Surveyor::Common#deep_compare_excluding_wildcards. (#350)
|
186
|
+
|
187
|
+
- Parser now sets Question#correct_answer_id correctly. The association is changed from
|
188
|
+
Question :has_one correct_answer => Question :belongs_to correct_answer. (#365)
|
189
|
+
|
190
|
+
### Infrastructure
|
191
|
+
|
192
|
+
- Enabled Selenium-backed cucumber features in CI. (#333)
|
193
|
+
|
194
|
+
- Added `testbed:surveys` task to load all sample surveys in the testbed.
|
195
|
+
|
196
|
+
- Begin formal changelog.
|
197
|
+
|
198
|
+
- Change test infra so that tx behavior can be tested. (#360)
|
data/Gemfile
ADDED
@@ -0,0 +1,27 @@
|
|
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
|
+
if ENV['RAILS_VERSION']
|
6
|
+
case ENV['RAILS_VERSION']
|
7
|
+
when /3.0$/
|
8
|
+
gem 'rails', '~> 3.0.15'
|
9
|
+
when /3.1$/
|
10
|
+
gem 'rails', '~> 3.1.0'
|
11
|
+
# A JS runtime is required for Rails 3.1+
|
12
|
+
gem 'therubyracer', '~> 0.10.2'
|
13
|
+
when /3.2$/
|
14
|
+
gem 'rails', '~> 3.2.0'
|
15
|
+
# A JS runtime is required for Rails 3.1+
|
16
|
+
gem 'therubyracer', '~> 0.10.2'
|
17
|
+
when /4.0$/
|
18
|
+
gem 'rails', '~> 4.0.0'
|
19
|
+
gem 'rails-observers'
|
20
|
+
# A JS runtime is required for Rails 4.0+
|
21
|
+
gem 'therubyracer', platforms: :ruby
|
22
|
+
else
|
23
|
+
fail "Unknown Rails version #{ENV['RAILS_VERSION']}"
|
24
|
+
end
|
25
|
+
else
|
26
|
+
fail "ENV['RAILS_VERSION'] not set"
|
27
|
+
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,166 @@
|
|
1
|
+
## Why surveyor?
|
2
|
+
|
3
|
+
Surveyor is a developer tool to deliver surveys in Rails applications.
|
4
|
+
Surveys are written in the surveyor DSL (Domain Specific
|
5
|
+
Language). A DSL makes it significantly easier to import long surveys
|
6
|
+
(one of the motivations for building surveyor was copy/paste fatigue).
|
7
|
+
It enables non-programmers to write out, edit, and review surveys.
|
8
|
+
|
9
|
+
If your Rails app needs to asks users questions as part of a survey, quiz,
|
10
|
+
or questionnaire then you should consider using surveyor. This gem was
|
11
|
+
designed to deliver clinical research surveys to large populations,
|
12
|
+
but it can be used for any type of survey.
|
13
|
+
|
14
|
+
Surveyor is a Rails engine distributed as a ruby gem, meaning it is
|
15
|
+
straightforward to override or extend its behaviors in your Rails app
|
16
|
+
without maintaining a fork.
|
17
|
+
|
18
|
+
## Requirements
|
19
|
+
|
20
|
+
Please note: this fork of surveyor works with:
|
21
|
+
|
22
|
+
* Ruby 2.0.0 (may work on 1.9 but not tested)
|
23
|
+
* Rails 4.0
|
24
|
+
|
25
|
+
Some key dependencies are:
|
26
|
+
|
27
|
+
* HAML
|
28
|
+
* Sass
|
29
|
+
* Formtastic
|
30
|
+
* Protected Attributes (NB: will be removed in future version)
|
31
|
+
|
32
|
+
A more exhaustive list can be found in the [gemspec][].
|
33
|
+
|
34
|
+
[gemspec]: https://github.com/NUBIC/surveyor/blob/master/surveyor.gemspec
|
35
|
+
[policy]: http://weblog.rubyonrails.org/2013/2/24/maintenance-policy-for-ruby-on-rails/
|
36
|
+
|
37
|
+
## Install
|
38
|
+
|
39
|
+
Add surveyor to your Gemfile:
|
40
|
+
|
41
|
+
gem 'surveyor', :git => 'git://github.com/ferrisoxide/surveyor.git'
|
42
|
+
gem 'protected_attributes'
|
43
|
+
|
44
|
+
Add the following to your application.rb config section
|
45
|
+
|
46
|
+
config.active_record.mass_assignment_sanitizer = :strict
|
47
|
+
config.active_record.whitelist_attributes = true
|
48
|
+
|
49
|
+
Please note, the protected_attributes gem will be removed in a future version. These config settings will also be deprecated in favour of Rails 4's Strong Parameters.
|
50
|
+
|
51
|
+
Bundle, install, and migrate:
|
52
|
+
|
53
|
+
bundle install
|
54
|
+
script/rails generate surveyor:install
|
55
|
+
bundle exec rake db:migrate
|
56
|
+
|
57
|
+
Parse the "kitchen sink" survey ([kitchen sink](http://en.wiktionary.org/wiki/everything_but_the_kitchen_sink) means almost everything)
|
58
|
+
|
59
|
+
bundle exec rake surveyor FILE=surveys/kitchen_sink_survey.rb
|
60
|
+
|
61
|
+
Start up your app, visit `/surveys`, compare what you see to [kitchen\_sink\_survey.rb][kitchensink] and try responding to the survey.
|
62
|
+
|
63
|
+
[kitchensink]: http://github.com/NUBIC/surveyor/blob/master/lib/generators/surveyor/templates/surveys/kitchen_sink_survey.rb
|
64
|
+
|
65
|
+
## Customize surveyor
|
66
|
+
|
67
|
+
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:
|
68
|
+
|
69
|
+
script/rails generate surveyor:custom
|
70
|
+
|
71
|
+
and read `surveys/EXTENDING\_SURVEYOR`
|
72
|
+
|
73
|
+
## Upgrade
|
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
|
+
## Users of spork
|
86
|
+
|
87
|
+
There is [an issue with spork and custom inputs in formatstic (#851)][851]. A workaround (thanks rmm5t!):
|
88
|
+
|
89
|
+
Spork.prefork do
|
90
|
+
# ...
|
91
|
+
surveyor_path = Gem.loaded_specs['surveyor'].full_gem_path
|
92
|
+
Dir["#{surveyor_path}/app/inputs/*_input.rb"].each { |f| require File.basename(f) }
|
93
|
+
# ...
|
94
|
+
end
|
95
|
+
|
96
|
+
[851]: https://github.com/justinfrench/formtastic/issues/851
|
97
|
+
|
98
|
+
## Follow master
|
99
|
+
|
100
|
+
If you are following pre-release versions of surveyor using a `:git`
|
101
|
+
source in your Gemfile, be particularly careful about reviewing migrations after
|
102
|
+
updating surveyor and re-running the generator. We will never change a migration
|
103
|
+
between two released versions of surveyor. However, we may on rare occasions
|
104
|
+
change a migration which has been merged into master. When this happens, you'll
|
105
|
+
need to assess the differences and decide on an appropriate course of action for
|
106
|
+
your app. If you aren't sure what this means, we do not recommend that you deploy an app
|
107
|
+
that's locked to surveyor master into production.
|
108
|
+
|
109
|
+
## Support
|
110
|
+
|
111
|
+
For general discussion (e.g., "how do I do this?"), please send a message to the
|
112
|
+
[surveyor-dev][] group. This group is moderated to keep out spam; don't be
|
113
|
+
surprised if your message isn't posted immediately.
|
114
|
+
|
115
|
+
For reproducible bugs, please file an issue on the [GitHub issue tracker][issues].
|
116
|
+
Please include a minimal test case (a detailed description of
|
117
|
+
how to trigger the bug in a clean rails application). If you aren't sure how to
|
118
|
+
isolate the bug, send a message to [surveyor-dev][] with what you know and we'll
|
119
|
+
try to help.
|
120
|
+
|
121
|
+
For build status see our [continuous integration page][ci].
|
122
|
+
|
123
|
+
Take a look at our [screencast][] (a bit dated now).
|
124
|
+
|
125
|
+
[surveyor-dev]: https://groups.google.com/group/surveyor-dev
|
126
|
+
[issues]: https://github.com/NUBIC/surveyor/issues
|
127
|
+
[ci]:https://public-ci.nubic.northwestern.edu/job/surveyor/
|
128
|
+
[screencast]:http://vimeo.com/7051279
|
129
|
+
|
130
|
+
## Contribute, test
|
131
|
+
|
132
|
+
To work on the code, fork this github project. Install [bundler][] if
|
133
|
+
you don't have it, then bundle, generate the app in `testbed`, and run the specs and features
|
134
|
+
|
135
|
+
$ export RAILS_VERSION=4.0
|
136
|
+
$ bundle update
|
137
|
+
$ bundle exec rake testbed
|
138
|
+
$ bundle exec rake spec
|
139
|
+
$ bundle exec rake cucumber
|
140
|
+
|
141
|
+
[bundler]: http://gembundler.com/
|
142
|
+
|
143
|
+
## Selenium
|
144
|
+
|
145
|
+
Some of surveyor's integration tests use Selenium WebDriver and Capybara. The
|
146
|
+
WebDriver-based tests default to running in Chrome due to an unfortunate
|
147
|
+
[Firefox bug][FF566671]. For them to run, you'll either need:
|
148
|
+
|
149
|
+
* Chrome and [chromedriver][] installed, or
|
150
|
+
* to switch to use Firefox instead
|
151
|
+
|
152
|
+
To use Firefox instead of Chrome, invoke one or more features with
|
153
|
+
`SELENIUM_BROWSER` set in the environment:
|
154
|
+
|
155
|
+
$ SELENIUM_BROWSER=firefox bundle exec rake cucumber
|
156
|
+
$ SELENIUM_BROWSER=firefox bundle exec cucumber features/ajax_submissions.feature
|
157
|
+
|
158
|
+
Note that when running features in Firefox, you must allow the WebDriver-driven
|
159
|
+
Firefox to retain focus, otherwise some tests will fail.
|
160
|
+
|
161
|
+
[FF566671]: https://bugzilla.mozilla.org/show_bug.cgi?id=566671
|
162
|
+
[chromedriver]: http://code.google.com/p/selenium/wiki/ChromeDriver
|
163
|
+
|
164
|
+
Copyright (c) 2008-2013 Brian Chamberlain and Mark Yoon, released under the [MIT license][mit]
|
165
|
+
|
166
|
+
[mit]: https://github.com/NUBIC/surveyor/blob/master/MIT-LICENSE
|