upgrade_surveyor_gui 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (291) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +44 -0
  3. data/.travis.yml +17 -0
  4. data/CHANGELOG.md +46 -0
  5. data/Gemfile +8 -0
  6. data/LICENSE +21 -0
  7. data/MIT-LICENSE +20 -0
  8. data/README.md +244 -0
  9. data/Rakefile +66 -0
  10. data/app/controllers/surveyor_controller.rb +89 -0
  11. data/app/controllers/surveyor_gui/answers_controller.rb +3 -0
  12. data/app/controllers/surveyor_gui/application_controller.rb +3 -0
  13. data/app/controllers/surveyor_gui/dependencys_controller.rb +286 -0
  14. data/app/controllers/surveyor_gui/question_groups_controller.rb +90 -0
  15. data/app/controllers/surveyor_gui/questions_controller.rb +187 -0
  16. data/app/controllers/surveyor_gui/reports_controller.rb +339 -0
  17. data/app/controllers/surveyor_gui/responses_controller.rb +41 -0
  18. data/app/controllers/surveyor_gui/survey_controller.rb +16 -0
  19. data/app/controllers/surveyor_gui/survey_sections_controller.rb +80 -0
  20. data/app/controllers/surveyor_gui/surveyforms_controller.rb +4 -0
  21. data/app/facades/report_formatter.rb +46 -0
  22. data/app/facades/report_preview_wrapper.rb +11 -0
  23. data/app/facades/report_response_generator.rb +147 -0
  24. data/app/helpers/surveyor_gui/application_helper.rb +2 -0
  25. data/app/helpers/surveyor_gui/dependencys_helper.rb +5 -0
  26. data/app/helpers/surveyor_gui/question_groups_helper.rb +3 -0
  27. data/app/helpers/surveyor_gui/questions_helper.rb +22 -0
  28. data/app/helpers/surveyor_gui/reports_helper.rb +19 -0
  29. data/app/helpers/surveyor_gui/surveyforms_helper.rb +164 -0
  30. data/app/helpers/surveyor_helper.rb +4 -0
  31. data/app/inputs/currency_input.rb +5 -0
  32. data/app/inputs/date_picker_input.rb +7 -0
  33. data/app/inputs/datetime_picker_input.rb +5 -0
  34. data/app/inputs/percent_input.rb +5 -0
  35. data/app/inputs/time_picker_input.rb +5 -0
  36. data/app/mailers/.gitkeep +0 -0
  37. data/app/models/.gitkeep +0 -0
  38. data/app/models/answer.rb +4 -0
  39. data/app/models/column.rb +3 -0
  40. data/app/models/dependency.rb +4 -0
  41. data/app/models/dependency_condition.rb +4 -0
  42. data/app/models/permitted_params_decorator.rb +80 -0
  43. data/app/models/question.rb +4 -0
  44. data/app/models/question_group.rb +4 -0
  45. data/app/models/question_group_tracker.rb +19 -0
  46. data/app/models/question_type.rb +7 -0
  47. data/app/models/response.rb +4 -0
  48. data/app/models/response_set.rb +4 -0
  49. data/app/models/row.rb +3 -0
  50. data/app/models/survey.rb +4 -0
  51. data/app/models/survey_section.rb +4 -0
  52. data/app/models/surveyform.rb +103 -0
  53. data/app/uploaders/blob_uploader.rb +48 -0
  54. data/app/views/layouts/surveyor_gui/application.html.erb +14 -0
  55. data/app/views/layouts/surveyor_gui/surveyor_gui_blank.html.erb +13 -0
  56. data/app/views/layouts/surveyor_gui/surveyor_gui_default.html.erb +17 -0
  57. data/app/views/layouts/surveyor_gui/surveyor_modified.html.erb +14 -0
  58. data/app/views/partials/_answer.html.haml +33 -0
  59. data/app/views/partials/_question.html.haml +33 -0
  60. data/app/views/partials/_question_group.html.haml +73 -0
  61. data/app/views/partials/_section.html.haml +13 -0
  62. data/app/views/surveyor/edit.html.haml +21 -0
  63. data/app/views/surveyor_gui/dependencys/_column.html.erb +1 -0
  64. data/app/views/surveyor_gui/dependencys/_dependency.html.erb +22 -0
  65. data/app/views/surveyor_gui/dependencys/_dependency_condition_fields.html.erb +48 -0
  66. data/app/views/surveyor_gui/dependencys/_form.html.erb +20 -0
  67. data/app/views/surveyor_gui/dependencys/blank.html.erb +0 -0
  68. data/app/views/surveyor_gui/dependencys/edit.html.erb +1 -0
  69. data/app/views/surveyor_gui/dependencys/new.html.erb +1 -0
  70. data/app/views/surveyor_gui/partials/_url_helpers.html.erb +5 -0
  71. data/app/views/surveyor_gui/question_groups/_form.html.erb +57 -0
  72. data/app/views/surveyor_gui/question_groups/_group_inline_field.html.erb +21 -0
  73. data/app/views/surveyor_gui/question_groups/_group_inline_fields.html.erb +25 -0
  74. data/app/views/surveyor_gui/question_groups/blank.html.erb +0 -0
  75. data/app/views/surveyor_gui/question_groups/edit.html.erb +1 -0
  76. data/app/views/surveyor_gui/question_groups/new.html.erb +1 -0
  77. data/app/views/surveyor_gui/questions/_answer_fields.html.erb +23 -0
  78. data/app/views/surveyor_gui/questions/_answer_options.html.erb +28 -0
  79. data/app/views/surveyor_gui/questions/_form.html.erb +66 -0
  80. data/app/views/surveyor_gui/questions/_grid_dropdown_columns.html.erb +10 -0
  81. data/app/views/surveyor_gui/questions/_grid_dropdown_fields.html.erb +42 -0
  82. data/app/views/surveyor_gui/questions/_grid_fields.html.erb +9 -0
  83. data/app/views/surveyor_gui/questions/_no_picks.html.erb +29 -0
  84. data/app/views/surveyor_gui/questions/_pick.html +21 -0
  85. data/app/views/surveyor_gui/questions/_picks.html.erb +12 -0
  86. data/app/views/surveyor_gui/questions/blank.html.erb +0 -0
  87. data/app/views/surveyor_gui/questions/edit.html.erb +1 -0
  88. data/app/views/surveyor_gui/questions/new.html.erb +1 -0
  89. data/app/views/surveyor_gui/reports/_graphs.html.haml +21 -0
  90. data/app/views/surveyor_gui/reports/_grid.html.haml +42 -0
  91. data/app/views/surveyor_gui/reports/_grid_dropdown.html.haml +56 -0
  92. data/app/views/surveyor_gui/reports/_repeater.html.haml +27 -0
  93. data/app/views/surveyor_gui/reports/_show_report.html.haml +33 -0
  94. data/app/views/surveyor_gui/reports/_single_question.html.haml +70 -0
  95. data/app/views/surveyor_gui/reports/show.html.erb +14 -0
  96. data/app/views/surveyor_gui/responses/_grid.html.haml +20 -0
  97. data/app/views/surveyor_gui/responses/_grid_dropdown.html.haml +20 -0
  98. data/app/views/surveyor_gui/responses/_repeater.html.haml +22 -0
  99. data/app/views/surveyor_gui/responses/_survey_results.html.haml +40 -0
  100. data/app/views/surveyor_gui/responses/index.html.haml +24 -0
  101. data/app/views/surveyor_gui/responses/show.html.haml +42 -0
  102. data/app/views/surveyor_gui/shared/_grid_comments.html.haml +10 -0
  103. data/app/views/surveyor_gui/shared/_new_line.html.haml +2 -0
  104. data/app/views/surveyor_gui/shared/_pick_comments.html.haml +15 -0
  105. data/app/views/surveyor_gui/shared/_question_number.html.haml +11 -0
  106. data/app/views/surveyor_gui/shared/_report_data.html.haml +27 -0
  107. data/app/views/surveyor_gui/shared/_stars_report_data.html.haml +14 -0
  108. data/app/views/surveyor_gui/survey_sections/_form.html.erb +13 -0
  109. data/app/views/surveyor_gui/survey_sections/blank.html.erb +0 -0
  110. data/app/views/surveyor_gui/survey_sections/edit.html.erb +1 -0
  111. data/app/views/surveyor_gui/survey_sections/new.html.erb +1 -0
  112. data/app/views/surveyor_gui/surveyforms/_form.html.erb +50 -0
  113. data/app/views/surveyor_gui/surveyforms/_question_field.html.erb +148 -0
  114. data/app/views/surveyor_gui/surveyforms/_question_group.html.erb +116 -0
  115. data/app/views/surveyor_gui/surveyforms/_question_group_fields.html.erb +3 -0
  116. data/app/views/surveyor_gui/surveyforms/_question_name_and_number.html.erb +6 -0
  117. data/app/views/surveyor_gui/surveyforms/_question_section.html.erb +15 -0
  118. data/app/views/surveyor_gui/surveyforms/_question_wrapper.html.erb +108 -0
  119. data/app/views/surveyor_gui/surveyforms/_survey_section_fields.html.erb +137 -0
  120. data/app/views/surveyor_gui/surveyforms/clone_survey.html.erb +13 -0
  121. data/app/views/surveyor_gui/surveyforms/edit.html.erb +5 -0
  122. data/app/views/surveyor_gui/surveyforms/index.html.erb +40 -0
  123. data/app/views/surveyor_gui/surveyforms/new.html.erb +1 -0
  124. data/app/views/surveyor_gui/surveyforms/show.html.erb +5 -0
  125. data/config/environment.rb +0 -0
  126. data/config/routes.rb +71 -0
  127. data/config.ru +4 -0
  128. data/db/migrate/20140307204049_add_template_to_surveys.rb +5 -0
  129. data/db/migrate/20140307235607_add_test_data_to_response_sets.rb +5 -0
  130. data/db/migrate/20140308171947_add_original_choice_to_answers.rb +5 -0
  131. data/db/migrate/20140308172118_add_blob_to_responses.rb +5 -0
  132. data/db/migrate/20140308172417_add_modifiable_to_survey_section.rb +5 -0
  133. data/db/migrate/20140308174532_add_modifiable_to_question.rb +5 -0
  134. data/db/migrate/20140308175305_add_dynamically_generate_to_questions.rb +5 -0
  135. data/db/migrate/20140311032923_add_dummy_blob_to_questions.rb +5 -0
  136. data/db/migrate/20140311160609_add_dynamic_source_to_questions.rb +5 -0
  137. data/db/migrate/20140311161714_add_report_code_to_questions.rb +5 -0
  138. data/db/migrate/20140530181134_add_is_comment_to_questions.rb +5 -0
  139. data/db/migrate/20140531012006_add_is_comment_to_answers.rb +5 -0
  140. data/db/migrate/20140531225529_create_rows.rb +9 -0
  141. data/db/migrate/20140601011151_create_columns.rb +11 -0
  142. data/db/migrate/20140602030330_add_column_id_to_answers.rb +5 -0
  143. data/db/migrate/20140603155606_add_column_id_to_responses.rb +5 -0
  144. data/db/migrate/20140606023527_add_column_id_to_dependency_conditions.rb +5 -0
  145. data/db/migrate/20140815165307_add_user_id_to_survey.rb +5 -0
  146. data/lib/assets/.gitkeep +0 -0
  147. data/lib/assets/images/addicon.png +0 -0
  148. data/lib/assets/images/datepicker.gif +0 -0
  149. data/lib/assets/images/delete.gif +0 -0
  150. data/lib/assets/images/delete.png +0 -0
  151. data/lib/assets/images/images/border.png +0 -0
  152. data/lib/assets/images/images/controls.png +0 -0
  153. data/lib/assets/images/images/loading.gif +0 -0
  154. data/lib/assets/images/images/loading_background.png +0 -0
  155. data/lib/assets/images/images/overlay.png +0 -0
  156. data/lib/assets/images/rails.png +0 -0
  157. data/lib/assets/images/star.gif +0 -0
  158. data/lib/assets/javascripts/.gitkeep +0 -0
  159. data/lib/assets/javascripts/surveyor_gui/jquery.MetaData.js +121 -0
  160. data/lib/assets/javascripts/surveyor_gui/jquery.blockUI.js +619 -0
  161. data/lib/assets/javascripts/surveyor_gui/jquery.rating.js +377 -0
  162. data/lib/assets/javascripts/surveyor_gui/jquery.validate.js +1188 -0
  163. data/lib/assets/javascripts/surveyor_gui/surveyor_add_ons.js +10 -0
  164. data/lib/assets/javascripts/surveyor_gui/surveyor_gui.js +1428 -0
  165. data/lib/assets/stylesheets/.gitkeep +0 -0
  166. data/lib/assets/stylesheets/surveyor_gui/jquery.rating.css +12 -0
  167. data/lib/assets/stylesheets/surveyor_gui/surveyor_add_ons.css +3 -0
  168. data/lib/assets/stylesheets/surveyor_gui/surveyor_gui.sass +652 -0
  169. data/lib/enumerable_extenders.rb +31 -0
  170. data/lib/generators/surveyor_gui/install_generator.rb +57 -0
  171. data/lib/generators/surveyor_gui/templates/app/assets/javascripts/surveyor_add_ons.js +2 -0
  172. data/lib/generators/surveyor_gui/templates/app/assets/javascripts/surveyor_gui_all.js +24 -0
  173. data/lib/generators/surveyor_gui/templates/app/assets/stylesheets/surveyor_add_ons.css.sass +1 -0
  174. data/lib/generators/surveyor_gui/templates/app/assets/stylesheets/surveyor_gui_all.css.sass +8 -0
  175. data/lib/generators/surveyor_gui/templates/app/helpers/surveyor_helper.rb +4 -0
  176. data/lib/generators/surveyor_gui/templates/app/models/response_set_user.rb +13 -0
  177. data/lib/generators/surveyor_gui/templates/app/views/layouts/surveyor_gui/surveyor_gui_default.html.erb +17 -0
  178. data/lib/generators/surveyor_gui/templates/config/initializers/simple_form.rb +140 -0
  179. data/lib/generators/surveyor_gui/templates/config/locales/en.yml +5 -0
  180. data/lib/surveyor_gui/engine.rb +31 -0
  181. data/lib/surveyor_gui/helpers/surveyor_helper_methods.rb +19 -0
  182. data/lib/surveyor_gui/models/answer_methods.rb +24 -0
  183. data/lib/surveyor_gui/models/column_methods.rb +43 -0
  184. data/lib/surveyor_gui/models/dependency_condition_methods.rb +53 -0
  185. data/lib/surveyor_gui/models/dependency_methods.rb +83 -0
  186. data/lib/surveyor_gui/models/question_and_group_shared_methods.rb +11 -0
  187. data/lib/surveyor_gui/models/question_group_methods.rb +55 -0
  188. data/lib/surveyor_gui/models/question_methods.rb +435 -0
  189. data/lib/surveyor_gui/models/question_type_methods.rb +493 -0
  190. data/lib/surveyor_gui/models/response_methods.rb +71 -0
  191. data/lib/surveyor_gui/models/response_set_methods.rb +56 -0
  192. data/lib/surveyor_gui/models/row_methods.rb +11 -0
  193. data/lib/surveyor_gui/models/survey_methods.rb +32 -0
  194. data/lib/surveyor_gui/models/survey_section_methods.rb +32 -0
  195. data/lib/surveyor_gui/surveyforms_controller_methods.rb +258 -0
  196. data/lib/surveyor_gui/version.rb +3 -0
  197. data/lib/surveyor_gui.rb +17 -0
  198. data/lib/tasks/.gitkeep +0 -0
  199. data/lib/tasks/surveyor_gui_tasks.rake +4 -0
  200. data/lib/templates/erb/scaffold/_form.html.erb +13 -0
  201. data/spec/controllers/surveyforms_controller_spec.rb +362 -0
  202. data/spec/controllers/surveyor_controller_spec.rb +303 -0
  203. data/spec/factories.rb +181 -0
  204. data/spec/features/create_survey_spec.rb +417 -0
  205. data/spec/features/dependencies_spec.rb +65 -0
  206. data/spec/features/make_and_take_spec.rb +187 -0
  207. data/spec/features/rearrange_survey_spec.rb +118 -0
  208. data/spec/features/ui_spec.rb +469 -0
  209. data/spec/fixtures/REDCapDemoDatabase_DataDictionary.csv +127 -0
  210. data/spec/fixtures/chinese_survey.rb +14 -0
  211. data/spec/fixtures/everything.rb +215 -0
  212. data/spec/fixtures/favorites-ish.rb +22 -0
  213. data/spec/fixtures/favorites.rb +22 -0
  214. data/spec/fixtures/feelings.rb +38 -0
  215. data/spec/fixtures/lifestyle.rb +55 -0
  216. data/spec/fixtures/numbers.rb +21 -0
  217. data/spec/fixtures/redcap_new_headers.csv +1 -0
  218. data/spec/fixtures/redcap_siblings.csv +1 -0
  219. data/spec/fixtures/redcap_whitespace.csv +1 -0
  220. data/spec/helpers/formtastic_custom_input_spec.rb +15 -0
  221. data/spec/helpers/surveyor_helper_spec.rb +116 -0
  222. data/spec/lib/common_spec.rb +37 -0
  223. data/spec/lib/parser_spec.rb +393 -0
  224. data/spec/lib/rake_kitchen_sink.rb +42 -0
  225. data/spec/lib/redcap_parser_spec.rb +129 -0
  226. data/spec/lib/unparser_spec.rb +126 -0
  227. data/spec/models/answer_spec.rb +144 -0
  228. data/spec/models/dependency_condition_spec.rb +428 -0
  229. data/spec/models/dependency_spec.rb +90 -0
  230. data/spec/models/question_group_spec.rb +66 -0
  231. data/spec/models/question_spec.rb +176 -0
  232. data/spec/models/response_set_spec.rb +452 -0
  233. data/spec/models/response_spec.rb +208 -0
  234. data/spec/models/survey_section_spec.rb +58 -0
  235. data/spec/models/survey_spec.rb +155 -0
  236. data/spec/models/surveyor_gui/question_spec.rb +60 -0
  237. data/spec/models/surveyor_gui/question_type_spec.rb +268 -0
  238. data/spec/models/validation_condition_spec.rb +98 -0
  239. data/spec/models/validation_spec.rb +64 -0
  240. data/spec/spec.opts +4 -0
  241. data/spec/spec_helper.rb +119 -0
  242. data/spec/support/scenario_outline_helper.rb +39 -0
  243. data/spec/support/shared.rb +10 -0
  244. data/spec/support/surveyforms_creation_helpers.rb +313 -0
  245. data/spec/support/surveyforms_rearrangement_helpers.rb +170 -0
  246. data/spec/support/surveyor_api_helpers.rb +15 -0
  247. data/spec/support/surveyor_ui_helpers.rb +108 -0
  248. data/spec/support/wait_for_ajax.rb +11 -0
  249. data/spec/views/questions/edit.html.erb_spec.rb +74 -0
  250. data/spec/views/surveyforms/edit.html.erb_spec.rb +126 -0
  251. data/surveyor_gui.gemspec +52 -0
  252. data/test/dummy/README.rdoc +261 -0
  253. data/test/dummy/Rakefile +7 -0
  254. data/test/dummy/app/assets/javascripts/application.js +15 -0
  255. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  256. data/test/dummy/app/controllers/application_controller.rb +3 -0
  257. data/test/dummy/app/helpers/application_helper.rb +2 -0
  258. data/test/dummy/app/mailers/.gitkeep +0 -0
  259. data/test/dummy/app/models/.gitkeep +0 -0
  260. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  261. data/test/dummy/config/application.rb +59 -0
  262. data/test/dummy/config/boot.rb +10 -0
  263. data/test/dummy/config/database.yml +25 -0
  264. data/test/dummy/config/environment.rb +5 -0
  265. data/test/dummy/config/environments/development.rb +37 -0
  266. data/test/dummy/config/environments/production.rb +67 -0
  267. data/test/dummy/config/environments/test.rb +37 -0
  268. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  269. data/test/dummy/config/initializers/inflections.rb +15 -0
  270. data/test/dummy/config/initializers/mime_types.rb +5 -0
  271. data/test/dummy/config/initializers/secret_token.rb +7 -0
  272. data/test/dummy/config/initializers/session_store.rb +8 -0
  273. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  274. data/test/dummy/config/locales/en.yml +5 -0
  275. data/test/dummy/config/routes.rb +58 -0
  276. data/test/dummy/config.ru +4 -0
  277. data/test/dummy/lib/assets/.gitkeep +0 -0
  278. data/test/dummy/log/.gitkeep +0 -0
  279. data/test/dummy/public/404.html +26 -0
  280. data/test/dummy/public/422.html +26 -0
  281. data/test/dummy/public/500.html +25 -0
  282. data/test/dummy/public/favicon.ico +0 -0
  283. data/test/dummy/script/rails +6 -0
  284. data/test/surveyor-gui_test.rb +7 -0
  285. data/test/test_helper.rb +15 -0
  286. data/tmp/cache/assets/CF0/DA0/sprockets%2Fd7d5b37686831d37c4dd75e645f5e016 +0 -0
  287. data/tmp/cache/assets/E25/4C0/sprockets%2Fde2fd9fd11c04a582cdbbe3d84a35ae6 +0 -0
  288. data/vendor/assets/stylesheets/.gitkeep +0 -0
  289. data/vendor/assets/stylesheets/custom.sass +5 -0
  290. data/vendor/plugins/.gitkeep +0 -0
  291. metadata +600 -0
@@ -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,21 @@
1
+ #surveyor
2
+ - unless (types = flash.keys.select{|k| ['notice', 'error', 'warning'].include?(k)}).blank?
3
+ .surveyor_flash
4
+ = flash_messages(types)
5
+ .close
6
+ = semantic_form_for(@response_set, :as => :r, :url => surveyor.update_my_survey_path, :html => {:method => :put, :id => "survey_form", :class => @survey.custom_class}) do |f|
7
+
8
+ = hidden_field_tag :surveyor_javascript_enabled, false
9
+
10
+ = render 'partials/section_menu' # unless @sections.size < 3
11
+ .survey_title= @survey.translation(I18n.locale)[:title]
12
+ .previous_section= previous_section
13
+ = render 'partials/dependents' unless @dependents.empty?
14
+ = render "/partials/section", :f => f
15
+ .next_section= next_section
16
+ %br
17
+
18
+ :javascript
19
+ $(document).ready(function() {
20
+ $("input#surveyor_javascript_enabled").val(true);
21
+ });
@@ -0,0 +1 @@
1
+ <%= c.input :column_id, label: false, :collection => d.object.question_group ? d.object.question_group.columns : [["",""]], wrapper_html: {class: "fl not_first"} %>
@@ -0,0 +1,22 @@
1
+ <%= f.simple_fields_for :dependency do |d| %>
2
+ <%= d.hidden_field :question_id %>
3
+ <%= d.hidden_field :question_group_id %>
4
+ <%= d.hidden_field :rule %>
5
+ <div>
6
+ Show the question, "<%= @this_question %>", when the following conditions are true:<br /><br />
7
+ <table>
8
+ <thead>
9
+ <tr>
10
+ <td>Question</td><td>Condition</td><td>Answer</td>
11
+ </tr>
12
+ </thead>
13
+ <tbody id="dependency_conditions_partial" data-question_id="<%= @question.id.to_s %>" data-dependency_id="<%= d.object.id.to_s %>"></tbody>
14
+ </table>
15
+ <p class="floatdown2 add_condition">
16
+ Add a Condition <%= image_tag 'addicon.png', :border => 0 %>
17
+ </p>
18
+ </div>
19
+ <% end -%>
20
+ <br /><br />
21
+ <%= f.button :submit, 'Save Changes', :id=>'dependency_submit' %>
22
+
@@ -0,0 +1,48 @@
1
+ <%= simple_fields_for @question_or_group do |f| %>
2
+ <%= f.simple_fields_for :dependency do |d| %>
3
+ <%= d.simple_fields_for :dependency_conditions do |c| %>
4
+ <tr style='display:block;'>
5
+ <td colspan='3' talign='center'>
6
+ <%= c.input :join_operator, :label=> false, :collection => [['And','and'],['Or','or']], :include_blank => false %>
7
+ </td>
8
+ </tr>
9
+ <tr>
10
+ <%= c.hidden_field :rule_key %>
11
+ <%= c.hidden_field :id %>
12
+ <td>
13
+ <%= c.input :question_id, :collection => @controlling_questions, :label=>false, :include_blank => false, :input_html => {:style=>"max-width:38em;"} %>
14
+ <div class="column_id">
15
+ <%= render "column", c: c, d: d %>
16
+ </div>
17
+ </td>
18
+ <td>
19
+ <%= c.input :operator, :collection => @operators, :label=>false, :include_blank => false %>
20
+ </td>
21
+ <td class='answer_field'>
22
+ <div class="dependency_text">
23
+ <%= c.input :string_value, :label=>false, :size=>8 %>
24
+ </div>
25
+ <div class="dependency_text_box">
26
+ <%= c.input :text_value, :label=>false, :size=>8 %>
27
+ </div>
28
+ <div class="dependency_float">
29
+ <%= c.input :float_value, :label=>false, :size=>8 %>
30
+ </div>
31
+ <div class="dependency_date">
32
+ <%= c.input :datetime_value, :label=>false, :size=>8 %>
33
+ </div>
34
+ <div class="dependency_star">
35
+ <%= c.input :integer_value, label: false, :collection => [[nil,1],[nil,2],[nil,3],[nil,4],[nil,5]], :as => :radio_buttons, :input_html=>{:class=>'star'} %>
36
+ </div>
37
+ <div class="dependency_pick_multiple_choice">
38
+ <%= c.input :answer_id, :collection => Answer.where('question_id=?',c.object.question_id).map{|a| [a.text,a.id]}, :label=>false, :include_blank => false, :input_html => {:style=>"max-width:18em;"} %>
39
+ </div>
40
+ </td>
41
+ <td>
42
+ <%= link_to_remove_tbody "remove", c %>
43
+ </td>
44
+ </tr>
45
+
46
+ <% end -%>
47
+ <% end -%>
48
+ <% end -%>
@@ -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,5 @@
1
+ <div id="no_picks_partial_url" data-render_no_picks_partial_url="<%= surveyor_gui.render_no_picks_partial_questions_url%>"></div>
2
+ <div id="answer_fields_partial_url" data-answer_fields_partial_url="<%= surveyor_gui.render_answer_fields_partial_questions_url%>"></div>
3
+ <div id="render_grid_partial_url" data-render_grid_partial_url="<%= surveyor_gui.render_grid_partial_questions_url%>"></div>
4
+ <div id="render_group_inline_partial_url" data-render_group_inline_partial_url="<%= surveyor_gui.render_group_inline_partial_question_groups_url%>"></div>
5
+
@@ -0,0 +1,57 @@
1
+ <div class="question_group_editor shadebox">
2
+ <%= render "surveyor_gui/partials/url_helpers" %>
3
+ <h1 ><%= @title %></h1>
4
+ <%= simple_form_for @question_group do |qg| %>
5
+ <div class = 'questions'>
6
+ <%= qg.error_messages %>
7
+ <%= qg.hidden_field :id %>
8
+ <%= qg.hidden_field :display_type %>
9
+ <%= qg.hidden_field :question_id %>
10
+ <%= qg.input :survey_section_id, as: :hidden, input_html: { value: @survey_section_id }%>
11
+
12
+ <%= qg.label :Question, :input_html=>{:size=>'15'} %>
13
+ <%= qg.input :text , :input_html=>{:size=>'55'}, :label => false%>
14
+ <span class='fl'>
15
+ <strong>Mandatory?</strong>
16
+ </span>
17
+ <%= qg.input :is_mandatory, :label => false, :as=>:boolean, :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
+ <%= qg.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
+ <%= qg.input :question_type_id,
29
+ collection: question_type_subset([:pick_any]) ,
30
+ :as => :radio_buttons , :wrapper_html=>{:size=>'60'}, :label => false%>
31
+ </span>
32
+ <div style="clear:both"></div>
33
+ <span class="question_type_grid">
34
+ <%= qg.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
+ <%= qg.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
+ <%= qg.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 "group_inline_fields", f: qg %>
52
+ </div>
53
+ </div>
54
+ <%= qg.button :submit, 'Save Changes', :id=>'question_group_submit' %>
55
+ <% end -%>
56
+ <% 20.times do -%><br/><% end -%>
57
+ </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 -%>
@@ -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
+