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
@@ -0,0 +1,14 @@
|
|
1
|
+
<br />
|
2
|
+
<div class="column3">
|
3
|
+
<div class="shadebox round surveyor_gui_report">
|
4
|
+
<div id="Survey">
|
5
|
+
<h1 class="round-top"><%= @title %></h1>
|
6
|
+
<h2><%= @survey.title %></h2>
|
7
|
+
<span>
|
8
|
+
<button class = 'show_data' >Show Data</button>
|
9
|
+
<button class = 'hide_data' >Hide Data</button>
|
10
|
+
</span>
|
11
|
+
<%= render 'show_report' %>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
</div>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
%tr{:style => "font-weight:bold;"}
|
2
|
+
%td
|
3
|
+
%td
|
4
|
+
%td
|
5
|
+
- question_group.questions.first.answers.each do |answer|
|
6
|
+
%td
|
7
|
+
= answer.text
|
8
|
+
- question_group.questions.is_not_comment.each_with_index do |question, index|
|
9
|
+
%tr{class: index==0 ? "first_row" : nil}
|
10
|
+
%td
|
11
|
+
%td
|
12
|
+
%td
|
13
|
+
= question.text
|
14
|
+
- question.answers.each do |answer|
|
15
|
+
%td
|
16
|
+
- if Response.where(response_set_id: @response_set.id, question_id: question.id, answer_id: answer.id).count > 0
|
17
|
+
.ui-icon.ui-icon-check
|
18
|
+
/ retrieve comments, if any
|
19
|
+
= render "surveyor_gui/shared/grid_comments", question_group: question_group
|
20
|
+
= render "surveyor_gui/shared/new_line"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
%tr{:style => "font-weight:bold;"}
|
2
|
+
%td
|
3
|
+
%td
|
4
|
+
%td
|
5
|
+
- question_group.columns.each do |column|
|
6
|
+
%td
|
7
|
+
= column.text
|
8
|
+
- question_group.questions.is_not_comment.each_with_index do |question, index|
|
9
|
+
%tr{class: index==0 ? "first_row" : nil}
|
10
|
+
%td
|
11
|
+
%td
|
12
|
+
%td
|
13
|
+
= question.text
|
14
|
+
- question_group.columns.each do |column|
|
15
|
+
%td
|
16
|
+
-if (response = Response.where(response_set_id: @response_set.id, question_id: question.id, column_id: column.id).first)
|
17
|
+
= response.answer.text
|
18
|
+
/ retrieve comments, if any
|
19
|
+
= render "surveyor_gui/shared/grid_comments", question_group: question_group
|
20
|
+
= render "surveyor_gui/shared/new_line"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
%tr.question_group
|
2
|
+
%td
|
3
|
+
%td
|
4
|
+
%td
|
5
|
+
%table
|
6
|
+
%tr.question_group_header
|
7
|
+
- question_group.questions.each do |group_question|
|
8
|
+
%td
|
9
|
+
= group_question.text
|
10
|
+
|
11
|
+
- question_ids = question_group.questions.collect(&:id)
|
12
|
+
- responses = @responses.where('responses.question_id in (?)', question_ids).map{|r| {response_set_id: r.response_set_id, question_id: r.question_id, response: r.response_value}}
|
13
|
+
- (responses.select{|response| response[:response_set_id]==@response_set.id}.count/question_ids.count).times do |index|
|
14
|
+
%tr{class: index==0 ? "first_row" : nil}
|
15
|
+
- question_ids.each do |question_id|
|
16
|
+
%td
|
17
|
+
- if response = responses.select{|response| response[:response_set_id] == @response_set.id && response[:question_id] == question_id}[index]
|
18
|
+
= response[:response]
|
19
|
+
%tr
|
20
|
+
%td
|
21
|
+
|
22
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
- if !(q.part_of_group? and ["default","inline"].include? q.question_group.display_type)
|
2
|
+
%tr
|
3
|
+
%td
|
4
|
+
%tr
|
5
|
+
%td
|
6
|
+
%td
|
7
|
+
- if q.part_of_group? and ["default","inline"].include? q.question_group.display_type
|
8
|
+
%td
|
9
|
+
= q.text
|
10
|
+
%td
|
11
|
+
- if [:slider, :pick_any].include? q.question_type_id
|
12
|
+
%table
|
13
|
+
%tr
|
14
|
+
- q.answers.is_not_comment.each do |a|
|
15
|
+
- responses = @response_set.responses.where(question_id: q.id).collect(&:answer_id)
|
16
|
+
- if responses.include?(a.id)
|
17
|
+
%td
|
18
|
+
%span.preview_multiple_choice_answer
|
19
|
+
= a.text
|
20
|
+
- else
|
21
|
+
%td.preview_answer
|
22
|
+
%span
|
23
|
+
= a.text
|
24
|
+
- elsif q.question_type_id == :stars
|
25
|
+
- 5.times.each do |index|
|
26
|
+
- if @response_set.responses.where(question_id: q.id).first
|
27
|
+
%input{name: "star#{q.id.to_s}", type: "radio", class: "star", disabled: 'disabled', checked: (index+1)== @response_set.responses.where(question_id: q.id).first.integer_value ? "checked" : nil}
|
28
|
+
- elsif q.answers.first && q.answers.first.response_class == 'blob' && response=@response_set.responses.where(:question_id => q.id).first
|
29
|
+
= link_to "click to open", response.blob_url
|
30
|
+
- elsif q.question_type_id != :label
|
31
|
+
- r = @response_set.responses.where(:question_id => q.id).first
|
32
|
+
= q.prefix
|
33
|
+
- if [:number, :date, :datetime, :time].include? q.question_type_id
|
34
|
+
= ReportFormatter.new(q,r).format_stats(r.response_value.to_f) if r
|
35
|
+
- else
|
36
|
+
= r.response_value if r
|
37
|
+
\
|
38
|
+
= q.suffix
|
39
|
+
= render "surveyor_gui/shared/new_line"
|
40
|
+
= render "surveyor_gui/shared/pick_comments", q: q, extra_column: true
|
@@ -0,0 +1,24 @@
|
|
1
|
+
.column2
|
2
|
+
.shadebox.round
|
3
|
+
#survey_response
|
4
|
+
%h1.round_top
|
5
|
+
= @title
|
6
|
+
%br
|
7
|
+
- if @response_sets.where(test_data: false).empty?
|
8
|
+
%br
|
9
|
+
Sorry, no responses available yet. Ask some people to take the survey.
|
10
|
+
%br
|
11
|
+
- else
|
12
|
+
%table
|
13
|
+
%tr
|
14
|
+
%th User
|
15
|
+
%th Action
|
16
|
+
- @response_sets.where(test_data: false).each do |response_set|
|
17
|
+
%tr
|
18
|
+
%td
|
19
|
+
= response_set.report_user_name
|
20
|
+
%td
|
21
|
+
= link_to "Response", response_path(response_set)
|
22
|
+
%br
|
23
|
+
%p
|
24
|
+
= link_to "Manage Surveys", surveyforms_path
|
@@ -0,0 +1,42 @@
|
|
1
|
+
%br
|
2
|
+
.column3
|
3
|
+
.shadebox.round
|
4
|
+
#Survey
|
5
|
+
%h1.round-top= @title
|
6
|
+
- @question_no = 1
|
7
|
+
%h2= @survey.title
|
8
|
+
- @question_no = 1
|
9
|
+
- @survey.survey_sections.each do |ss|
|
10
|
+
%h3= ss.title
|
11
|
+
%br
|
12
|
+
- ss.questions.each do |q|
|
13
|
+
%div{class: q.surveyresponse_class(@response_sets)}
|
14
|
+
%div{class: q.repeater? ? "repeater" : "non_repeater"}
|
15
|
+
- if q.part_of_group?
|
16
|
+
- @question_group = @question_group || QuestionGroupTracker.new(q.question_group)
|
17
|
+
- if @question_group.check_for_new_group(q)
|
18
|
+
- if ["default", "inline", "repeater", "grid"].include? q.question_group.display_type
|
19
|
+
%table
|
20
|
+
%tr
|
21
|
+
%td
|
22
|
+
|
23
|
+
%td{colspan: 3}
|
24
|
+
= @question_no.to_s+") #{q.question_group.text}"
|
25
|
+
- @question_no += 1
|
26
|
+
%tr
|
27
|
+
%td
|
28
|
+
- if ["default", "inline", "repeater"].include? q.question_group.display_type
|
29
|
+
- if q.question_group.display_type == "repeater"
|
30
|
+
= render "repeater", question_group: q.question_group
|
31
|
+
- else
|
32
|
+
- q.question_group.questions.each do |group_question|
|
33
|
+
= render "survey_results", q: group_question
|
34
|
+
- elsif [:grid_one, :grid_any].include? q.question_type_id
|
35
|
+
= render "grid", question_group: q.question_group, question_type: q.question_type_id
|
36
|
+
- elsif q.question_type_id == :grid_dropdown
|
37
|
+
= render "grid_dropdown", question_group: q.question_group
|
38
|
+
- else
|
39
|
+
%table
|
40
|
+
= render "surveyor_gui/shared/question_number", q: q
|
41
|
+
= render "survey_results", q: q
|
42
|
+
= link_to "back", :back
|
@@ -0,0 +1,10 @@
|
|
1
|
+
- question = question_group.questions.where(is_comment: true)
|
2
|
+
- if question && !question.empty? && response = question.first.responses.first
|
3
|
+
= render "surveyor_gui/shared/new_line"
|
4
|
+
%tr
|
5
|
+
%td
|
6
|
+
%td
|
7
|
+
%td
|
8
|
+
= question.first.text+":"
|
9
|
+
%td
|
10
|
+
= response.string_value
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/ get comment line for pick questions
|
2
|
+
- if [:pick_one, :pick_any, :dropdown, :slider].include? q.question_type_id
|
3
|
+
- a = q.answers.where(is_comment: true)
|
4
|
+
- if a && a.first
|
5
|
+
- comment = @response_set.responses.where(question_id: q.id, answer_id: a.first.id).first
|
6
|
+
- if comment
|
7
|
+
%tr
|
8
|
+
%td
|
9
|
+
- if extra_column
|
10
|
+
%td
|
11
|
+
%td
|
12
|
+
= a.first.text+":"
|
13
|
+
%td
|
14
|
+
= comment.string_value if comment
|
15
|
+
= render "surveyor_gui/shared/new_line"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
%tr{:class => q.surveyresponse_class(@response_sets)}
|
2
|
+
%td
|
3
|
+
|
4
|
+
- if q.is_numbered? && !q.part_of_group?
|
5
|
+
%td{colspan: "2", style: q.question_type_id==:label ? "font-weight: bold;" : "" }
|
6
|
+
= @question_no.to_s + ") #{q.text}"
|
7
|
+
- @question_no += 1
|
8
|
+
- else
|
9
|
+
%td
|
10
|
+
%td{style: q.question_type_id==:label ? "font-weight: bold;" : "" }
|
11
|
+
= q.text
|
@@ -0,0 +1,27 @@
|
|
1
|
+
%tr{class: toggle ? "report_data report_data_display" : "report_data"}
|
2
|
+
%td
|
3
|
+
%td
|
4
|
+
%td
|
5
|
+
%table
|
6
|
+
%tr{:style => "font-weight:bold;"}
|
7
|
+
%td User Id
|
8
|
+
%td Response
|
9
|
+
- response_formatter = ReportFormatter.new(q, @responses)
|
10
|
+
- @response_sets.each do |response_set|
|
11
|
+
- @responses.where(question_id: q.id, response_set_id: response_set).each do |r|
|
12
|
+
%tr
|
13
|
+
%td= r.response_set.report_user_name
|
14
|
+
%td.table_number
|
15
|
+
= q.prefix
|
16
|
+
- if [:number, :date, :datetime, :time].include? q.question_type_id
|
17
|
+
= response_formatter.format_stats(r.response_value.to_f)
|
18
|
+
- else
|
19
|
+
= r.response_value
|
20
|
+
\
|
21
|
+
= q.suffix
|
22
|
+
- if q.answers.is_comment.count > 0
|
23
|
+
= render "surveyor_gui/shared/new_line"
|
24
|
+
= render "surveyor_gui/shared/pick_comments", q: q, extra_column: false
|
25
|
+
- if q.question_type_id == :pick_any
|
26
|
+
= render "surveyor_gui/shared/new_line"
|
27
|
+
= render "surveyor_gui/shared/new_line"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
%tr.report_data.report_data_display
|
2
|
+
%td
|
3
|
+
%td
|
4
|
+
%td
|
5
|
+
%table
|
6
|
+
%tr{:style => "font-weight:bold;"}
|
7
|
+
%td User Id
|
8
|
+
%td Response
|
9
|
+
- @responses.where(:question_id => q.id).each do |r|
|
10
|
+
%tr
|
11
|
+
%td= r.response_set.report_user_name
|
12
|
+
%td
|
13
|
+
- 5.times.each do |index|
|
14
|
+
%input{name: "star#{'d1'+r.id.to_s}", type: "radio", class: "star", disabled: "disabled", checked: ( (index+1)== r.integer_value ? "checked" : nil )}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<div class="shadebox round">
|
2
|
+
<h1 class="round-top"><%= @title %></h1>
|
3
|
+
<%= simple_form_for @survey_section do |f| %>
|
4
|
+
<% @survey_section.errors.full_messages.each do |msg| %>
|
5
|
+
<p><%= msg %></p>
|
6
|
+
<% end %>
|
7
|
+
<%= f.hidden_field :survey_id %>
|
8
|
+
<%= f.hidden_field :modifiable %>
|
9
|
+
<%= f.hidden_field :display_order %>
|
10
|
+
<%= f.input :title , :input_html=>{:size=>'35'}%>
|
11
|
+
<%= f.button :submit, 'Save Changes', :id=>'survey_section_submit' %>
|
12
|
+
<% end %>
|
13
|
+
</div>
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'form' %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'form' %>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<div id="box" class="boxshadow round">
|
2
|
+
<div class="column3">
|
3
|
+
<input id='pass_cbox_data' type="hidden">
|
4
|
+
<div class="shadebox round">
|
5
|
+
<div id="survey">
|
6
|
+
<h1 class="round-top">
|
7
|
+
<%= @title %>
|
8
|
+
<% if @surveyform.id -%>
|
9
|
+
<input class="preview-button" onclick="preview_cbox('<%= surveyor_gui.survey_url(@surveyform.id) %>',
|
10
|
+
<%= @surveyform.id %>);" type="button" value="Preview Survey" />
|
11
|
+
<input class="preview-button" onclick="preview_cbox('<%= surveyor_gui.preview_response_url(@surveyform.id) %>',
|
12
|
+
<%= @surveyform.id %>);" type="button" value="Preview Response" />
|
13
|
+
<input class="preview-button" onclick="preview_cbox('<%= surveyor_gui.preview_report_url(@surveyform.id) %>',
|
14
|
+
<%= @surveyform.id %>);" type="button" value="Preview Report" />
|
15
|
+
<% end %>
|
16
|
+
</h1>
|
17
|
+
<%= simple_form_for [surveyor_gui, @surveyform] do |f| %>
|
18
|
+
<%= f.error_messages %>
|
19
|
+
<br/>
|
20
|
+
<%= f.hidden_field :id %>
|
21
|
+
<%= f.label :title, :required => false, :style => 'font-size: 150%;' %>
|
22
|
+
<%= f.input :title, :input_html => { :size => '35', :style=>'margin-top: 0.5%; font-size: 110%; float:left;'}, :required=>false , :label=>false%>
|
23
|
+
<%= f.input :template, :disabled=>@survey_locked, :label => false, :input_html=>{:style=>"float:right;"} %>
|
24
|
+
<span style='position:relative; float: right;'>Template?
|
25
|
+
|
26
|
+
</span><br/><br />
|
27
|
+
<div class="sortable_sections" data-survey_locked=<%= @survey_locked %>>
|
28
|
+
<%= render "survey_section_fields", :s => builder , :f => f %>
|
29
|
+
</div>
|
30
|
+
<% if @survey_locked%>
|
31
|
+
<p><button class="go_back" type="button">Go Back</button></p>
|
32
|
+
<% else -%>
|
33
|
+
<p><%= f.button :submit, 'Save Changes' %></p>
|
34
|
+
<% end -%>
|
35
|
+
<% end %>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<script type="text/javascript">
|
42
|
+
function preview_cbox(url, id) {
|
43
|
+
$.colorbox({width:"90%",
|
44
|
+
height:"90%",
|
45
|
+
scrolling:true,
|
46
|
+
iframe:true,
|
47
|
+
href: url + '?suppress_header=true&survey_id='+ id,
|
48
|
+
opacity:.3});
|
49
|
+
}
|
50
|
+
</script>
|
@@ -0,0 +1,148 @@
|
|
1
|
+
<%= f.hidden_field :id %>
|
2
|
+
<%= f.hidden_field :display_order %>
|
3
|
+
<%= f.hidden_field :modifiable %>
|
4
|
+
|
5
|
+
<%= row_label_if_question_group f.object %>
|
6
|
+
|
7
|
+
<% question_type = f.object.question_type_id
|
8
|
+
case question_type
|
9
|
+
when :slider -%>
|
10
|
+
<div class="slider">
|
11
|
+
<!-- The slider uses the Jquery UISlider plugin (http://www.filamentgroup.com/lab/update_jquery_ui_16_slider_from_a_select_element/) -->
|
12
|
+
<!-- Look in application.js for the hook - it selects all input select elements with "uislider" as the class -->
|
13
|
+
<%= f.input :dummy_answer, :collection => f.object.answers.map{|a| a.text}, :as => :select, :label => false,
|
14
|
+
:input_html => {:class => "uislider"}, :include_blank => false, :wrapper_html=>{:class => 'shrink_slider'} %>
|
15
|
+
</slider>
|
16
|
+
<% when :stars -%>
|
17
|
+
<%= f.input :dummy_answer, label: false, :collection => [[nil,1],[nil,2],[nil,3],[nil,4],[nil,5]],
|
18
|
+
:as => :radio_buttons, :input_html=>{:class=>'star'}, :wrapper_html=>{:class=>'star'} %>
|
19
|
+
|
20
|
+
<% when :pick_one -%>
|
21
|
+
|
22
|
+
<% f.object.answers.each do |answer| -%>
|
23
|
+
<% if answer.is_comment==true -%>
|
24
|
+
<span class="other comments_text">
|
25
|
+
<%= f.input :dummy_answer, :as=>:string, label: answer.text %>
|
26
|
+
</span>
|
27
|
+
<% else -%>
|
28
|
+
<%= f.input_field :dummy_answer, label: (f.object.repeater? ? answer.text : false), collection: [answer.text], collection: [answer.text], :as => :radio_buttons%>
|
29
|
+
<% if answer.response_class == "string" %>
|
30
|
+
<span class="other">
|
31
|
+
<%= f.input_field :dummy_answer, :as=>:string, :label=> false%>
|
32
|
+
</span>
|
33
|
+
<% end -%>
|
34
|
+
<% end -%>
|
35
|
+
<% end -%>
|
36
|
+
|
37
|
+
<% when :grid_one -%>
|
38
|
+
|
39
|
+
<% f.object.answers.each do |answer| -%>
|
40
|
+
<%= f.input_field :dummy_answer, label: false, collection: [answer.text], :as => :radio_buttons %>
|
41
|
+
<% if answer.response_class == "string" %>
|
42
|
+
<span class="other">
|
43
|
+
<%= f.input_field :dummy_answer, :as=>:string, :label=>false%>
|
44
|
+
</span>
|
45
|
+
<% end -%>
|
46
|
+
<% end -%>
|
47
|
+
|
48
|
+
<% when :dropdown -%>
|
49
|
+
|
50
|
+
<%= f.input :dummy_answer, label: false, :collection => f.object.answers.collect(&:text), :as => :select %>
|
51
|
+
|
52
|
+
|
53
|
+
<% when :grid_dropdown -%>
|
54
|
+
<% f.object.question_group.columns.each do |column| %>
|
55
|
+
<%= f.input :dummy_answer, label: false,
|
56
|
+
:collection => f.object.answers.where('column_id=?',column.id).collect(&:text),
|
57
|
+
:as => :select, :wrapper_html=>{:class=>'grid_dropdown_cell'} %>
|
58
|
+
<% end -%>
|
59
|
+
|
60
|
+
<% when :pick_any %>
|
61
|
+
<% f.object.answers.each do |answer| -%>
|
62
|
+
<% if answer.is_comment==true -%>
|
63
|
+
<span class="other comments_text">
|
64
|
+
<%= f.input :dummy_answer, :as=>:string, label: answer.text %>
|
65
|
+
</span>
|
66
|
+
<% else -%>
|
67
|
+
<%= f.input_field :dummy_answer_array, label: (f.object.repeater? ? answer.text : false), collection: [answer.text], :as => :check_boxes %>
|
68
|
+
<% if answer.response_class == "string" %>
|
69
|
+
<span class="other">
|
70
|
+
<%= f.input_field :dummy_answer, :as=>:string, :label=> false%>
|
71
|
+
</span>
|
72
|
+
<% end -%>
|
73
|
+
<% end -%>
|
74
|
+
<% end -%>
|
75
|
+
|
76
|
+
<% when :grid_any %>
|
77
|
+
|
78
|
+
<% if f.object.dynamically_generate==false -%>
|
79
|
+
<br />
|
80
|
+
<span style="font-weight:normal;font-style:italic" class="field_indent">content retrieved from the application will go here.</span>
|
81
|
+
<br />
|
82
|
+
<% else -%>
|
83
|
+
<% f.object.answers.each do |answer| -%>
|
84
|
+
<%= f.input_field :dummy_answer_array, label: false, collection: [answer.text], :as => :check_boxes %>
|
85
|
+
<% if answer.response_class == "string" %>
|
86
|
+
<span class="other">
|
87
|
+
<%= f.input_field :dummy_answer, :as=>:string, :label=>false%>
|
88
|
+
</span>
|
89
|
+
<% end -%>
|
90
|
+
<% end -%>
|
91
|
+
|
92
|
+
<% end %>
|
93
|
+
|
94
|
+
<% when :label -%>
|
95
|
+
<span style="margin-left: 4.5em;">
|
96
|
+
<%= f.object.text %>
|
97
|
+
</span>
|
98
|
+
|
99
|
+
<% when :string -%>
|
100
|
+
<%= f.input :dummy_answer, :as=>:string, :label=>false, :input_html=>{:rows=>"1"}%>
|
101
|
+
|
102
|
+
<% when :box -%>
|
103
|
+
|
104
|
+
<%= f.input :dummy_answer, :as=>:text, :label=>false, :input_html=>{ :rows=>"3"}%>
|
105
|
+
|
106
|
+
<% when :number -%>
|
107
|
+
<!-- Prefix -->
|
108
|
+
<span class="fl prefix">
|
109
|
+
<% if f.object.answers.first.text.include?('|') %>
|
110
|
+
<%= f.object.answers.first.text.split('|')[0] %>
|
111
|
+
<% end %>
|
112
|
+
</span>
|
113
|
+
|
114
|
+
<!-- Number -->
|
115
|
+
<%= f.input :dummy_answer, :as=>:string, :label=>false, :input_html=>{:size=>"10"}, :wrapper_html=>{:class=>'fl notfirst number'} %>
|
116
|
+
|
117
|
+
<!-- Suffix -->
|
118
|
+
<span class="suffix fl">
|
119
|
+
|
120
|
+
<%= f.object.answers.first.text.split('|')[1] %>
|
121
|
+
</span>
|
122
|
+
<% when :date -%>
|
123
|
+
<%= f.input :dummy_answer, :as=>:date_picker, :label=>false, :input_html=>{:size => "8",:style=>"margin-left: 4.5em;"},
|
124
|
+
:hint => 'mm/dd/yy', :hint_html=>{:style=>'margin-left:5em;'} %>
|
125
|
+
|
126
|
+
<% when :datetime -%>
|
127
|
+
<%= f.input :dummy_answer, :as=>:datetime_picker, :label=>false, :input_html=>{:size => "8",:style=>"margin-left: 4.5em;"},
|
128
|
+
:hint => 'mm/dd/yy hh:mm', :hint_html=>{:style=>'margin-left:5em;'} %>
|
129
|
+
|
130
|
+
<% when :time -%>
|
131
|
+
<%= f.input :dummy_answer, :as=>:time_picker, :label=>false, :input_html=>{:size => "8",:style=>"margin-left: 4.5em;"},
|
132
|
+
:hint => 'hh:mm', :hint_html=>{:style=>'margin-left:5em;'} %>
|
133
|
+
<% when :file -%>
|
134
|
+
<%= f.input :dummy_blob, :as => :file, :label=>false, :input_html=>{:size => "8",:style=>"margin-left: 4.5em;"} %>
|
135
|
+
|
136
|
+
<% else -%>
|
137
|
+
<br/>
|
138
|
+
<br />
|
139
|
+
<%= f.input :dummy_answer, :label=>false, :input_html=>{:style=>"margin-left: 4.5em;"}%>
|
140
|
+
<% end -%>
|
141
|
+
|
142
|
+
<% if !f.object.modifiable? -%>
|
143
|
+
<br />
|
144
|
+
<span class='field_indent'>
|
145
|
+
Report Code: <%= f.object.report_code %>
|
146
|
+
</span>
|
147
|
+
<br />
|
148
|
+
<% end %>
|