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,20 @@
|
|
1
|
+
<div class="shadebox">
|
2
|
+
<h1 ><%= @title %></h1>
|
3
|
+
<% if @question.part_of_group? -%>
|
4
|
+
<%= simple_form_for @question.question_group, :url => dependencys_path+'/'+@question.id.to_s do |g| %>
|
5
|
+
<%= g.error_messages %>
|
6
|
+
<div class = 'dependency_editor'>
|
7
|
+
<%= render "dependency", f: g %>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
10
|
+
<% else -%>
|
11
|
+
<%= simple_form_for @question, :url => dependencys_path+'/'+@question.id.to_s do |q| %>
|
12
|
+
<%= q.error_messages %>
|
13
|
+
<%= q.hidden_field :survey_section_id %>
|
14
|
+
<div class = 'dependency_editor'>
|
15
|
+
<%= render "dependency", f: q %>
|
16
|
+
</div>
|
17
|
+
<% end %>
|
18
|
+
<% end -%>
|
19
|
+
<% 24.times.each do %><br/><% end -%>
|
20
|
+
</div>
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'form' %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'form' %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>SurveyorGui</title>
|
5
|
+
<%= stylesheet_link_tag "application", :media => "all" %>
|
6
|
+
<%= javascript_include_tag "application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>SurveyorGui</title>
|
5
|
+
<%= stylesheet_link_tag "surveyor_gui_all", :media => "all" %>
|
6
|
+
<%= javascript_include_tag "surveyor_gui_all" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<%= yield %>
|
11
|
+
</body>
|
12
|
+
</html>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>SurveyorGui</title>
|
5
|
+
<%= stylesheet_link_tag "surveyor_gui_all", :media => "all" %>
|
6
|
+
<%= javascript_include_tag "surveyor_gui_all" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<% flash.each do |key, value| %>
|
11
|
+
<%= content_tag(:div, value, :class => "flash #{key}") %>
|
12
|
+
<% end %>
|
13
|
+
<%= yield %>
|
14
|
+
|
15
|
+
</body>
|
16
|
+
</html>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
6
|
+
<title>Survey: <%= controller.action_name %></title>
|
7
|
+
<%= surveyor_includes %>
|
8
|
+
<%= stylesheet_link_tag('surveyor_add_ons') +
|
9
|
+
javascript_include_tag('surveyor_add_ons')%>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<%= yield %>
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
-# TODO: disabled
|
2
|
+
- rg ||= nil
|
3
|
+
- r = response_for(@response_set, q, a, rg)
|
4
|
+
- i = response_idx(q.pick != "one") # argument will be false (don't increment i) if we're on radio buttons
|
5
|
+
- disabled = defined?(disableFlag) ? disableFlag : false
|
6
|
+
= f.semantic_fields_for i, r do |ff|
|
7
|
+
= ff.input :question_id, :as => :quiet unless q.pick == "one" # don't repeat question_id if we're on radio buttons
|
8
|
+
= ff.input :api_id, :as => :quiet unless q.pick == "one"
|
9
|
+
= ff.input :response_group, :input_html => { :value => rg }, :as => :quiet if q.pick != "one" && g && g.display_type == "repeater"
|
10
|
+
- case q.pick
|
11
|
+
- when "one"
|
12
|
+
= ff.input :answer_id, :as => :surveyor_radio, :collection => [[a.text_for(nil, @render_context, I18n.locale), a.id]], :label => false, :input_html => {:class => a.css_class, :disabled => disabled}, :response_class => a.response_class
|
13
|
+
- when "any"
|
14
|
+
= ff.input :answer_id, :as => :surveyor_check_boxes, :collection => [[a.text_for(nil, @render_context, I18n.locale), a.id]], :label => false, :input_html => {:class => a.css_class, :disabled => disabled}, :response_class => a.response_class
|
15
|
+
- when "none"
|
16
|
+
- if %w(date datetime time float integer string text).include? a.response_class
|
17
|
+
= ff.input :answer_id, :as => :quiet, :input_html => {:class => a.css_class, :value => a.id}
|
18
|
+
= ff.input rc_to_attr(a.response_class),
|
19
|
+
:as => rc_to_as(a.response_class),
|
20
|
+
:label => a.text_for(:pre, @render_context, I18n.locale).blank? ? false : a.text_for(:pre, @render_context, I18n.locale),
|
21
|
+
:hint => a.text_for(:post, @render_context, I18n.locale),
|
22
|
+
:input_html => generate_pick_none_input_html(r.to_formatted_s, a.default_value_for(@render_context, I18n.locale), a.css_class, a.response_class, disabled, a.input_mask, a.input_mask_placeholder)
|
23
|
+
- elsif a.response_class=='blob'
|
24
|
+
= ff.input :answer_id, :as => :quiet, :input_html => {:class => a.css_class, :value => a.id}
|
25
|
+
= ff.input :blob, :as => :quiet
|
26
|
+
= ff.input :blob, :as => :file, :label => false, :input_html => {"data-object-class"=>ff.object.class.name, "data-object-id"=>ff.object.id, "data-response_set_id" => @response_set.id, :required=>q.mandatory?}
|
27
|
+
.filename_with_link{:data=>{'image-path'=>'#{image_path("delete.png")}'}}
|
28
|
+
- if !ff.object.blob_identifier.blank?
|
29
|
+
current file is:
|
30
|
+
= link_to ff.object.blob_identifier, ff.object.blob_url, :target=>'_blank'
|
31
|
+
- else
|
32
|
+
= a.text_for(nil, @render_context, I18n.locale)
|
33
|
+
%span.help= a.help_text_for(@render_context, I18n.locale) unless g && g.display_type == "grid"
|
@@ -0,0 +1,33 @@
|
|
1
|
+
-# TODO: js for slider
|
2
|
+
- rg ||= nil
|
3
|
+
- renderer = q.renderer(g ||= nil)
|
4
|
+
- disabled = defined?(disableFlag) ? disableFlag : false
|
5
|
+
- unless q.display_type == "hidden"
|
6
|
+
= f.inputs q_text(q, @render_context, I18n.locale), :id => rg ? "q_#{q.id}_#{rg}" : "q_#{q.id}", :class => "q_#{renderer} #{q.css_class(@response_set)}" do
|
7
|
+
%span.help= q.help_text_for(@render_context, I18n.locale)
|
8
|
+
- case renderer
|
9
|
+
- when :image, :label, :default_label, :inline_label, :repeater_label
|
10
|
+
- when :dropdown, :inline_dropdown, :default_dropdown, :slider, :repeater_dropdown, :stars
|
11
|
+
- r = response_for(@response_set, q, nil, rg)
|
12
|
+
- i = response_idx
|
13
|
+
= f.semantic_fields_for i, r do |ff|
|
14
|
+
= ff.input :question_id, :as => :quiet
|
15
|
+
= ff.input :response_group, :as => :quiet, :input_html => { :value => rg } if g && g.display_type == "repeater"
|
16
|
+
= ff.input :api_id, :as => :quiet
|
17
|
+
-# the next three lines add for sureyor_gui
|
18
|
+
- if renderer==:stars
|
19
|
+
= ff.input :integer_value, :as => :radio, :collection => [[nil,1],[nil,2],[nil,3],[nil,4],[nil,5]], :include_blank => (renderer != :slider), :label => q.text, :input_html => { :disabled => disabled }
|
20
|
+
= ff.input :answer_id, :as => :quiet, :value => q.answers.first.id
|
21
|
+
- else
|
22
|
+
= ff.input :answer_id, :as => :select, :collection => q.answers.map{|a| [a.text, a.id]}, :include_blank => (renderer != :slider), :label => q.text, :input_html => { :disabled => disabled }
|
23
|
+
- else # :default, :inline, :inline_default
|
24
|
+
- if q.pick == "one"
|
25
|
+
- r = response_for(@response_set, q, nil, rg)
|
26
|
+
- i = response_idx # increment the response index since the answer partial skips for q.pick == one
|
27
|
+
= f.semantic_fields_for i, r do |ff|
|
28
|
+
= ff.input :question_id, :as => :quiet
|
29
|
+
= ff.input :response_group, :as => :quiet, :value => rg if g && g.display_type == "repeater"
|
30
|
+
= ff.input :api_id, :as => :quiet
|
31
|
+
- q.answers.each do |a|
|
32
|
+
- next if (q.pick == "one" or q.pick == "any") and disabled and @response_set.responses.where( :question_id => q.id, :answer_id => a.id).empty?
|
33
|
+
= render a.custom_renderer || '/partials/answer', :q => q, :a => a, :f => f, :rg => rg, :g => g, :disableFlag => disabled
|
@@ -0,0 +1,73 @@
|
|
1
|
+
- renderer = g.renderer
|
2
|
+
- unless g.display_type == "hidden"
|
3
|
+
= f.inputs "#{next_question_number(g)}#{g.text_for(@render_context, I18n.locale)}", :id => "g_#{g.id}", :class => "g_#{renderer} #{g.css_class(@response_set)}" do
|
4
|
+
%li.help= g.help_text_for(@render_context, I18n.locale)
|
5
|
+
- case renderer
|
6
|
+
- when :grid
|
7
|
+
- if qs.first.question_type_id == :grid_dropdown
|
8
|
+
%li
|
9
|
+
%table
|
10
|
+
%col.pre
|
11
|
+
- g.columns.each do |column|
|
12
|
+
%col{:class => cycle("odd", "even")}
|
13
|
+
%col.pre
|
14
|
+
%col.post
|
15
|
+
%tbody
|
16
|
+
- g.columns.each_slice(10) do |ten_columns|
|
17
|
+
%tr
|
18
|
+
%th
|
19
|
+
- ten_columns.each do |column|
|
20
|
+
%th
|
21
|
+
= column.text_for(nil, @render_context, I18n.locale)
|
22
|
+
- qs.each_with_index do |q, i|
|
23
|
+
%tr{:id => "q_#{q.id}", :class => "q_#{renderer} #{q.css_class(@response_set)}"}
|
24
|
+
%td
|
25
|
+
= q.text_for(:pre, @render_context, I18n.locale)
|
26
|
+
- ten_columns.each_with_index do |column, i|
|
27
|
+
%td
|
28
|
+
- r = response_for(@response_set, q, nil, nil, column.id)
|
29
|
+
- i = response_idx # increment the response index since the answer partial skips for q.pick == one
|
30
|
+
= f.semantic_fields_for i, r do |ff|
|
31
|
+
= ff.input :question_id, :as => :quiet
|
32
|
+
= ff.input :api_id, :as => :quiet
|
33
|
+
= ff.input :column_id, :value => column.id, :as => :quiet
|
34
|
+
= ff.input :answer_id, :as => :select, :collection => q.answers.where('column_id=?',column.id).map{|a| [a.text, a.id]}, :label => false, :response_class => "answer"
|
35
|
+
- else
|
36
|
+
%li
|
37
|
+
%table
|
38
|
+
%col.pre
|
39
|
+
- qs.first.answers.each do |a|
|
40
|
+
%col{:class => cycle("odd", "even")}
|
41
|
+
%col.post
|
42
|
+
%tbody
|
43
|
+
- qs.each_slice(10) do |ten_questions| # header row every 10
|
44
|
+
%tr
|
45
|
+
%th
|
46
|
+
- ten_questions.first.answers.each do |a|
|
47
|
+
%th
|
48
|
+
= a.text_for(nil, @render_context, I18n.locale)
|
49
|
+
%span.help= a.help_text_for(@render_context, I18n.locale)
|
50
|
+
%th
|
51
|
+
- ten_questions.each_with_index do |q, i|
|
52
|
+
%tr{:id => "q_#{q.id}", :class => "q_#{renderer} #{q.css_class(@response_set)}"}
|
53
|
+
%th
|
54
|
+
= q.text_for(:pre, @render_context, I18n.locale)
|
55
|
+
= q.help_text_for(@render_context, I18n.locale)
|
56
|
+
- if q.pick == "one"
|
57
|
+
- r = response_for(@response_set, q, nil, g)
|
58
|
+
- i = response_idx # increment the response index since the answer partial skips for q.pick == one
|
59
|
+
= f.semantic_fields_for i, r do |ff|
|
60
|
+
= ff.input :question_id, :as => :quiet
|
61
|
+
= ff.input :api_id, :as => :quiet
|
62
|
+
- q.answers.each do |a|
|
63
|
+
%td= render(a.custom_renderer || '/partials/answer', :g => g, :q => q, :a => a, :f => f) unless q.display_type == "label"
|
64
|
+
%th= q.text_for(:post, @render_context, I18n.locale)
|
65
|
+
- when :repeater
|
66
|
+
- (@response_set.count_group_responses(qs) + 1).times do |rg|
|
67
|
+
%li
|
68
|
+
- qs.each do |q|
|
69
|
+
= render q.custom_renderer || "/partials/question", :g => g, :rg => rg, :q => q, :f => f
|
70
|
+
= submit_tag("+ add row", :name => "section[#{@section.id}][g_#{g.id}]", :class => "add_row")
|
71
|
+
- else # :inline
|
72
|
+
- qs.each do |q|
|
73
|
+
= render q.custom_renderer || "/partials/question", :g => g, :q => q, :f => f
|
@@ -0,0 +1,13 @@
|
|
1
|
+
= div_for @section, :class => @section.custom_class do
|
2
|
+
%span.title= @section.translation(I18n.locale)[:title]
|
3
|
+
- qs ||= []
|
4
|
+
- (questions = @section.questions).each_with_index do |q, i|
|
5
|
+
- if q.part_of_group?
|
6
|
+
- qs << q if q.is_comment != true # gather up the group questions
|
7
|
+
- if (i+1 >= questions.size) or (q.question_group_id != questions[i+1].question_group_id)
|
8
|
+
- # this is the last question of the section, or the group
|
9
|
+
= render q.question_group.custom_renderer || "/partials/question_group", :g => q.question_group, :qs => qs, :f => f
|
10
|
+
- qs = []
|
11
|
+
= render q.custom_renderer || "/partials/question", :q => q, :f => f if q.is_comment == true
|
12
|
+
- else # gather up the group questions
|
13
|
+
= render q.custom_renderer || "/partials/question", :q => q, :f => f
|
@@ -0,0 +1,56 @@
|
|
1
|
+
<div class="question_group_editor shadebox">
|
2
|
+
<h1 ><%= @title %></h1>
|
3
|
+
<%= simple_form_for @question_group do |qg| %>
|
4
|
+
<div class = 'questions'>
|
5
|
+
<%= qg.error_messages %>
|
6
|
+
<%= qg.hidden_field :id %>
|
7
|
+
<%= qg.hidden_field :display_type %>
|
8
|
+
<%= qg.hidden_field :question_id %>
|
9
|
+
<%= qg.hidden_field :survey_section_id, value: @survey_section_id %>
|
10
|
+
|
11
|
+
<%= qg.label :Question, :input_html=>{:size=>'15'} %>
|
12
|
+
<%= qg.input :text , :input_html=>{:size=>'55'}, :label => false%>
|
13
|
+
<span class='fl'>
|
14
|
+
<strong>Mandatory?</strong>
|
15
|
+
</span>
|
16
|
+
<%= qg.input :is_mandatory, :label => false, :as=>:boolean, :wrapper_html=>{:class=>'fl notfirst'}%>
|
17
|
+
<br />
|
18
|
+
<br />
|
19
|
+
<strong>Question Type</strong><br/>
|
20
|
+
<div class="question_type">
|
21
|
+
<span class="question_type_grid1">
|
22
|
+
<%= qg.input :question_type_id,
|
23
|
+
collection: question_type_subset([:pick_one]) ,
|
24
|
+
:as => :radio_buttons , :wrapper_html=>{:size=>'60'}, :label => false%>
|
25
|
+
</span>
|
26
|
+
<span class="question_type_grid1">
|
27
|
+
<%= qg.input :question_type_id,
|
28
|
+
collection: question_type_subset([:pick_any]) ,
|
29
|
+
:as => :radio_buttons , :wrapper_html=>{:size=>'60'}, :label => false%>
|
30
|
+
</span>
|
31
|
+
<div style="clear:both"></div>
|
32
|
+
<span class="question_type_grid">
|
33
|
+
<%= qg.input :question_type_id,
|
34
|
+
collection: question_type_subset([:dropdown, :string, :number, :stars, :label, :box]) ,
|
35
|
+
:as => :radio_buttons , :wrapper_html=>{:size=>'60'}, :label => false%>
|
36
|
+
</span>
|
37
|
+
<span class="question_type_grid">
|
38
|
+
<%= qg.input :question_type_id,
|
39
|
+
collection: question_type_subset([:date, :datetime, :time, :slider, :group_default ]) ,
|
40
|
+
:as => :radio_buttons , :wrapper_html=>{:size=>'60'}, :label => false%>
|
41
|
+
</span>
|
42
|
+
<span class="question_type_grid">
|
43
|
+
<%= qg.input :question_type_id,
|
44
|
+
collection: question_type_subset([:file, :grid_one, :grid_any, :grid_dropdown, :group_inline, :repeater]) ,
|
45
|
+
:as => :radio_buttons , :wrapper_html=>{:size=>'60'}, :label => false %>
|
46
|
+
</span>
|
47
|
+
</div>
|
48
|
+
<br />
|
49
|
+
<div id="answer_choice">
|
50
|
+
<%= render "group_inline_fields", f: qg %>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
<%= qg.button :submit, 'Save Changes', :id=>'question_group_submit' %>
|
54
|
+
<% end -%>
|
55
|
+
<% 20.times do -%><br/><% end -%>
|
56
|
+
</div>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%= simple_fields_for :question_group, @question_group do |qg| %>
|
2
|
+
<div class="sortable_group_questions" id="sortable_question<%= @survey_section_id.to_s %>">
|
3
|
+
<%= qg.simple_fields_for :questions do |q| %>
|
4
|
+
<%= div_for(q.object, class: "group_inline_question") do %>
|
5
|
+
<div class="handle"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span></div>
|
6
|
+
<%= q.hidden_field :survey_section_id, value: @survey_section_id %>
|
7
|
+
<%= q.hidden_field :id %>
|
8
|
+
<%= q.input :text, label: false, as: :string, wrapper_html:{class: "question"} %>
|
9
|
+
<%= q.input :question_type_id, label: false, collection: QuestionType.all.map{|t|[t.text, t.id]}[0..13].uniq.select{|c| [:box,:number,:date,:string,:dropdown,:pick_one,:pick_any, :slider, :stars, :file].include? c[1]}, wrapper_html:{class: "question"} %>
|
10
|
+
<%= q.input :answers_textbox, label: false, as: :text, wrapper_html:{class: "question group_answers_textbox"} %>
|
11
|
+
|
12
|
+
<%= q.hidden_field :display_order %>
|
13
|
+
<%= q.hidden_field :display_type %>
|
14
|
+
<%= q.hidden_field :pick %>
|
15
|
+
<span class="delete_group_inline_question">
|
16
|
+
<%= link_to_remove_fields "remove", q, ".group_inline_question" %>
|
17
|
+
</span>
|
18
|
+
<% end -%>
|
19
|
+
<% end -%>
|
20
|
+
</div>
|
21
|
+
<% end -%>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%= simple_fields_for :question_group, @question_group do |qg| %>
|
2
|
+
<%= qg.hidden_field :id %>
|
3
|
+
<%= qg.hidden_field :display_type, value: "inline" %>
|
4
|
+
<div class="group_inline">
|
5
|
+
<div class="group_inline_header">
|
6
|
+
<span class="handle"></span>
|
7
|
+
<span>
|
8
|
+
Sub Question
|
9
|
+
</span>
|
10
|
+
<span>
|
11
|
+
Question Type
|
12
|
+
</span>
|
13
|
+
<span>
|
14
|
+
Possible Answers
|
15
|
+
</span>
|
16
|
+
</div>
|
17
|
+
<%= render "group_inline_field", qg: qg %>
|
18
|
+
<div class="add_question">
|
19
|
+
<span></span>
|
20
|
+
<span>
|
21
|
+
Add Question <%= image_tag("addicon.png", class:"add_group_inline_question") %>
|
22
|
+
</span>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
<% end -%>
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'form' %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'form' %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<strong>Possible Answers:</strong> enter each choice on a separate line.
|
2
|
+
<%= simple_fields_for 'question', @questions do |f| %>
|
3
|
+
<%= f.input :answers_textbox, :as => :text, :wrapper_html => {:class=>'answers_collection'}, :label => false %>
|
4
|
+
<!-- <%= f.simple_fields_for :answers do |a| %>
|
5
|
+
<%= div_for(a.object) do %>
|
6
|
+
<div id='original_choice', data-original_choice="<%= a.object.original_choice %>"></div>
|
7
|
+
<div class="fields vertical_collection" style='display: table;'>
|
8
|
+
<span class='fl ui-icon ui-icon-arrowthick-2-n-s answer_handle'>
|
9
|
+
Move
|
10
|
+
</span>
|
11
|
+
<%= a.input :text, :as => :string, :label => false, :required => false, :wrapper_html=>{:class=>'fl notfirst'}%>
|
12
|
+
<%= a.hidden_field :display_order %>
|
13
|
+
<%= a.hidden_field :id %>
|
14
|
+
<span class="fl notfirst">
|
15
|
+
<%= link_to_remove_fields "remove", a %>
|
16
|
+
</span>
|
17
|
+
</div>
|
18
|
+
<% end %>
|
19
|
+
<% end -%>
|
20
|
+
-->
|
21
|
+
|
22
|
+
<%= render "answer_options", f: f %>
|
23
|
+
<% end -%>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<br/>
|
2
|
+
<%= f.input :omit_text,
|
3
|
+
label: "add a choice for",
|
4
|
+
hint: "will uncheck all other choices",
|
5
|
+
placeholder: "none of the above",
|
6
|
+
as: :string,
|
7
|
+
wrapper_html: {class: 'omit_text fl'}
|
8
|
+
%>:
|
9
|
+
<%= f.input_field :omit, label: false, as: :boolean %>
|
10
|
+
<br/><br/><br/>
|
11
|
+
<%= f.input :other_text,
|
12
|
+
label: "add a choice for",
|
13
|
+
hint: "user determines choice",
|
14
|
+
placeholder: "Other",
|
15
|
+
as: :string,
|
16
|
+
wrapper_html: {class: 'other_text fl'}
|
17
|
+
%>:
|
18
|
+
<%= f.input_field :other, label: false, as: :boolean %>
|
19
|
+
<br/><br/><br/>
|
20
|
+
<%= f.input :comments_text,
|
21
|
+
label: "at the bottom of questions, add",
|
22
|
+
hint: "box for notes/comments",
|
23
|
+
placeholder: "Comments",
|
24
|
+
as: :string,
|
25
|
+
wrapper_html: {class: 'comments_text fl'}
|
26
|
+
%>:
|
27
|
+
<%= f.input_field :comments, label: false, as: :boolean %>
|
28
|
+
|
@@ -0,0 +1,65 @@
|
|
1
|
+
<div class="question_editor shadebox">
|
2
|
+
<h1 ><%= @title %></h1>
|
3
|
+
<%= simple_form_for @question do |f| %>
|
4
|
+
<div class = 'questions'>
|
5
|
+
<%= f.error_messages %>
|
6
|
+
<%= f.hidden_field :id %>
|
7
|
+
<%= f.hidden_field :survey_section_id %>
|
8
|
+
<%= f.hidden_field :display_order %>
|
9
|
+
<%= f.hidden_field :pick %>
|
10
|
+
<%= f.hidden_field :display_type %>
|
11
|
+
<%= f.hidden_field :modifiable %>
|
12
|
+
<%= f.hidden_field :question_group_id %>
|
13
|
+
|
14
|
+
<%= f.label :Question, :input_html=>{:size=>'15'} %>
|
15
|
+
<%= f.input :text , :label => false, :input_html=>{:size=>'55', value: adjusted_text} %>
|
16
|
+
<span class='fl'><strong>Mandatory?</strong></span>
|
17
|
+
<%= f.input :is_mandatory, :label => false, :wrapper_html=>{:class=>'fl notfirst'}%>
|
18
|
+
<br />
|
19
|
+
<br />
|
20
|
+
<strong>Question Type</strong><br/>
|
21
|
+
<div class="question_type">
|
22
|
+
<span class="question_type_grid1">
|
23
|
+
<%= f.input :question_type_id,
|
24
|
+
collection: question_type_subset([:pick_one]) ,
|
25
|
+
:as => :radio_buttons , :wrapper_html=>{:size=>'60'}, :label => false%>
|
26
|
+
</span>
|
27
|
+
<span class="question_type_grid1">
|
28
|
+
<%= f.input :question_type_id,
|
29
|
+
collection: question_type_subset([:pick_any]) ,
|
30
|
+
:as => :radio_buttons , :wrapper_html=>{:size=>'60'}, :label => false%>
|
31
|
+
</span>
|
32
|
+
<br />
|
33
|
+
<span class="question_type_grid">
|
34
|
+
<%= f.input :question_type_id,
|
35
|
+
collection: question_type_subset([:dropdown, :string, :number, :stars, :label, :box]) ,
|
36
|
+
:as => :radio_buttons , :wrapper_html=>{:size=>'60'}, :label => false%>
|
37
|
+
</span>
|
38
|
+
<span class="question_type_grid">
|
39
|
+
<%= f.input :question_type_id,
|
40
|
+
collection: question_type_subset([:date, :datetime, :time, :slider, :group_default ]) ,
|
41
|
+
:as => :radio_buttons , :wrapper_html=>{:size=>'60'}, :label => false%>
|
42
|
+
</span>
|
43
|
+
<span class="question_type_grid">
|
44
|
+
<%= f.input :question_type_id,
|
45
|
+
collection: question_type_subset([:file, :grid_one, :grid_any, :grid_dropdown, :group_inline, :repeater]) ,
|
46
|
+
:as => :radio_buttons , :wrapper_html=>{:size=>'60'}, :label => false %>
|
47
|
+
</span>
|
48
|
+
</div>
|
49
|
+
<br />
|
50
|
+
<div id="answer_choice">
|
51
|
+
<%= render 'picks', :f => f %>
|
52
|
+
</div>
|
53
|
+
<div id="number_questions"></div>
|
54
|
+
|
55
|
+
<div id="report_code" style="display:none">
|
56
|
+
<br />
|
57
|
+
<%= f.input :report_code, :label=>'Report Code', :label_html=>{:style=>'width:10em;'},:hint=>'Use this code to uniquely identify application data driven questions for reporting.' %>
|
58
|
+
<br />
|
59
|
+
</div>
|
60
|
+
<br />
|
61
|
+
</div>
|
62
|
+
<%= f.button :submit, 'Save Changes', :id=>'question_submit' %>
|
63
|
+
<% end %>
|
64
|
+
<% 20.times do -%><br/><% end -%>
|
65
|
+
</div>
|