surveyor_gui 0.0.3
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/Gemfile +7 -0
- data/LICENSE +21 -0
- data/MIT-LICENSE +20 -0
- data/README.md +159 -0
- data/Rakefile +66 -0
- data/app/controllers/answers_controller.rb +3 -0
- data/app/controllers/application_controller.rb +3 -0
- data/app/controllers/dependencys_controller.rb +286 -0
- data/app/controllers/question_groups_controller.rb +84 -0
- data/app/controllers/questions_controller.rb +187 -0
- data/app/controllers/survey_sections_controller.rb +80 -0
- data/app/controllers/surveyforms_controller.rb +4 -0
- data/app/controllers/surveyor_controller.rb +89 -0
- data/app/controllers/surveyor_gui/reports_controller.rb +339 -0
- data/app/controllers/surveyor_gui/responses_controller.rb +39 -0
- data/app/controllers/surveyor_gui/survey_controller.rb +16 -0
- data/app/facades/report_formatter.rb +44 -0
- data/app/facades/report_preview_wrapper.rb +11 -0
- data/app/facades/report_response_generator.rb +147 -0
- data/app/helpers/application_helper.rb +2 -0
- data/app/helpers/dependency_helper.rb +5 -0
- data/app/helpers/question_helper.rb +22 -0
- data/app/helpers/surveyform_helper.rb +179 -0
- data/app/helpers/surveyor_gui/report_helper.rb +19 -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_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/dependencys/_column.html.erb +1 -0
- data/app/views/dependencys/_dependency.html.erb +22 -0
- data/app/views/dependencys/_dependency_condition_fields.html.erb +48 -0
- data/app/views/dependencys/_form.html.erb +20 -0
- data/app/views/dependencys/blank.html.erb +0 -0
- data/app/views/dependencys/edit.html.erb +1 -0
- data/app/views/dependencys/new.html.erb +1 -0
- data/app/views/layouts/application.html.erb +14 -0
- data/app/views/layouts/surveyor_gui_blank.html.erb +12 -0
- data/app/views/layouts/surveyor_gui_default.html.erb +16 -0
- data/app/views/layouts/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/question_groups/_form.html.erb +56 -0
- data/app/views/question_groups/_group_inline_field.html.erb +21 -0
- data/app/views/question_groups/_group_inline_fields.html.erb +25 -0
- data/app/views/question_groups/blank.html.erb +0 -0
- data/app/views/question_groups/edit.html.erb +1 -0
- data/app/views/question_groups/new.html.erb +1 -0
- data/app/views/questions/_answer_fields.html.erb +23 -0
- data/app/views/questions/_answer_options.html.erb +28 -0
- data/app/views/questions/_form.html.erb +65 -0
- data/app/views/questions/_grid_dropdown_columns.html.erb +10 -0
- data/app/views/questions/_grid_dropdown_fields.html.erb +42 -0
- data/app/views/questions/_grid_fields.html.erb +9 -0
- data/app/views/questions/_no_picks.html.erb +29 -0
- data/app/views/questions/_pick.html +21 -0
- data/app/views/questions/_picks.html.erb +12 -0
- data/app/views/questions/blank.html.erb +0 -0
- data/app/views/questions/edit.html.erb +1 -0
- data/app/views/questions/new.html.erb +1 -0
- data/app/views/survey_sections/_form.html.erb +13 -0
- data/app/views/survey_sections/blank.html.erb +0 -0
- data/app/views/survey_sections/edit.html.erb +1 -0
- data/app/views/survey_sections/new.html.erb +1 -0
- data/app/views/surveyforms/_form.html.erb +50 -0
- data/app/views/surveyforms/_question_field.html.erb +148 -0
- data/app/views/surveyforms/_question_group.html.erb +116 -0
- data/app/views/surveyforms/_question_group_fields.html.erb +3 -0
- data/app/views/surveyforms/_question_name_and_number.html.erb +6 -0
- data/app/views/surveyforms/_question_section.html.erb +15 -0
- data/app/views/surveyforms/_question_wrapper.html.erb +109 -0
- data/app/views/surveyforms/_survey_section_fields.html.erb +138 -0
- data/app/views/surveyforms/clone_survey.html.erb +13 -0
- data/app/views/surveyforms/edit.html.erb +5 -0
- data/app/views/surveyforms/index.html.erb +40 -0
- data/app/views/surveyforms/new.html.erb +1 -0
- data/app/views/surveyforms/show.html.erb +5 -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 +28 -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 +9 -0
- data/app/views/surveyor_gui/shared/_report_data.html.haml +24 -0
- data/app/views/surveyor_gui/shared/_stars_report_data.html.haml +14 -0
- data/config.ru +4 -0
- data/config/environment.rb +0 -0
- data/config/routes.rb +71 -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 +1417 -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 +650 -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_default.html.erb +16 -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.rb +17 -0
- data/lib/surveyor_gui/engine.rb +30 -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 +67 -0
- data/lib/surveyor_gui/models/response_set_methods.rb +54 -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/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 +361 -0
- data/spec/controllers/surveyor_controller_spec.rb +303 -0
- data/spec/factories.rb +181 -0
- data/spec/features/create_survey_spec.rb +418 -0
- data/spec/features/dependencies_spec.rb +61 -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 +312 -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 +73 -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.ru +4 -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/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/vendor/assets/stylesheets/.gitkeep +0 -0
- data/vendor/assets/stylesheets/custom.sass +5 -0
- data/vendor/plugins/.gitkeep +0 -0
- metadata +664 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
%table
|
2
|
+
%tr.question_group
|
3
|
+
%td
|
4
|
+
%td
|
5
|
+
%td
|
6
|
+
%table
|
7
|
+
%tr.question_group_header
|
8
|
+
%td User Id
|
9
|
+
- question_group.questions.each do |group_question|
|
10
|
+
%td
|
11
|
+
= group_question.text
|
12
|
+
|
13
|
+
- question_ids = question_group.questions.collect(&:id)
|
14
|
+
- 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}}
|
15
|
+
- @response_sets.each do |response_set|
|
16
|
+
- (responses.select{|response| response[:response_set_id]==response_set.id}.count/question_ids.count).times do |index|
|
17
|
+
%tr{class: index==0 ? "first_row" : nil}
|
18
|
+
%td
|
19
|
+
%span.user_id
|
20
|
+
= response_set.report_user_name
|
21
|
+
- question_ids.each do |question_id|
|
22
|
+
%td
|
23
|
+
- if response = responses.select{|response| response[:response_set_id] == response_set.id && response[:question_id] == question_id}[index]
|
24
|
+
= response[:response]
|
25
|
+
%tr
|
26
|
+
%td
|
27
|
+
|
28
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
- @question_no = 1
|
2
|
+
- @survey.survey_sections.each do |ss|
|
3
|
+
%h3= ss.title
|
4
|
+
%br
|
5
|
+
- ss.questions.each do |q|
|
6
|
+
%div{class: q.surveyresponse_class(@response_sets)}
|
7
|
+
%div{class: q.repeater? ? "repeater" : "non_repeater"}
|
8
|
+
- if q.part_of_group?
|
9
|
+
- @question_group = @question_group || QuestionGroupTracker.new(q.question_group)
|
10
|
+
- if @question_group.check_for_new_group(q)
|
11
|
+
- if ["default", "inline", "repeater", "grid"].include? q.question_group.display_type
|
12
|
+
%table
|
13
|
+
%tr
|
14
|
+
%td
|
15
|
+
|
16
|
+
%td{colspan: 3}
|
17
|
+
= @question_no.to_s+") #{q.question_group.text}"
|
18
|
+
- @question_no += 1
|
19
|
+
%tr
|
20
|
+
%td
|
21
|
+
- if ["default", "inline", "repeater"].include? q.question_group.display_type
|
22
|
+
- if q.question_group.display_type == "repeater"
|
23
|
+
= render "repeater", question_group: q.question_group
|
24
|
+
- q.question_group.questions.each do |group_question|
|
25
|
+
%table
|
26
|
+
= render "single_question", q: group_question
|
27
|
+
- elsif [:grid_one, :grid_any].include? q.question_type_id
|
28
|
+
= render "grid", question_group: q.question_group, question_type: q.question_type_id
|
29
|
+
- elsif q.question_type_id == :grid_dropdown
|
30
|
+
= render "grid_dropdown", question_group: q.question_group
|
31
|
+
- else
|
32
|
+
%table
|
33
|
+
= render "single_question", q: q
|
@@ -0,0 +1,70 @@
|
|
1
|
+
= render "surveyor_gui/shared/question_number", q: q
|
2
|
+
- if q.display_type == 'label'
|
3
|
+
= render "surveyor_gui/shared/new_line"
|
4
|
+
- else
|
5
|
+
= render "graphs", q: q
|
6
|
+
- if [:pick_one,:pick_any,:dropdown,:number,:date,:datetime,:time,:stars,:slider, :string, :box].include? q.question_type_id
|
7
|
+
= render "surveyor_gui/shared/new_line"
|
8
|
+
- if q.question_type_id == :stars
|
9
|
+
= render "surveyor_gui/shared/stars_report_data", q: q, toggle: true
|
10
|
+
- elsif [:number,:date,:datetime,:time].include? q.question_type_id
|
11
|
+
= render "surveyor_gui/shared/report_data", q: q, toggle: true
|
12
|
+
%tr
|
13
|
+
%td
|
14
|
+
%td
|
15
|
+
%td
|
16
|
+
%table.report_data_function
|
17
|
+
- response_formatter = ReportFormatter.new(q, @responses)
|
18
|
+
- if q.question_type_id == :numbers
|
19
|
+
%tr
|
20
|
+
%td{:style => "font-weight:bold;"} Total
|
21
|
+
%td.table_number
|
22
|
+
= q.prefix
|
23
|
+
= response_formatter.stats(:sum)
|
24
|
+
\ #{q.suffix}
|
25
|
+
%tr
|
26
|
+
%td{:style => "font-weight:bold;"} Min
|
27
|
+
%td.table_number
|
28
|
+
= q.prefix
|
29
|
+
= response_formatter.stats(:min)
|
30
|
+
\ #{q.suffix}
|
31
|
+
%tr
|
32
|
+
%td{:style => "font-weight:bold;"} Max
|
33
|
+
%td.table_number
|
34
|
+
= q.prefix
|
35
|
+
= response_formatter.stats(:max)
|
36
|
+
\ #{q.suffix}
|
37
|
+
%tr
|
38
|
+
%td{:style => "font-weight:bold;"} Average
|
39
|
+
%td.table_number
|
40
|
+
= q.prefix
|
41
|
+
= response_formatter.stats(:average)
|
42
|
+
\ #{q.suffix}
|
43
|
+
- elsif q.pick=='any' || q.pick=='one'
|
44
|
+
= render "surveyor_gui/shared/report_data", q: q, toggle: true
|
45
|
+
%tr
|
46
|
+
%td
|
47
|
+
%td
|
48
|
+
%td
|
49
|
+
%table.report_data_functions
|
50
|
+
%tr
|
51
|
+
%td{:style => "font-weight:bold;"}
|
52
|
+
Answer
|
53
|
+
%td{:style => "font-weight:bold;"}
|
54
|
+
Count
|
55
|
+
- q.answers.is_not_comment.each do |answer|
|
56
|
+
%tr
|
57
|
+
%td
|
58
|
+
= answer.text
|
59
|
+
%td.table_number
|
60
|
+
= @responses.where(question_id: q.id, answer_id: answer.id).count
|
61
|
+
- else
|
62
|
+
= render "surveyor_gui/shared/report_data", q: q, toggle: false
|
63
|
+
= render "surveyor_gui/shared/new_line"
|
64
|
+
- elsif q.question_type_id == :file
|
65
|
+
%tr
|
66
|
+
%td
|
67
|
+
%td
|
68
|
+
%td
|
69
|
+
This question was used for file uploads.
|
70
|
+
= render "surveyor_gui/shared/new_line"
|
@@ -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)
|
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", surveyor_gui_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,9 @@
|
|
1
|
+
%tr{:class => q.surveyresponse_class(@response_sets)}
|
2
|
+
%td
|
3
|
+
|
4
|
+
%td{colspan: "2", style: q.question_type_id==:label ? "font-weight: bold;" : "" }
|
5
|
+
- if q.is_numbered? && !q.part_of_group?
|
6
|
+
= @question_no.to_s + ") #{q.text}"
|
7
|
+
- @question_no += 1
|
8
|
+
- elsif !q.repeater?
|
9
|
+
= q.text
|
@@ -0,0 +1,24 @@
|
|
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
|
+
- @responses.where(:question_id => q.id).each do |r|
|
10
|
+
- response_formatter = ReportFormatter.new(q, @responses)
|
11
|
+
%tr
|
12
|
+
%td= r.response_set.report_user_name
|
13
|
+
%td.table_number
|
14
|
+
= q.prefix
|
15
|
+
- if [:number, :date, :datetime, :time].include? q.question_type_id
|
16
|
+
= response_formatter.format_stats(r.response_value.to_f)
|
17
|
+
- else
|
18
|
+
= r.response_value
|
19
|
+
\
|
20
|
+
= q.suffix
|
21
|
+
- if q.answers.is_comment.count > 0
|
22
|
+
= render "surveyor_gui/shared/new_line"
|
23
|
+
= render "surveyor_gui/shared/pick_comments", q: q, extra_column: false
|
24
|
+
= 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 )}
|
data/config.ru
ADDED
File without changes
|
data/config/routes.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
|
3
|
+
resources :surveyforms do
|
4
|
+
member do
|
5
|
+
get 'replace_form'
|
6
|
+
get 'insert_survey_section'
|
7
|
+
get 'replace_survey_section'
|
8
|
+
get 'insert_new_question'
|
9
|
+
get 'replace_question'
|
10
|
+
get 'clone_survey'
|
11
|
+
put 'create_cloned'
|
12
|
+
patch 'create_cloned'
|
13
|
+
get 'set_default'
|
14
|
+
get 'cut_section'
|
15
|
+
get 'paste_section'
|
16
|
+
get 'cut_question'
|
17
|
+
get 'paste_question'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
resources :survey_sections do
|
22
|
+
post :sort, :on => :collection
|
23
|
+
end
|
24
|
+
|
25
|
+
match '/questions/sort', :to => 'questions#sort', :via => :post
|
26
|
+
|
27
|
+
resources :questions do
|
28
|
+
member do
|
29
|
+
get 'cut'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
resources :question_groups do
|
34
|
+
end
|
35
|
+
|
36
|
+
get '/question/render_answer_fields_partial', :to => 'questions#render_answer_fields_partial'
|
37
|
+
get '/question/render_grid_partial', :to => 'questions#render_grid_partial'
|
38
|
+
get '/question_group/render_group_inline_partial', :to => 'question_groups#render_group_inline_partial'
|
39
|
+
get '/question/render_no_picks_partial', :to => 'questions#render_no_picks_partial'
|
40
|
+
|
41
|
+
resources :dependencys do
|
42
|
+
collection do
|
43
|
+
get 'get_answers'
|
44
|
+
get 'get_question_type'
|
45
|
+
get 'get_columns'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
get '/dependency/render_dependency_conditions_partial', :to => 'dependencys#render_dependency_conditions_partial'
|
49
|
+
|
50
|
+
namespace :surveyor_gui do
|
51
|
+
resources :reports,
|
52
|
+
:only=>[
|
53
|
+
'show',
|
54
|
+
'preview',
|
55
|
+
'show_pdf'] do
|
56
|
+
member do
|
57
|
+
get 'show'
|
58
|
+
get 'preview'
|
59
|
+
get 'show_pdf'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
resources :survey, only: ['show'] do
|
63
|
+
end
|
64
|
+
resources :responses, only: ['show', 'index', 'preview'] do
|
65
|
+
member do
|
66
|
+
get 'preview'
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|