upgrade_surveyor_gui 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +44 -0
- data/.travis.yml +17 -0
- data/CHANGELOG.md +46 -0
- data/Gemfile +8 -0
- data/LICENSE +21 -0
- data/MIT-LICENSE +20 -0
- data/README.md +244 -0
- data/Rakefile +66 -0
- data/app/controllers/surveyor_controller.rb +89 -0
- data/app/controllers/surveyor_gui/answers_controller.rb +3 -0
- data/app/controllers/surveyor_gui/application_controller.rb +3 -0
- data/app/controllers/surveyor_gui/dependencys_controller.rb +286 -0
- data/app/controllers/surveyor_gui/question_groups_controller.rb +90 -0
- data/app/controllers/surveyor_gui/questions_controller.rb +187 -0
- data/app/controllers/surveyor_gui/reports_controller.rb +339 -0
- data/app/controllers/surveyor_gui/responses_controller.rb +41 -0
- data/app/controllers/surveyor_gui/survey_controller.rb +16 -0
- data/app/controllers/surveyor_gui/survey_sections_controller.rb +80 -0
- data/app/controllers/surveyor_gui/surveyforms_controller.rb +4 -0
- data/app/facades/report_formatter.rb +46 -0
- data/app/facades/report_preview_wrapper.rb +11 -0
- data/app/facades/report_response_generator.rb +147 -0
- data/app/helpers/surveyor_gui/application_helper.rb +2 -0
- data/app/helpers/surveyor_gui/dependencys_helper.rb +5 -0
- data/app/helpers/surveyor_gui/question_groups_helper.rb +3 -0
- data/app/helpers/surveyor_gui/questions_helper.rb +22 -0
- data/app/helpers/surveyor_gui/reports_helper.rb +19 -0
- data/app/helpers/surveyor_gui/surveyforms_helper.rb +164 -0
- data/app/helpers/surveyor_helper.rb +4 -0
- data/app/inputs/currency_input.rb +5 -0
- data/app/inputs/date_picker_input.rb +7 -0
- data/app/inputs/datetime_picker_input.rb +5 -0
- data/app/inputs/percent_input.rb +5 -0
- data/app/inputs/time_picker_input.rb +5 -0
- data/app/mailers/.gitkeep +0 -0
- data/app/models/.gitkeep +0 -0
- data/app/models/answer.rb +4 -0
- data/app/models/column.rb +3 -0
- data/app/models/dependency.rb +4 -0
- data/app/models/dependency_condition.rb +4 -0
- data/app/models/permitted_params_decorator.rb +80 -0
- data/app/models/question.rb +4 -0
- data/app/models/question_group.rb +4 -0
- data/app/models/question_group_tracker.rb +19 -0
- data/app/models/question_type.rb +7 -0
- data/app/models/response.rb +4 -0
- data/app/models/response_set.rb +4 -0
- data/app/models/row.rb +3 -0
- data/app/models/survey.rb +4 -0
- data/app/models/survey_section.rb +4 -0
- data/app/models/surveyform.rb +103 -0
- data/app/uploaders/blob_uploader.rb +48 -0
- data/app/views/layouts/surveyor_gui/application.html.erb +14 -0
- data/app/views/layouts/surveyor_gui/surveyor_gui_blank.html.erb +13 -0
- data/app/views/layouts/surveyor_gui/surveyor_gui_default.html.erb +17 -0
- data/app/views/layouts/surveyor_gui/surveyor_modified.html.erb +14 -0
- data/app/views/partials/_answer.html.haml +33 -0
- data/app/views/partials/_question.html.haml +33 -0
- data/app/views/partials/_question_group.html.haml +73 -0
- data/app/views/partials/_section.html.haml +13 -0
- data/app/views/surveyor/edit.html.haml +21 -0
- data/app/views/surveyor_gui/dependencys/_column.html.erb +1 -0
- data/app/views/surveyor_gui/dependencys/_dependency.html.erb +22 -0
- data/app/views/surveyor_gui/dependencys/_dependency_condition_fields.html.erb +48 -0
- data/app/views/surveyor_gui/dependencys/_form.html.erb +20 -0
- data/app/views/surveyor_gui/dependencys/blank.html.erb +0 -0
- data/app/views/surveyor_gui/dependencys/edit.html.erb +1 -0
- data/app/views/surveyor_gui/dependencys/new.html.erb +1 -0
- data/app/views/surveyor_gui/partials/_url_helpers.html.erb +5 -0
- data/app/views/surveyor_gui/question_groups/_form.html.erb +57 -0
- data/app/views/surveyor_gui/question_groups/_group_inline_field.html.erb +21 -0
- data/app/views/surveyor_gui/question_groups/_group_inline_fields.html.erb +25 -0
- data/app/views/surveyor_gui/question_groups/blank.html.erb +0 -0
- data/app/views/surveyor_gui/question_groups/edit.html.erb +1 -0
- data/app/views/surveyor_gui/question_groups/new.html.erb +1 -0
- data/app/views/surveyor_gui/questions/_answer_fields.html.erb +23 -0
- data/app/views/surveyor_gui/questions/_answer_options.html.erb +28 -0
- data/app/views/surveyor_gui/questions/_form.html.erb +66 -0
- data/app/views/surveyor_gui/questions/_grid_dropdown_columns.html.erb +10 -0
- data/app/views/surveyor_gui/questions/_grid_dropdown_fields.html.erb +42 -0
- data/app/views/surveyor_gui/questions/_grid_fields.html.erb +9 -0
- data/app/views/surveyor_gui/questions/_no_picks.html.erb +29 -0
- data/app/views/surveyor_gui/questions/_pick.html +21 -0
- data/app/views/surveyor_gui/questions/_picks.html.erb +12 -0
- data/app/views/surveyor_gui/questions/blank.html.erb +0 -0
- data/app/views/surveyor_gui/questions/edit.html.erb +1 -0
- data/app/views/surveyor_gui/questions/new.html.erb +1 -0
- data/app/views/surveyor_gui/reports/_graphs.html.haml +21 -0
- data/app/views/surveyor_gui/reports/_grid.html.haml +42 -0
- data/app/views/surveyor_gui/reports/_grid_dropdown.html.haml +56 -0
- data/app/views/surveyor_gui/reports/_repeater.html.haml +27 -0
- data/app/views/surveyor_gui/reports/_show_report.html.haml +33 -0
- data/app/views/surveyor_gui/reports/_single_question.html.haml +70 -0
- data/app/views/surveyor_gui/reports/show.html.erb +14 -0
- data/app/views/surveyor_gui/responses/_grid.html.haml +20 -0
- data/app/views/surveyor_gui/responses/_grid_dropdown.html.haml +20 -0
- data/app/views/surveyor_gui/responses/_repeater.html.haml +22 -0
- data/app/views/surveyor_gui/responses/_survey_results.html.haml +40 -0
- data/app/views/surveyor_gui/responses/index.html.haml +24 -0
- data/app/views/surveyor_gui/responses/show.html.haml +42 -0
- data/app/views/surveyor_gui/shared/_grid_comments.html.haml +10 -0
- data/app/views/surveyor_gui/shared/_new_line.html.haml +2 -0
- data/app/views/surveyor_gui/shared/_pick_comments.html.haml +15 -0
- data/app/views/surveyor_gui/shared/_question_number.html.haml +11 -0
- data/app/views/surveyor_gui/shared/_report_data.html.haml +27 -0
- data/app/views/surveyor_gui/shared/_stars_report_data.html.haml +14 -0
- data/app/views/surveyor_gui/survey_sections/_form.html.erb +13 -0
- data/app/views/surveyor_gui/survey_sections/blank.html.erb +0 -0
- data/app/views/surveyor_gui/survey_sections/edit.html.erb +1 -0
- data/app/views/surveyor_gui/survey_sections/new.html.erb +1 -0
- data/app/views/surveyor_gui/surveyforms/_form.html.erb +50 -0
- data/app/views/surveyor_gui/surveyforms/_question_field.html.erb +148 -0
- data/app/views/surveyor_gui/surveyforms/_question_group.html.erb +116 -0
- data/app/views/surveyor_gui/surveyforms/_question_group_fields.html.erb +3 -0
- data/app/views/surveyor_gui/surveyforms/_question_name_and_number.html.erb +6 -0
- data/app/views/surveyor_gui/surveyforms/_question_section.html.erb +15 -0
- data/app/views/surveyor_gui/surveyforms/_question_wrapper.html.erb +108 -0
- data/app/views/surveyor_gui/surveyforms/_survey_section_fields.html.erb +137 -0
- data/app/views/surveyor_gui/surveyforms/clone_survey.html.erb +13 -0
- data/app/views/surveyor_gui/surveyforms/edit.html.erb +5 -0
- data/app/views/surveyor_gui/surveyforms/index.html.erb +40 -0
- data/app/views/surveyor_gui/surveyforms/new.html.erb +1 -0
- data/app/views/surveyor_gui/surveyforms/show.html.erb +5 -0
- data/config/environment.rb +0 -0
- data/config/routes.rb +71 -0
- data/config.ru +4 -0
- data/db/migrate/20140307204049_add_template_to_surveys.rb +5 -0
- data/db/migrate/20140307235607_add_test_data_to_response_sets.rb +5 -0
- data/db/migrate/20140308171947_add_original_choice_to_answers.rb +5 -0
- data/db/migrate/20140308172118_add_blob_to_responses.rb +5 -0
- data/db/migrate/20140308172417_add_modifiable_to_survey_section.rb +5 -0
- data/db/migrate/20140308174532_add_modifiable_to_question.rb +5 -0
- data/db/migrate/20140308175305_add_dynamically_generate_to_questions.rb +5 -0
- data/db/migrate/20140311032923_add_dummy_blob_to_questions.rb +5 -0
- data/db/migrate/20140311160609_add_dynamic_source_to_questions.rb +5 -0
- data/db/migrate/20140311161714_add_report_code_to_questions.rb +5 -0
- data/db/migrate/20140530181134_add_is_comment_to_questions.rb +5 -0
- data/db/migrate/20140531012006_add_is_comment_to_answers.rb +5 -0
- data/db/migrate/20140531225529_create_rows.rb +9 -0
- data/db/migrate/20140601011151_create_columns.rb +11 -0
- data/db/migrate/20140602030330_add_column_id_to_answers.rb +5 -0
- data/db/migrate/20140603155606_add_column_id_to_responses.rb +5 -0
- data/db/migrate/20140606023527_add_column_id_to_dependency_conditions.rb +5 -0
- data/db/migrate/20140815165307_add_user_id_to_survey.rb +5 -0
- data/lib/assets/.gitkeep +0 -0
- data/lib/assets/images/addicon.png +0 -0
- data/lib/assets/images/datepicker.gif +0 -0
- data/lib/assets/images/delete.gif +0 -0
- data/lib/assets/images/delete.png +0 -0
- data/lib/assets/images/images/border.png +0 -0
- data/lib/assets/images/images/controls.png +0 -0
- data/lib/assets/images/images/loading.gif +0 -0
- data/lib/assets/images/images/loading_background.png +0 -0
- data/lib/assets/images/images/overlay.png +0 -0
- data/lib/assets/images/rails.png +0 -0
- data/lib/assets/images/star.gif +0 -0
- data/lib/assets/javascripts/.gitkeep +0 -0
- data/lib/assets/javascripts/surveyor_gui/jquery.MetaData.js +121 -0
- data/lib/assets/javascripts/surveyor_gui/jquery.blockUI.js +619 -0
- data/lib/assets/javascripts/surveyor_gui/jquery.rating.js +377 -0
- data/lib/assets/javascripts/surveyor_gui/jquery.validate.js +1188 -0
- data/lib/assets/javascripts/surveyor_gui/surveyor_add_ons.js +10 -0
- data/lib/assets/javascripts/surveyor_gui/surveyor_gui.js +1428 -0
- data/lib/assets/stylesheets/.gitkeep +0 -0
- data/lib/assets/stylesheets/surveyor_gui/jquery.rating.css +12 -0
- data/lib/assets/stylesheets/surveyor_gui/surveyor_add_ons.css +3 -0
- data/lib/assets/stylesheets/surveyor_gui/surveyor_gui.sass +652 -0
- data/lib/enumerable_extenders.rb +31 -0
- data/lib/generators/surveyor_gui/install_generator.rb +57 -0
- data/lib/generators/surveyor_gui/templates/app/assets/javascripts/surveyor_add_ons.js +2 -0
- data/lib/generators/surveyor_gui/templates/app/assets/javascripts/surveyor_gui_all.js +24 -0
- data/lib/generators/surveyor_gui/templates/app/assets/stylesheets/surveyor_add_ons.css.sass +1 -0
- data/lib/generators/surveyor_gui/templates/app/assets/stylesheets/surveyor_gui_all.css.sass +8 -0
- data/lib/generators/surveyor_gui/templates/app/helpers/surveyor_helper.rb +4 -0
- data/lib/generators/surveyor_gui/templates/app/models/response_set_user.rb +13 -0
- data/lib/generators/surveyor_gui/templates/app/views/layouts/surveyor_gui/surveyor_gui_default.html.erb +17 -0
- data/lib/generators/surveyor_gui/templates/config/initializers/simple_form.rb +140 -0
- data/lib/generators/surveyor_gui/templates/config/locales/en.yml +5 -0
- data/lib/surveyor_gui/engine.rb +31 -0
- data/lib/surveyor_gui/helpers/surveyor_helper_methods.rb +19 -0
- data/lib/surveyor_gui/models/answer_methods.rb +24 -0
- data/lib/surveyor_gui/models/column_methods.rb +43 -0
- data/lib/surveyor_gui/models/dependency_condition_methods.rb +53 -0
- data/lib/surveyor_gui/models/dependency_methods.rb +83 -0
- data/lib/surveyor_gui/models/question_and_group_shared_methods.rb +11 -0
- data/lib/surveyor_gui/models/question_group_methods.rb +55 -0
- data/lib/surveyor_gui/models/question_methods.rb +435 -0
- data/lib/surveyor_gui/models/question_type_methods.rb +493 -0
- data/lib/surveyor_gui/models/response_methods.rb +71 -0
- data/lib/surveyor_gui/models/response_set_methods.rb +56 -0
- data/lib/surveyor_gui/models/row_methods.rb +11 -0
- data/lib/surveyor_gui/models/survey_methods.rb +32 -0
- data/lib/surveyor_gui/models/survey_section_methods.rb +32 -0
- data/lib/surveyor_gui/surveyforms_controller_methods.rb +258 -0
- data/lib/surveyor_gui/version.rb +3 -0
- data/lib/surveyor_gui.rb +17 -0
- data/lib/tasks/.gitkeep +0 -0
- data/lib/tasks/surveyor_gui_tasks.rake +4 -0
- data/lib/templates/erb/scaffold/_form.html.erb +13 -0
- data/spec/controllers/surveyforms_controller_spec.rb +362 -0
- data/spec/controllers/surveyor_controller_spec.rb +303 -0
- data/spec/factories.rb +181 -0
- data/spec/features/create_survey_spec.rb +417 -0
- data/spec/features/dependencies_spec.rb +65 -0
- data/spec/features/make_and_take_spec.rb +187 -0
- data/spec/features/rearrange_survey_spec.rb +118 -0
- data/spec/features/ui_spec.rb +469 -0
- data/spec/fixtures/REDCapDemoDatabase_DataDictionary.csv +127 -0
- data/spec/fixtures/chinese_survey.rb +14 -0
- data/spec/fixtures/everything.rb +215 -0
- data/spec/fixtures/favorites-ish.rb +22 -0
- data/spec/fixtures/favorites.rb +22 -0
- data/spec/fixtures/feelings.rb +38 -0
- data/spec/fixtures/lifestyle.rb +55 -0
- data/spec/fixtures/numbers.rb +21 -0
- data/spec/fixtures/redcap_new_headers.csv +1 -0
- data/spec/fixtures/redcap_siblings.csv +1 -0
- data/spec/fixtures/redcap_whitespace.csv +1 -0
- data/spec/helpers/formtastic_custom_input_spec.rb +15 -0
- data/spec/helpers/surveyor_helper_spec.rb +116 -0
- data/spec/lib/common_spec.rb +37 -0
- data/spec/lib/parser_spec.rb +393 -0
- data/spec/lib/rake_kitchen_sink.rb +42 -0
- data/spec/lib/redcap_parser_spec.rb +129 -0
- data/spec/lib/unparser_spec.rb +126 -0
- data/spec/models/answer_spec.rb +144 -0
- data/spec/models/dependency_condition_spec.rb +428 -0
- data/spec/models/dependency_spec.rb +90 -0
- data/spec/models/question_group_spec.rb +66 -0
- data/spec/models/question_spec.rb +176 -0
- data/spec/models/response_set_spec.rb +452 -0
- data/spec/models/response_spec.rb +208 -0
- data/spec/models/survey_section_spec.rb +58 -0
- data/spec/models/survey_spec.rb +155 -0
- data/spec/models/surveyor_gui/question_spec.rb +60 -0
- data/spec/models/surveyor_gui/question_type_spec.rb +268 -0
- data/spec/models/validation_condition_spec.rb +98 -0
- data/spec/models/validation_spec.rb +64 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +119 -0
- data/spec/support/scenario_outline_helper.rb +39 -0
- data/spec/support/shared.rb +10 -0
- data/spec/support/surveyforms_creation_helpers.rb +313 -0
- data/spec/support/surveyforms_rearrangement_helpers.rb +170 -0
- data/spec/support/surveyor_api_helpers.rb +15 -0
- data/spec/support/surveyor_ui_helpers.rb +108 -0
- data/spec/support/wait_for_ajax.rb +11 -0
- data/spec/views/questions/edit.html.erb_spec.rb +74 -0
- data/spec/views/surveyforms/edit.html.erb_spec.rb +126 -0
- data/surveyor_gui.gemspec +52 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/mailers/.gitkeep +0 -0
- data/test/dummy/app/models/.gitkeep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/lib/assets/.gitkeep +0 -0
- data/test/dummy/log/.gitkeep +0 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/surveyor-gui_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- data/tmp/cache/assets/CF0/DA0/sprockets%2Fd7d5b37686831d37c4dd75e645f5e016 +0 -0
- data/tmp/cache/assets/E25/4C0/sprockets%2Fde2fd9fd11c04a582cdbbe3d84a35ae6 +0 -0
- data/vendor/assets/stylesheets/.gitkeep +0 -0
- data/vendor/assets/stylesheets/custom.sass +5 -0
- data/vendor/plugins/.gitkeep +0 -0
- metadata +600 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9ebcb45c5d3837056bfd1a774f0773f0ef6e5a2c4d8e73c89925ea9666684bb3
|
4
|
+
data.tar.gz: ae6fc2bd04e6dc3598079c468d2b514e304ec2131a9dad972b204d82dc6d6ad0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e497d87dcfcb4870a0a6e829866710590e7d32e818d1e6d4f1fb248d94960839a938dc5a79de40290bb404e70f6a68cc89bb688270d5f984af9c8abddf5bcb4a
|
7
|
+
data.tar.gz: bbd9098c4e78fa7af9d14e629630e811eaa85b0f1583595224648a58de3995da91d2f913f0f90857c830408e3b95afee70928202c21b53c0eb525d643fe0314b
|
data/.gitignore
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
*~
|
2
|
+
*.rbc
|
3
|
+
*.sassc
|
4
|
+
.sass-cache
|
5
|
+
capybara-*.html
|
6
|
+
.rspec
|
7
|
+
.rvmrc
|
8
|
+
/vendor/bundle
|
9
|
+
/log/*
|
10
|
+
log/*
|
11
|
+
/tmp/*
|
12
|
+
/public/system/*
|
13
|
+
/coverage/
|
14
|
+
/spec/tmp/*
|
15
|
+
**.orig
|
16
|
+
**.swp
|
17
|
+
rerun.txt
|
18
|
+
pickle-email-*.html
|
19
|
+
.project
|
20
|
+
config/initializers/secret_token.rb
|
21
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
22
|
+
#
|
23
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
24
|
+
# or operating system, you probably want to add a global ignore instead:
|
25
|
+
# git config --global core.excludesfile ~/.gitignore_global
|
26
|
+
|
27
|
+
# Ignore bundler config
|
28
|
+
/.bundle
|
29
|
+
|
30
|
+
# Ignore the default SQLite database.
|
31
|
+
/db/*.sqlite3
|
32
|
+
|
33
|
+
# Ignore all logfiles and tempfiles.
|
34
|
+
/log/*.log
|
35
|
+
/tmp
|
36
|
+
|
37
|
+
# Ignore testbed
|
38
|
+
testbed
|
39
|
+
|
40
|
+
# Ignore RVM directives
|
41
|
+
.ruby-version
|
42
|
+
.ruby-gemset
|
43
|
+
|
44
|
+
Gemfile.lock
|
data/.travis.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.0.0
|
4
|
+
- 2.1.1
|
5
|
+
env:
|
6
|
+
- "RAILS_VERSION=4.0.8"
|
7
|
+
- "RAILS_VERSION=4.1.4"
|
8
|
+
script:
|
9
|
+
- bundle exec rake gui_testbed
|
10
|
+
- bundle exec rspec
|
11
|
+
notifications:
|
12
|
+
email:
|
13
|
+
recipients:
|
14
|
+
- kjayma@gmail.com
|
15
|
+
on_success: change # [always|never|change] # default: change
|
16
|
+
on_failure: always # [always|never|change] # default: always
|
17
|
+
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
History for Surveyor
|
2
|
+
====================
|
3
|
+
0.1.2
|
4
|
+
------
|
5
|
+
### Fixes
|
6
|
+
|
7
|
+
- Adds statistics back to repeating group questions
|
8
|
+
|
9
|
+
0.1.1
|
10
|
+
------
|
11
|
+
|
12
|
+
### Fixes
|
13
|
+
|
14
|
+
- Restores ability to add new questions to groups
|
15
|
+
|
16
|
+
- Suppresses redundant data from being show on repeating group questions
|
17
|
+
|
18
|
+
0.1.0
|
19
|
+
------
|
20
|
+
|
21
|
+
### Features
|
22
|
+
|
23
|
+
- This gem is now a mountable engine and uses isolate_namespace.
|
24
|
+
|
25
|
+
### Fixes
|
26
|
+
|
27
|
+
- Fixes error on preview report in which no users are shown and report data is empty. Will now show fake user names.
|
28
|
+
- Fixes error on preview response and show response when dependencies are set. Also shows correct user name on reponse
|
29
|
+
index.
|
30
|
+
|
31
|
+
0.0.3
|
32
|
+
------
|
33
|
+
|
34
|
+
### Features
|
35
|
+
|
36
|
+
- Official support for Rails 4.0. Will work generally work with 4.1 but, Surveyor, a critical dependency, is not officially supported on 4.1.
|
37
|
+
|
38
|
+
- Supports survey creation and reporting.
|
39
|
+
|
40
|
+
- Provides preview of how surveys and reports will look as you are building a survey.
|
41
|
+
|
42
|
+
### Fixes
|
43
|
+
|
44
|
+
|
45
|
+
### Infrastructure
|
46
|
+
|
data/Gemfile
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
# gem 'surveyor', git: 'https://github.com/prateeksinghbundela/surveyor'
|
4
|
+
gem 'upgrade_surveyor'
|
5
|
+
gem 'dynamic_form', git: 'https://github.com/prateeksinghbundela/dynamic_form'
|
6
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
7
|
+
# development dependencies will be added by default to the :development group.
|
8
|
+
gemspec
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 YOURNAME
|
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,244 @@
|
|
1
|
+
surveyor_gui
|
2
|
+
============
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/surveyor_gui.svg)](http://badge.fury.io/rb/surveyor_gui)
|
4
|
+
## Add Surveys to your Rails application
|
5
|
+
|
6
|
+
Need a way to quickly add surveys to your Rails application? Need a way for users to create customizable surveys with little or no training? Need reports and graphs out of the box? Don't want to use a third-party service or closed solution?
|
7
|
+
|
8
|
+
Surveyor_gui can help!
|
9
|
+
|
10
|
+
You can add surveyor_gui to a new or existing rails application to provide a way to create and administer surveys.
|
11
|
+
|
12
|
+
You can find some screenshots at the bottom of this README.
|
13
|
+
|
14
|
+
Builds on the popular Surveyor gem
|
15
|
+
============
|
16
|
+
|
17
|
+
Surveyor_gui is built over Surveyor gem.
|
18
|
+
|
19
|
+
Surveyor does some things really well. Surveyor can be used to build rich surveys with a wide variety of questions types, and it provides a web page for users to take those surveys. However, it lacks two key abilities - the ability to build and edit surveys using a browser and to report on survey results without additional coding. In order to build a survey using Surveyor, you need to create a text file using Surveyor's DSL, and then call a Rake task to parse it.
|
20
|
+
|
21
|
+
The lack of a gui front-end and reports limits the utility of surveyor for certain applications.
|
22
|
+
|
23
|
+
Surveyor_gui meets this need by providing a gui to create surveys from scratch. Surveyor_gui bypasses the need to create a Surveyor DSL file, and directly updates the Surveyor tables to build a survey.
|
24
|
+
|
25
|
+
Surveyor is feature-rich and can create very complex surveys. Surveyor-gui supports most of the features in Surveyor.
|
26
|
+
|
27
|
+
This gem also provides a reporting capability for Surveyor.
|
28
|
+
|
29
|
+
Surveyor_gui is a mountable engine.
|
30
|
+
|
31
|
+
## Requirements
|
32
|
+
|
33
|
+
SurveyorGui works with:
|
34
|
+
|
35
|
+
* Ruby 2.6.5
|
36
|
+
* Rails 6.0
|
37
|
+
|
38
|
+
|
39
|
+
Some key dependencies are:
|
40
|
+
|
41
|
+
* Surveyor
|
42
|
+
* HAML
|
43
|
+
* Sass
|
44
|
+
* Formtastic
|
45
|
+
|
46
|
+
A more exhaustive list can be found in the gemspecs for Surveyor [surveyor] and Surveyor_gui [surveyor-gui][].
|
47
|
+
|
48
|
+
[surveyor]: https://github.com/NUBIC/surveyor/blob/master/surveyor.gemspec
|
49
|
+
[surveyor-gui]: https://github.com/Sandeepcoder98/surveyor_gui/blob/master/surveyor_gui.gemspec
|
50
|
+
[policy]: http://weblog.rubyonrails.org/2013/2/24/maintenance-policy-for-ruby-on-rails/
|
51
|
+
## Install
|
52
|
+
|
53
|
+
Add surveyor and surveyor-gui to your Gemfile:
|
54
|
+
|
55
|
+
gem 'surveyor', github: 'NUBIC/surveyor'
|
56
|
+
gem 'surveyor_gui', github: 'Sandeepcoder98/surveyor_gui'
|
57
|
+
|
58
|
+
You will also need a javascript runtime, like node.js or therubyracer. If you
|
59
|
+
have not yet installed one, add
|
60
|
+
|
61
|
+
gem "therubyracer"
|
62
|
+
|
63
|
+
to your Gemfile.
|
64
|
+
|
65
|
+
Bundle, install, and migrate:
|
66
|
+
|
67
|
+
bundle install
|
68
|
+
rails g surveyor_gui:install
|
69
|
+
|
70
|
+
Note that the installer will run db:migrate (so any un-applied migrations you have in your project will be pulled in).
|
71
|
+
|
72
|
+
You will need to add mountpoints to your routes.rb file. E.g., a starting routes.rb might look like this:
|
73
|
+
|
74
|
+
|
75
|
+
Rails.application.routes.draw do
|
76
|
+
mount SurveyorGui::Engine => "/surveyor_gui", :as => "surveyor_gui"
|
77
|
+
mount Surveyor::Engine => "/surveys", :as => "surveyor"
|
78
|
+
end
|
79
|
+
|
80
|
+
SurveyorGui::Engine points to the survey editor. Surveyor::Engine points to the url where users will take the surveys.
|
81
|
+
The routes.rb file in the testbed application (see Test Environment section) uses the default mountpoints noted above, however
|
82
|
+
they are arbitrary and can be change to anything you would prefer (e.g., mount SurveyorGui::Engine => "my/survey/engine", :as => "surveyor_gui").
|
83
|
+
|
84
|
+
## Limitations
|
85
|
+
|
86
|
+
This gem provides support for a subset of the Surveyor functionality. It supports all of the basic question types, and
|
87
|
+
most of the complicated question types, but does not currently support the following:
|
88
|
+
|
89
|
+
- Questions with multiple entries (e.g., the "Get me started on an improv sketch" question in the kitchen_sink_survey.rb that comes
|
90
|
+
with the Surveyor gem.
|
91
|
+
- Input masks
|
92
|
+
- Quizzes
|
93
|
+
|
94
|
+
It adds some new question types:
|
95
|
+
|
96
|
+
- Star rating (1-5 stars)
|
97
|
+
- File upload
|
98
|
+
- Grid dropdown (a grid of dropdowns with up to ten columns.)
|
99
|
+
|
100
|
+
Dependencies are partially supported. The following are not currently supported:
|
101
|
+
|
102
|
+
- counts (count the number of answers checked or entered)
|
103
|
+
- Regexp validations
|
104
|
+
|
105
|
+
You can open the kitchen_sink survey that comes with Surveyor, but a few of the questions will not behave as expected
|
106
|
+
because of the discrepancies noted above.
|
107
|
+
|
108
|
+
## Locking
|
109
|
+
|
110
|
+
This gem enforces locking on surveys. A survey may be modified up until a user submits a response. At that point, the survey
|
111
|
+
can no longer be edited for structural changes (i.e., /surveyform/edit will not permit any changes). This protects the
|
112
|
+
data integrity of the survey response data.
|
113
|
+
|
114
|
+
If you want to unlock a survey, you will need to manually delete all of the child ResponseSet records (e.g.,
|
115
|
+
Survey.find(1).response_set.all.each{|r| r.destroy} ). Use appropriate caution!
|
116
|
+
|
117
|
+
## Templates
|
118
|
+
|
119
|
+
Surveys may be saved as templates. This allows them to be cloned when creating a new survey (cloning is a pending feature). It is
|
120
|
+
possible to mark certain parts of a survey as unmodifiable so that they will always be present when a survey is cloned.
|
121
|
+
|
122
|
+
A template library feature is pending.
|
123
|
+
|
124
|
+
## Test environment
|
125
|
+
|
126
|
+
If you want to try out surveyor-gui before incorporating it into an application, or contribute, clone the repository.
|
127
|
+
Then run
|
128
|
+
|
129
|
+
bundle install
|
130
|
+
bundle exec rake gui_testbed
|
131
|
+
cd testbed
|
132
|
+
|
133
|
+
Start the rails server.
|
134
|
+
|
135
|
+
The survey editor can be found at '/surveyor_gui/surveyforms'. Take surveys by going to the '/surveys' url or clicking the
|
136
|
+
link at the bottom of the surveyforms home page.
|
137
|
+
|
138
|
+
Before contributing, please run the tests:
|
139
|
+
bundle exec rspec spec
|
140
|
+
|
141
|
+
## Reports
|
142
|
+
|
143
|
+
Surveyor_gui now provides reports!
|
144
|
+
|
145
|
+
You can see a report of all survey responses, or view an individual response.
|
146
|
+
|
147
|
+
Highcharts.js is used for graphics, and must be licensed for commercial use. Future development will replace Highcharts with Rickshawgraphs.
|
148
|
+
|
149
|
+
To see reports, try using the "Preview Reports" button on the survey editor, or take the survey and try
|
150
|
+
"localhost:3000/surveyor_gui/reports/:id/show" where :id is the survey id. Preview reports will create some dummy
|
151
|
+
responses using randomized answers.
|
152
|
+
|
153
|
+
You can also view an individual response at "localhost:3000/surveyor_gui/results/:id/show".
|
154
|
+
|
155
|
+
## Use of Devise and additional customization
|
156
|
+
|
157
|
+
### Devise
|
158
|
+
Surveyor_Gui will work with Devise or like gems.
|
159
|
+
|
160
|
+
Surveyor_gui adds a user_id attribute to the Survey model. It will try to set user_id to current_user when a new survey
|
161
|
+
is defined. The gem does not provide any access control over survey creation and update, but you can add that to your
|
162
|
+
application using the user_id attribute.
|
163
|
+
|
164
|
+
In addition, the underlying Surveyor gem provides a user_id attribute in the ResponseSet model. When responses are created, it will
|
165
|
+
try to set the user_id to current_user.
|
166
|
+
|
167
|
+
Surveyor_gui reports assume there will be a unique user for eash Survey response, and reports on results by user.
|
168
|
+
If the response set has a user id, (which will be the case if you've setup Devise in the typical way) it will identify the response by user_id. If no user_id is available, it will
|
169
|
+
default to the response_set.id.
|
170
|
+
|
171
|
+
You may want to identify users by something other than id on reports. This can be done easily.
|
172
|
+
|
173
|
+
Surveyor_gui creates a response_set_user.rb file in your app/models directory. Edit it to define the identifier you would like to use for users in reports. For instance, if your user model is User, and you would like to see the user's email address on reports, edit the file as follows...
|
174
|
+
|
175
|
+
In the initialize method, add the following line:
|
176
|
+
|
177
|
+
@user = User.find(user_id)
|
178
|
+
|
179
|
+
In the report_user_name method, add the following line:
|
180
|
+
|
181
|
+
@user ? @user.email : nil
|
182
|
+
|
183
|
+
If you wanted the users full name, you could add something like this:
|
184
|
+
|
185
|
+
@user ? @user.last_name + ', ' + @user.first_name : nil
|
186
|
+
|
187
|
+
Note that SurveyorGui controllers expect to use surveyor_gui's own layout view, surveyor_gui_default.rb. A copy will be placed in your application's app/views/layouts directory. You may need edit it for various reasons, such as adding a Devise login/logout link. Keep in mind that surveyor_gui works in an isolated namespace, so devise helpers need to be namespaced to the main app. That means that any view local to surveyor_gui would need to refer to Devise's new_user_registration_path as main_app.new_user_registration_path. If you wanted to add a login/logout link to the surveyor_gui_default layout, you might add something like this:
|
188
|
+
|
189
|
+
<% if user_signed_in? %>
|
190
|
+
Logged in as <strong><%= current_user.email %></strong>.
|
191
|
+
<%= link_to 'Edit profile', main_app.edit_user_registration_path %> |
|
192
|
+
<%= link_to "Logout", main_app.destroy_user_session_path, method: :delete %>
|
193
|
+
<% else %>
|
194
|
+
<%= link_to "Sign up", main_app.new_user_registration_path %> |
|
195
|
+
<%= link_to "Login", main_app.new_user_session_path %>
|
196
|
+
<% end %>
|
197
|
+
|
198
|
+
### Additional Customization
|
199
|
+
|
200
|
+
If you need to perform more extensive customization of Surveyor_gui, take a look at NUBIC/surveyor for customization documentation. The process of customizing Surveyor_gui is largely the same. There are a couple of points to keep in mind. As mentioned above, Surveyor_gui expects its own layout view. If you need to change it or override the default layout in your own custom SurveyorController, make sure to add the following html (or HAML equivalent):
|
201
|
+
|
202
|
+
<div id="surveyor-gui-mount-point" data-surveyor-gui-mount-point="<%= surveyor_gui.surveyforms_path %>"></div>
|
203
|
+
|
204
|
+
This snippet of code allows the javascript files to find the correct mountpoint for the Surveyor_gui gem, which, as mentioned above, may be modified to suit your needs. You will also need to add javascript and stylesheet include tags for surveyor_gui_all.
|
205
|
+
|
206
|
+
If you wish to customize the SurveyorController, add the following snippet to the top of your conroller:
|
207
|
+
|
208
|
+
include Surveyor::SurveyorControllerMethods
|
209
|
+
include SurveyorControllerCustomMethods
|
210
|
+
|
211
|
+
These statements are necessary if calling super from within your customized methods. Be sure to insert the statements in the order shown above.
|
212
|
+
|
213
|
+
If customizing models, you'll need to include both the Surveyor and Surveyor_gui libraries. For instance, to customize question.rb, start with the following shell:
|
214
|
+
|
215
|
+
class Question < ActiveRecord::Base
|
216
|
+
include Surveyor::Models::QuestionMethods
|
217
|
+
include SurveyorGui::Models::QuestionMethods
|
218
|
+
end
|
219
|
+
|
220
|
+
Take a look at the surveyor_gui/app/models directory for examples.
|
221
|
+
|
222
|
+
## Surveyor
|
223
|
+
|
224
|
+
Please take a look at the NUBIC/surveyor on github. The README.doc file will help you to understand how the surveyor engine works. Also, the wiki has a very useful data diagram that will help you to grasp the data
|
225
|
+
structure of the surveys and responses.
|
226
|
+
|
227
|
+
|
228
|
+
## Screenshots
|
229
|
+
|
230
|
+
### Manage surveys
|
231
|
+
|
232
|
+
![](https://raw.github.com/kjayma/surveyor_gui/screenshots/Screenshot%20from%202014-09-16%2016:54:18.png)
|
233
|
+
|
234
|
+
### Build surveys
|
235
|
+
|
236
|
+
![](https://raw.github.com/kjayma/surveyor_gui/screenshots/Screenshot%20from%202014-09-16%2016:59:36.png)
|
237
|
+
|
238
|
+
### Add questions
|
239
|
+
|
240
|
+
![](https://raw.github.com/kjayma/surveyor_gui/screenshots/Screenshot%20from%202014-09-16%2017:03:57.png)
|
241
|
+
|
242
|
+
### Get reports
|
243
|
+
|
244
|
+
![](https://raw.githubusercontent.com/kjayma/surveyor_gui/screenshots/Screenshot%20from%202014-09-16%2017:04:41.png)
|
data/Rakefile
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
$LOAD_PATH << File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
|
4
|
+
require 'bundler/gem_tasks'
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
|
7
|
+
###### RSPEC
|
8
|
+
|
9
|
+
RSpec::Core::RakeTask.new(:spec)
|
10
|
+
|
11
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
12
|
+
spec.rcov = true
|
13
|
+
end
|
14
|
+
|
15
|
+
task :default => :spec
|
16
|
+
|
17
|
+
|
18
|
+
###### TESTBED
|
19
|
+
|
20
|
+
desc 'Set up the rails app that the specs and features use'
|
21
|
+
task :gui_testbed => 'gui_testbed:rebuild'
|
22
|
+
|
23
|
+
namespace :gui_testbed do
|
24
|
+
desc 'Generate a minimal surveyor_gui/surveyor rails app'
|
25
|
+
task :generate do
|
26
|
+
sh "bundle exec rails new testbed --skip-bundle" # don't run bundle install until the Gemfile modifications
|
27
|
+
|
28
|
+
chdir('testbed') do
|
29
|
+
gem_file_contents = File.read('Gemfile')
|
30
|
+
gem_file_contents.sub!(/^(gem 'rails'.*)$/, %Q{ \\1\nplugin_root = File.expand_path('../..', __FILE__)\ngem 'surveyor_gui', :path => plugin_root\ngem 'therubyracer'\ngem 'surveyor', github: 'NUBIC/surveyor'})
|
31
|
+
|
32
|
+
File.open('Gemfile', 'w'){|f| f.write(gem_file_contents) }
|
33
|
+
|
34
|
+
# not sure why turbolinks gives test problems, anyway better to avoid it?
|
35
|
+
js_file_contents = File.read('app/assets/javascripts/application.js')
|
36
|
+
js_file_contents.sub!('//= require turbolinks', '')
|
37
|
+
File.open('app/assets/javascripts/application.js', 'w'){|f| f.write(js_file_contents) }
|
38
|
+
|
39
|
+
Bundler.with_clean_env do
|
40
|
+
sh 'bundle install' # run bundle install after Gemfile modifications
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
desc 'Remove the testbed entirely'
|
46
|
+
task :remove do
|
47
|
+
rm_rf 'testbed'
|
48
|
+
end
|
49
|
+
|
50
|
+
desc 'Prepare the databases for the testbed'
|
51
|
+
task :migrate do
|
52
|
+
chdir('testbed') do
|
53
|
+
Bundler.with_clean_env do
|
54
|
+
sh 'bundle exec rails generate simple_form:install'
|
55
|
+
sh 'bundle exec rake highcharts:update'
|
56
|
+
sh 'bundle exec rails generate surveyor:install'
|
57
|
+
sh 'bundle exec rake db:migrate db:test:prepare'
|
58
|
+
sh 'bundle exec rails generate surveyor_gui:install'
|
59
|
+
sh 'bundle exec rake db:migrate db:test:prepare'
|
60
|
+
sh 'bundle exec rake surveyor FILE=surveys/kitchen_sink_survey.rb'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
task :rebuild => [:remove, :generate, :migrate]
|
66
|
+
end
|