fe 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (402) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +4 -4
  3. data/app/assets/config/fe/manifest.js +3 -0
  4. data/app/assets/config/manifest.js +3 -0
  5. data/app/assets/javascripts/application.js.erb +1 -1
  6. data/app/assets/javascripts/fe/admin.js +0 -1
  7. data/app/assets/javascripts/fe/fe.admin.js +2 -6
  8. data/app/assets/javascripts/fe/{fe.common.js → fe.common.js.erb} +14 -7
  9. data/app/assets/javascripts/fe/fe.public.js +1 -2
  10. data/app/assets/javascripts/fe/{fe.public.nojquery.js → fe.public.nojquery.js.erb} +152 -76
  11. data/app/assets/javascripts/fe/jquery.html5_upload.js +258 -0
  12. data/app/assets/stylesheets/fe/fe.screen.css.scss.erb +22 -1
  13. data/app/assets/stylesheets/fe/validation.css +5 -1
  14. data/app/controllers/{fe/concerns → concerns/fe}/admin/question_sheets_controller_concern.rb +15 -16
  15. data/app/controllers/concerns/fe/answer_pages_controller_concern.rb +131 -0
  16. data/app/controllers/{fe/concerns → concerns/fe}/answer_sheets_controller_concern.rb +14 -6
  17. data/app/controllers/{fe/concerns → concerns/fe}/application_controller_concern.rb +3 -3
  18. data/app/controllers/fe/admin/elements_controller.rb +46 -24
  19. data/app/controllers/fe/admin/email_templates_controller.rb +5 -5
  20. data/app/controllers/fe/admin/question_pages_controller.rb +8 -8
  21. data/app/controllers/fe/reference_pages_controller.rb +11 -11
  22. data/app/controllers/fe/reference_sheets_controller.rb +4 -4
  23. data/app/controllers/fe/references_controller.rb +19 -19
  24. data/app/controllers/fe/submit_pages_controller.rb +5 -5
  25. data/app/helpers/fe/answer_pages_helper.rb +1 -1
  26. data/app/helpers/fe/application_helper.rb +3 -3
  27. data/app/jobs/fe/update_reference_sheet_visibility_job.rb +11 -0
  28. data/app/mailers/fe/notifier.rb +4 -4
  29. data/app/models/answer_sheet.rb +1 -1
  30. data/app/models/application_record.rb +3 -0
  31. data/app/models/{fe/concerns → concerns/fe}/answer_concern.rb +2 -2
  32. data/app/models/{fe/concerns → concerns/fe}/answer_pages_presenter_concern.rb +6 -5
  33. data/app/models/concerns/fe/answer_sheet_concern.rb +125 -0
  34. data/app/models/{fe/concerns → concerns/fe}/choice_field_concern.rb +41 -23
  35. data/app/models/fe/address.rb +2 -2
  36. data/app/models/fe/answer.rb +1 -1
  37. data/app/models/fe/answer_sheet.rb +1 -1
  38. data/app/models/fe/answer_sheet_question_sheet.rb +2 -2
  39. data/app/models/fe/application.rb +14 -10
  40. data/app/models/fe/condition.rb +4 -4
  41. data/app/models/fe/date_field.rb +1 -1
  42. data/app/models/fe/element.rb +126 -44
  43. data/app/models/fe/email_address.rb +2 -2
  44. data/app/models/fe/email_template.rb +1 -1
  45. data/app/models/fe/page.rb +94 -19
  46. data/app/models/fe/page_element.rb +2 -2
  47. data/app/models/fe/paragraph.rb +1 -1
  48. data/app/models/fe/person.rb +5 -5
  49. data/app/models/fe/phone_number.rb +1 -1
  50. data/app/models/fe/question.rb +62 -38
  51. data/app/models/fe/question_grid.rb +15 -3
  52. data/app/models/fe/question_set.rb +53 -13
  53. data/app/models/fe/question_sheet.rb +49 -16
  54. data/app/models/fe/reference_question.rb +9 -3
  55. data/app/models/fe/reference_sheet.rb +102 -47
  56. data/app/models/fe/state_chooser.rb +2 -2
  57. data/app/models/fe/text_field.rb +2 -2
  58. data/app/models/fe/user.rb +1 -1
  59. data/app/models/staff.rb +6 -6
  60. data/app/views/fe/admin/elements/create.js.erb +3 -3
  61. data/app/views/fe/admin/elements/destroy.js.erb +1 -1
  62. data/app/views/fe/admin/elements/drop.js.erb +1 -1
  63. data/app/views/fe/admin/elements/duplicate.js.erb +1 -1
  64. data/app/views/fe/admin/elements/edit.js.erb +1 -1
  65. data/app/views/fe/admin/elements/error.js.erb +1 -1
  66. data/app/views/fe/admin/elements/new.js.erb +13 -6
  67. data/app/views/fe/admin/elements/update.js.erb +1 -1
  68. data/app/views/fe/admin/email_templates/_form.html.erb +3 -3
  69. data/app/views/fe/admin/email_templates/edit.html.erb +3 -3
  70. data/app/views/fe/admin/email_templates/index.html.erb +3 -3
  71. data/app/views/fe/admin/email_templates/new.html.erb +3 -3
  72. data/app/views/fe/admin/panels/_advanced_options.html.erb +8 -8
  73. data/app/views/fe/admin/panels/_common_boolean_fields.html.erb +1 -0
  74. data/app/views/fe/admin/panels/_common_boolean_fields_default.html.erb +11 -0
  75. data/app/views/fe/admin/panels/_common_fields.html.erb +2 -17
  76. data/app/views/fe/admin/panels/_condition.html.erb +1 -1
  77. data/app/views/fe/admin/panels/_insert.html.erb +25 -25
  78. data/app/views/fe/admin/panels/_nav_controls.html.erb +4 -4
  79. data/app/views/fe/admin/panels/_page.html.erb +1 -1
  80. data/app/views/fe/admin/panels/_pages_list.html.erb +3 -3
  81. data/app/views/fe/admin/panels/_prop_attachment_field.html.erb +2 -2
  82. data/app/views/fe/admin/panels/_prop_choice_field.html.erb +36 -17
  83. data/app/views/fe/admin/panels/_prop_date_field.html.erb +1 -1
  84. data/app/views/fe/admin/panels/_prop_element.html.erb +5 -5
  85. data/app/views/fe/admin/panels/_prop_page.html.erb +3 -3
  86. data/app/views/fe/admin/panels/_prop_paragraph.html.erb +8 -8
  87. data/app/views/fe/admin/panels/_prop_question_grid.html.erb +7 -2
  88. data/app/views/fe/admin/panels/_prop_question_grid_with_total.html.erb +2 -2
  89. data/app/views/fe/admin/panels/_prop_reference_question.html.erb +3 -3
  90. data/app/views/fe/admin/panels/_prop_section.html.erb +1 -1
  91. data/app/views/fe/admin/panels/_prop_sheet.html.erb +3 -3
  92. data/app/views/fe/admin/panels/_prop_text_field.html.erb +12 -12
  93. data/app/views/fe/admin/question_pages/_element.html.erb +7 -7
  94. data/app/views/fe/admin/question_pages/_element_show.html.erb +2 -2
  95. data/app/views/fe/admin/question_pages/_question_page.html.erb +4 -4
  96. data/app/views/fe/admin/question_pages/create.js.erb +3 -3
  97. data/app/views/fe/admin/question_pages/destroy.js.erb +3 -3
  98. data/app/views/fe/admin/question_pages/edit.js.erb +1 -1
  99. data/app/views/fe/admin/question_pages/error.js.erb +1 -1
  100. data/app/views/fe/admin/question_pages/show.js.erb +2 -2
  101. data/app/views/fe/admin/question_pages/show_panel.js.erb +1 -1
  102. data/app/views/fe/admin/question_pages/update.js.erb +1 -1
  103. data/app/views/fe/admin/question_sheets/edit.js.erb +1 -1
  104. data/app/views/fe/admin/question_sheets/error.js.erb +1 -1
  105. data/app/views/fe/admin/question_sheets/index.html.erb +8 -8
  106. data/app/views/fe/admin/question_sheets/new.html.erb +3 -3
  107. data/app/views/fe/admin/question_sheets/show.html.erb +5 -5
  108. data/app/views/fe/admin/question_sheets/update.js.erb +1 -1
  109. data/app/views/fe/answer_pages/_answer_page.html.erb +13 -14
  110. data/app/views/fe/answer_pages/_element.html.erb +22 -2
  111. data/app/views/fe/answer_pages/_page_name.html.erb +1 -1
  112. data/app/views/fe/answer_pages/show.html.erb +39 -0
  113. data/app/views/fe/answer_pages/update.js.erb +10 -2
  114. data/app/views/fe/answer_sheets/_answer_sheet.html.erb +4 -4
  115. data/app/views/fe/answer_sheets/_element.html.erb +9 -7
  116. data/app/views/fe/answer_sheets/_incomplete.html.erb +1 -1
  117. data/app/views/fe/answer_sheets/_page_link.html.erb +9 -7
  118. data/app/views/fe/answer_sheets/_pages_list.html.erb +3 -3
  119. data/app/views/fe/answer_sheets/_submit_to.html.erb +1 -1
  120. data/app/views/fe/answer_sheets/_title.html.erb +1 -1
  121. data/app/views/fe/answer_sheets/edit.html.erb +18 -18
  122. data/app/views/fe/answer_sheets/incomplete.js.erb +7 -4
  123. data/app/views/fe/answer_sheets/index.html.erb +1 -1
  124. data/app/views/fe/answer_sheets/show.html.erb +1 -1
  125. data/app/views/fe/applications/_logout.html.erb +1 -1
  126. data/app/views/fe/questions/fe/_acceptance.html.erb +10 -9
  127. data/app/views/fe/questions/fe/_attachment_field.html.erb +129 -10
  128. data/app/views/fe/questions/fe/_checkbox_field.html.erb +18 -16
  129. data/app/views/fe/questions/fe/_country.html.erb +6 -6
  130. data/app/views/fe/questions/fe/_date_field.html.erb +5 -4
  131. data/app/views/fe/questions/fe/_date_field_mmyy.html.erb +8 -8
  132. data/app/views/fe/questions/fe/_drop_down_field.html.erb +5 -5
  133. data/app/views/fe/questions/fe/_question_grid.html.erb +10 -10
  134. data/app/views/fe/questions/fe/_question_grid_with_total.html.erb +8 -8
  135. data/app/views/fe/questions/fe/_questions.html.erb +11 -5
  136. data/app/views/fe/questions/fe/_radio_button_field.html.erb +35 -19
  137. data/app/views/fe/questions/fe/_rating.html.erb +56 -18
  138. data/app/views/fe/questions/fe/_reference_discipler.html.erb +1 -1
  139. data/app/views/fe/questions/fe/_reference_friend.html.erb +1 -1
  140. data/app/views/fe/questions/fe/_reference_parent.html.erb +1 -1
  141. data/app/views/fe/questions/fe/_reference_peer.html.erb +1 -1
  142. data/app/views/fe/questions/fe/_reference_question.html.erb +40 -24
  143. data/app/views/fe/questions/fe/_reference_roommate.html.erb +1 -1
  144. data/app/views/fe/questions/fe/_reference_spiritual.html.erb +1 -1
  145. data/app/views/fe/questions/fe/_reference_staff.html.erb +1 -1
  146. data/app/views/fe/questions/fe/_state_chooser.html.erb +6 -6
  147. data/app/views/fe/questions/fe/_text_area_field.html.erb +14 -10
  148. data/app/views/fe/questions/fe/_text_field.html.erb +7 -6
  149. data/app/views/fe/questions/fe/_yes_no.html.erb +8 -8
  150. data/app/views/fe/questions/fe/_yes_no_field.erb +11 -8
  151. data/app/views/fe/reference_pages/_reference.html.erb +12 -12
  152. data/app/views/fe/reference_pages/edit.html.erb +4 -4
  153. data/app/views/fe/reference_sheets/done.html.erb +2 -2
  154. data/app/views/fe/reference_sheets/not_found.html.erb +3 -3
  155. data/app/views/fe/references/edit.html.erb +5 -5
  156. data/app/views/fe/references/show.html.erb +3 -3
  157. data/app/views/fe/references/submit.js.erb +3 -3
  158. data/app/views/fe/submit_pages/_thankyou.html.erb +1 -1
  159. data/app/views/fe/submit_pages/edit.html.erb +9 -9
  160. data/app/views/fe/submit_pages/error.js.erb +1 -1
  161. data/app/views/fe/submit_pages/submit.js.erb +2 -2
  162. data/app/views/layouts/fe/_error_messages_for.html.erb +1 -1
  163. data/app/views/layouts/fe/application.html.erb +3 -4
  164. data/app/views/layouts/fe/fe_admin.html.erb +30 -0
  165. data/app/views.current/fe/admin/elements/_errors.html.erb +11 -0
  166. data/app/views.current/fe/admin/elements/create.js.erb +12 -0
  167. data/app/views.current/fe/admin/elements/destroy.js.erb +4 -0
  168. data/app/views.current/fe/admin/elements/drop.js.erb +3 -0
  169. data/app/views.current/fe/admin/elements/duplicate.js.erb +3 -0
  170. data/app/views.current/fe/admin/elements/edit.js.erb +4 -0
  171. data/app/views.current/fe/admin/elements/error.js.erb +4 -0
  172. data/app/views.current/fe/admin/elements/new.js.erb +17 -0
  173. data/app/views.current/fe/admin/elements/update.js.erb +9 -0
  174. data/app/views.current/fe/admin/email_templates/_form.html.erb +8 -0
  175. data/app/views.current/fe/admin/email_templates/edit.html.erb +13 -0
  176. data/app/views.current/fe/admin/email_templates/index.html.erb +20 -0
  177. data/app/views.current/fe/admin/email_templates/new.html.erb +11 -0
  178. data/app/views.current/fe/admin/panels/_advanced_options.html.erb +49 -0
  179. data/app/views.current/fe/admin/panels/_common_boolean_fields.html.erb +1 -0
  180. data/app/views.current/fe/admin/panels/_common_boolean_fields_default.html.erb +11 -0
  181. data/app/views.current/fe/admin/panels/_common_fields.html.erb +23 -0
  182. data/app/views.current/fe/admin/panels/_condition.html.erb +6 -0
  183. data/app/views.current/fe/admin/panels/_insert.html.erb +39 -0
  184. data/app/views.current/fe/admin/panels/_nav_controls.html.erb +6 -0
  185. data/app/views.current/fe/admin/panels/_page.html.erb +3 -0
  186. data/app/views.current/fe/admin/panels/_pages_list.html.erb +16 -0
  187. data/app/views.current/fe/admin/panels/_prop_attachment_field.html.erb +2 -0
  188. data/app/views.current/fe/admin/panels/_prop_choice_field.html.erb +74 -0
  189. data/app/views.current/fe/admin/panels/_prop_date_field.html.erb +7 -0
  190. data/app/views.current/fe/admin/panels/_prop_element.html.erb +23 -0
  191. data/app/views.current/fe/admin/panels/_prop_page.html.erb +26 -0
  192. data/app/views.current/fe/admin/panels/_prop_paragraph.html.erb +46 -0
  193. data/app/views.current/fe/admin/panels/_prop_question_grid.html.erb +28 -0
  194. data/app/views.current/fe/admin/panels/_prop_question_grid_with_total.html.erb +14 -0
  195. data/app/views.current/fe/admin/panels/_prop_reference_question.html.erb +12 -0
  196. data/app/views.current/fe/admin/panels/_prop_section.html.erb +8 -0
  197. data/app/views.current/fe/admin/panels/_prop_sheet.html.erb +20 -0
  198. data/app/views.current/fe/admin/panels/_prop_text_field.html.erb +20 -0
  199. data/app/views.current/fe/admin/question_pages/_element.html.erb +28 -0
  200. data/app/views.current/fe/admin/question_pages/_element_show.html.erb +10 -0
  201. data/app/views.current/fe/admin/question_pages/_errors.html.erb +10 -0
  202. data/app/views.current/fe/admin/question_pages/_question_page.html.erb +13 -0
  203. data/app/views.current/fe/admin/question_pages/create.js.erb +11 -0
  204. data/app/views.current/fe/admin/question_pages/destroy.js.erb +5 -0
  205. data/app/views.current/fe/admin/question_pages/edit.js.erb +3 -0
  206. data/app/views.current/fe/admin/question_pages/error.js.erb +4 -0
  207. data/app/views.current/fe/admin/question_pages/show.js.erb +9 -0
  208. data/app/views.current/fe/admin/question_pages/show_panel.js.erb +3 -0
  209. data/app/views.current/fe/admin/question_pages/update.js.erb +2 -0
  210. data/app/views.current/fe/admin/question_sheets/_errors.html.erb +11 -0
  211. data/app/views.current/fe/admin/question_sheets/edit.js.erb +3 -0
  212. data/app/views.current/fe/admin/question_sheets/error.js.erb +5 -0
  213. data/app/views.current/fe/admin/question_sheets/index.html.erb +41 -0
  214. data/app/views.current/fe/admin/question_sheets/new.html.erb +15 -0
  215. data/app/views.current/fe/admin/question_sheets/show.html.erb +27 -0
  216. data/app/views.current/fe/admin/question_sheets/update.js.erb +2 -0
  217. data/app/views.current/fe/answer_pages/_answer_page.html.erb +53 -0
  218. data/app/views.current/fe/answer_pages/_element.html.erb +32 -0
  219. data/app/views.current/fe/answer_pages/_page_name.html.erb +1 -0
  220. data/app/views.current/fe/answer_pages/show.html.erb +39 -0
  221. data/app/views.current/fe/answer_pages/update.js.erb +13 -0
  222. data/app/views.current/fe/answer_sheets/_answer_sheet.html.erb +26 -0
  223. data/app/views.current/fe/answer_sheets/_element.html.erb +74 -0
  224. data/app/views.current/fe/answer_sheets/_incomplete.html.erb +10 -0
  225. data/app/views.current/fe/answer_sheets/_page_link.html.erb +9 -0
  226. data/app/views.current/fe/answer_sheets/_pages_list.html.erb +11 -0
  227. data/app/views.current/fe/answer_sheets/_submit_to.html.erb +1 -0
  228. data/app/views.current/fe/answer_sheets/_title.html.erb +1 -0
  229. data/app/views.current/fe/answer_sheets/edit.html.erb +66 -0
  230. data/app/views.current/fe/answer_sheets/incomplete.js.erb +11 -0
  231. data/app/views.current/fe/answer_sheets/index.html.erb +18 -0
  232. data/app/views.current/fe/answer_sheets/send_reference_invite.js.erb +8 -0
  233. data/app/views.current/fe/answer_sheets/show.html.erb +13 -0
  234. data/app/views.current/fe/applications/_logout.html.erb +1 -0
  235. data/app/views.current/fe/applications/show.html.erb +1 -0
  236. data/app/views.current/fe/help/builder.html +33 -0
  237. data/app/views.current/fe/help/question_grid.html +18 -0
  238. data/app/views.current/fe/questions/fe/_acceptance.html.erb +14 -0
  239. data/app/views.current/fe/questions/fe/_attachment_field.html.erb +165 -0
  240. data/app/views.current/fe/questions/fe/_checkbox_field.html.erb +53 -0
  241. data/app/views.current/fe/questions/fe/_country.html.erb +7 -0
  242. data/app/views.current/fe/questions/fe/_date_field.html.erb +7 -0
  243. data/app/views.current/fe/questions/fe/_date_field_mmyy.html.erb +9 -0
  244. data/app/views.current/fe/questions/fe/_drop_down_field.html.erb +8 -0
  245. data/app/views.current/fe/questions/fe/_paragraph.html.erb +1 -0
  246. data/app/views.current/fe/questions/fe/_question_grid.html.erb +70 -0
  247. data/app/views.current/fe/questions/fe/_question_grid_with_total.html.erb +64 -0
  248. data/app/views.current/fe/questions/fe/_questions.html.erb +15 -0
  249. data/app/views.current/fe/questions/fe/_radio_button_field.html.erb +60 -0
  250. data/app/views.current/fe/questions/fe/_rating.html.erb +64 -0
  251. data/app/views.current/fe/questions/fe/_reference_discipler.html.erb +1 -0
  252. data/app/views.current/fe/questions/fe/_reference_friend.html.erb +1 -0
  253. data/app/views.current/fe/questions/fe/_reference_parent.html.erb +1 -0
  254. data/app/views.current/fe/questions/fe/_reference_peer.html.erb +1 -0
  255. data/app/views.current/fe/questions/fe/_reference_question.html.erb +61 -0
  256. data/app/views.current/fe/questions/fe/_reference_roommate.html.erb +1 -0
  257. data/app/views.current/fe/questions/fe/_reference_spiritual.html.erb +1 -0
  258. data/app/views.current/fe/questions/fe/_reference_staff.html.erb +1 -0
  259. data/app/views.current/fe/questions/fe/_section.html.erb +1 -0
  260. data/app/views.current/fe/questions/fe/_state_chooser.html.erb +7 -0
  261. data/app/views.current/fe/questions/fe/_text_area_field.html.erb +17 -0
  262. data/app/views.current/fe/questions/fe/_text_field.html.erb +9 -0
  263. data/app/views.current/fe/questions/fe/_yes_no.html.erb +17 -0
  264. data/app/views.current/fe/questions/fe/_yes_no_field.erb +20 -0
  265. data/app/views.current/fe/reference_pages/_reference.html.erb +31 -0
  266. data/app/views.current/fe/reference_pages/edit.html.erb +24 -0
  267. data/app/views.current/fe/reference_sheets/done.html.erb +2 -0
  268. data/app/views.current/fe/reference_sheets/not_found.html.erb +5 -0
  269. data/app/views.current/fe/reference_sheets/submitted.js.erb +1 -0
  270. data/app/views.current/fe/references/edit.html.erb +8 -0
  271. data/app/views.current/fe/references/send_invite.js.erb +7 -0
  272. data/app/views.current/fe/references/show.html.erb +18 -0
  273. data/app/views.current/fe/references/submit.js.erb +3 -0
  274. data/app/views.current/fe/submit_pages/_errors.html.erb +1 -0
  275. data/app/views.current/fe/submit_pages/_thankyou.html.erb +2 -0
  276. data/app/views.current/fe/submit_pages/edit.html.erb +36 -0
  277. data/app/views.current/fe/submit_pages/error.js.erb +1 -0
  278. data/app/views.current/fe/submit_pages/submit.js.erb +3 -0
  279. data/app/views.current/layouts/fe/_error_messages_for.html.erb +7 -0
  280. data/app/views.current/layouts/fe/application.html.erb +47 -0
  281. data/app/{views/layouts/fe/fe.admin.html.erb → views.current/layouts/fe/fe_admin.html.erb} +4 -4
  282. data/config/initializers/paper_trail.rb +3 -0
  283. data/config/routes.rb +3 -1
  284. data/db/migrate/20131003041856_core.rb +23 -23
  285. data/db/migrate/20131003044250_create_reference_sheets.rb +1 -1
  286. data/db/migrate/20131003044436_add_element_and_answer_fields.rb +3 -3
  287. data/db/migrate/20131003044518_create_email_templates.rb +2 -2
  288. data/db/migrate/20131003044621_add_max_lengths.rb +1 -1
  289. data/db/migrate/20131003044714_create_join_table.rb +1 -1
  290. data/db/migrate/20131016162128_remove_question_id_from_element.rb +1 -1
  291. data/db/migrate/20140623153424_create_fe_people.rb +1 -1
  292. data/db/migrate/20140624180246_create_fe_addresses.rb +1 -1
  293. data/db/migrate/20140624182216_create_fe_phone_numbers.rb +1 -1
  294. data/db/migrate/20140625160545_create_fe_users.rb +1 -1
  295. data/db/migrate/20140808202507_add_conditional_type_to_elements.rb +1 -1
  296. data/db/migrate/20140808203609_add_conditional_answer_to_elements.rb +1 -1
  297. data/db/migrate/20141103204704_remove_short_value_column.rb +1 -1
  298. data/db/migrate/20141109154522_move_conditional_ids_used_for_choice_field_to_their_own_column.rb +1 -1
  299. data/db/migrate/20150504221439_add_all_element_ids_to_pages.rb +1 -1
  300. data/db/migrate/20150713022326_add_locale_columns.rb +1 -1
  301. data/db/migrate/20150714220730_add_locale_to_answer_sheet.rb +1 -1
  302. data/db/migrate/20150925181652_add_share_to_elements.rb +5 -0
  303. data/db/migrate/20150928085325_change_pages_all_element_ids_to_text.rb +1 -1
  304. data/db/migrate/20150930191538_add_locale_to_reference_sheets.rb +1 -1
  305. data/db/migrate/20151021181928_switch_conditional_answer_separator_to_semicolon.rb +7 -0
  306. data/db/migrate/20151021184250_add_question_sheet_id_in_refs.rb +12 -0
  307. data/db/migrate/20160201185838_add_visible_and_visibility_cache_key_to_reference_sheets.rb +6 -0
  308. data/db/migrate/20160805221415_add_rating_extra_labels.rb +10 -0
  309. data/db/migrate/20181108201746_create_versions.rb +80 -0
  310. data/db/migrate/20181218201130_increase_slug_length.rb +5 -0
  311. data/lib/fe/engine.rb +10 -10
  312. data/lib/fe/version.rb +1 -1
  313. data/lib/fe.rb +7 -1
  314. data/spec/controllers/fe/admin/elements_controller_spec.rb +30 -20
  315. data/spec/controllers/fe/admin/email_templates_controller_spec.rb +2 -2
  316. data/spec/controllers/fe/admin/question_pages_controller_spec.rb +1 -1
  317. data/spec/controllers/fe/admin/question_sheets_controller_spec.rb +4 -4
  318. data/spec/controllers/fe/answer_pages_controller_spec.rb +86 -30
  319. data/spec/controllers/fe/answer_sheets_controller_spec.rb +65 -9
  320. data/spec/dummy/app/assets/config/manifest.js +0 -0
  321. data/spec/dummy/app/models/user.rb +1 -1
  322. data/spec/dummy/app/views/layouts/application.html.erb +2 -2
  323. data/spec/dummy/config/application.rb +1 -0
  324. data/spec/dummy/config/environments/test.rb +3 -3
  325. data/spec/dummy/config/initializers/assets.rb +5 -2
  326. data/spec/dummy/config/initializers/fast_gettext.rb +1 -1
  327. data/spec/dummy/config/initializers/to_unsafe_h.rb +5 -0
  328. data/spec/dummy/config/initializers/to_unsafe_h.rb.new +5 -0
  329. data/spec/dummy/db/migrate/20141203214017_core.fe_engine.rb +23 -23
  330. data/spec/dummy/db/migrate/20141203214018_create_reference_sheets.fe_engine.rb +1 -1
  331. data/spec/dummy/db/migrate/20141203214019_add_element_and_answer_fields.fe_engine.rb +3 -3
  332. data/spec/dummy/db/migrate/20141203214020_create_email_templates.fe_engine.rb +2 -2
  333. data/spec/dummy/db/migrate/20141203214021_add_max_lengths.fe_engine.rb +1 -1
  334. data/spec/dummy/db/migrate/20141203214022_create_join_table.fe_engine.rb +1 -1
  335. data/spec/dummy/db/migrate/20141203214023_remove_question_id_from_element.fe_engine.rb +1 -1
  336. data/spec/dummy/db/migrate/20141203214024_create_fe_people.fe_engine.rb +1 -1
  337. data/spec/dummy/db/migrate/20141203214025_create_fe_addresses.fe_engine.rb +1 -1
  338. data/spec/dummy/db/migrate/20141203214027_create_fe_users.fe_engine.rb +1 -1
  339. data/spec/dummy/db/migrate/20141203214028_add_conditional_type_to_elements.fe_engine.rb +1 -1
  340. data/spec/dummy/db/migrate/20141203214029_add_conditional_answer_to_elements.fe_engine.rb +1 -1
  341. data/spec/dummy/db/migrate/20141203214030_remove_short_value_column.fe_engine.rb +1 -1
  342. data/spec/dummy/db/migrate/20141203214031_move_conditional_ids_used_for_choice_field_to_their_own_column.fe_engine.rb +1 -1
  343. data/spec/dummy/db/migrate/20150123215803_create_users.rb +1 -1
  344. data/spec/dummy/db/migrate/20150504222619_add_all_element_ids_to_pages.fe_engine.rb +1 -1
  345. data/spec/dummy/db/migrate/20150925192557_add_share_to_elements.fe_engine.rb +6 -0
  346. data/spec/dummy/db/migrate/20150930190001_create_fe_phone_numbers.fe_engine.rb +1 -1
  347. data/spec/dummy/db/migrate/20150930190002_add_locale_columns.fe_engine.rb +1 -1
  348. data/spec/dummy/db/migrate/20150930190003_add_locale_to_answer_sheet.fe_engine.rb +1 -1
  349. data/spec/dummy/db/migrate/20150930190004_change_pages_all_element_ids_to_text.fe_engine.rb +1 -1
  350. data/spec/dummy/db/migrate/20150930191756_add_locale_to_reference_sheets.fe_engine.rb +1 -1
  351. data/spec/dummy/db/migrate/20151021190027_add_question_sheet_id_in_refs.fe_engine.rb +13 -0
  352. data/spec/dummy/db/migrate/20160204164612_switch_conditional_answer_separator_to_semicolon.fe_engine.rb +8 -0
  353. data/spec/dummy/db/migrate/20160204164613_add_visible_and_visibility_cache_key_to_reference_sheets.fe_engine.rb +7 -0
  354. data/spec/dummy/db/migrate/20181108201746_create_versions.rb +80 -0
  355. data/spec/dummy/db/schema.rb +71 -79
  356. data/spec/dummy/log/test.log +101278 -419
  357. data/spec/factories/answer_sheet_question_sheets.rb +1 -1
  358. data/spec/factories/answer_sheets.rb +2 -2
  359. data/spec/factories/answers.rb +1 -1
  360. data/spec/factories/applications.rb +3 -3
  361. data/spec/factories/dummy_applications.rb +3 -3
  362. data/spec/factories/dummy_people.rb +3 -3
  363. data/spec/factories/dummy_users.rb +3 -3
  364. data/spec/factories/elements.rb +21 -21
  365. data/spec/factories/email_templates.rb +3 -3
  366. data/spec/factories/fe_addresses.rb +10 -10
  367. data/spec/factories/fe_email_addresses.rb +3 -3
  368. data/spec/factories/fe_email_templates.rb +4 -4
  369. data/spec/factories/fe_people.rb +5 -5
  370. data/spec/factories/fe_phone_numbers.rb +3 -3
  371. data/spec/factories/fe_user.rb +3 -3
  372. data/spec/factories/page.rb +1 -1
  373. data/spec/factories/page_elements.rb +1 -1
  374. data/spec/factories/paragraphs.rb +1 -1
  375. data/spec/factories/question_sheet.rb +2 -2
  376. data/spec/factories/reference_questions.rb +1 -1
  377. data/spec/factories/reference_sheets.rb +1 -1
  378. data/spec/jobs/fe/update_reference_sheet_visibility_job_spec.rb +40 -0
  379. data/spec/models/fe/answer_sheet_question_sheet_spec.rb +1 -1
  380. data/spec/models/fe/answer_spec.rb +2 -2
  381. data/spec/models/fe/application_spec.rb +94 -1
  382. data/spec/models/fe/choice_field_spec.rb +47 -1
  383. data/spec/models/fe/condition_spec.rb +2 -2
  384. data/spec/models/fe/element_spec.rb +252 -60
  385. data/spec/models/fe/email_template_spec.rb +1 -1
  386. data/spec/models/fe/page_element_spec.rb +1 -1
  387. data/spec/models/fe/page_spec.rb +57 -12
  388. data/spec/models/fe/person_spec.rb +1 -1
  389. data/spec/models/fe/question_set_spec.rb +91 -0
  390. data/spec/models/fe/question_sheet_spec.rb +11 -15
  391. data/spec/models/fe/question_spec.rb +73 -6
  392. data/spec/models/fe/reference_question_spec.rb +20 -0
  393. data/spec/models/fe/reference_sheet_spec.rb +287 -4
  394. data/spec/models/fe/text_field_spec.rb +22 -0
  395. data/spec/rails_helper.rb +79 -76
  396. metadata +195 -57
  397. data/app/assets/javascripts/fe/jquery.scrollTo-min.js +0 -7
  398. data/app/controllers/fe/concerns/answer_pages_controller_concern.rb +0 -84
  399. data/app/models/fe/concerns/answer_sheet_concern.rb +0 -85
  400. data/spec/dummy/db/migrate/20141203214026_create_create_fe_phone_numbers.fe_engine.rb +0 -17
  401. data/spec/dummy/log/development.log +0 -5
  402. /data/app/{assets/stylesheets/360front.css → views.current/fe/admin/elements/reorder.js.erb} +0 -0
@@ -0,0 +1,2 @@
1
+ $("#page-name").html('<%= escape_javascript(@page.label) %>')
2
+ $('#panel').html('<%= escape_javascript(render("admin/panels/pages_list")) %>')
@@ -0,0 +1,11 @@
1
+ <% if @question_sheet.errors.any? %>
2
+ <div class="errors">
3
+ <h2>There was a problem saving this sheet</h2>
4
+ <ul>
5
+ <% @question_sheet.errors.full_messages.each do |msg| %>
6
+ <li><%= msg %></li>
7
+ <% end %>
8
+ </ul>
9
+ </div>
10
+ <% end %>
11
+
@@ -0,0 +1,3 @@
1
+ $('#panel').html('<%= escape_javascript(render("fe/admin/panels/prop_sheet", question_sheet: @question_sheet)) %>');
2
+ clearPageName()
3
+ clearCurrentElement()
@@ -0,0 +1,5 @@
1
+ $('#errors').html('<%= escape_javascript(render("errors", page: @question_sheet)) %>');
2
+
3
+ <% @question_sheet.errors.each do |attr_name, message| %>
4
+ addError('question_sheet_<%= attr_name %>')
5
+ <% end %>
@@ -0,0 +1,41 @@
1
+ <div id="content">
2
+ <h1>Questionnaires</h1>
3
+
4
+ <% if flash[:error] -%>
5
+ <div style="background: #ffe5df; border: solid 1px #efbeb3; padding: 9px; margin: 0 0 18px;"><%= flash[:error] %></div>
6
+ <% end -%>
7
+
8
+ <%= link_to "New Form", fe_admin_question_sheets_path(), method: :post, class: "add-link" %>
9
+ <br/>
10
+ <table cellspacing="0" class="list">
11
+ <tr>
12
+ <th>Active Question Sheets</th>
13
+ <th colspan="3">&nbsp;</th>
14
+ </tr>
15
+ <% for question_sheet in @active_question_sheets %>
16
+ <tr class="<%= cycle("","alt") %>">
17
+ <td class="title"><%= link_to question_sheet.label, fe_admin_question_sheet_path(question_sheet), class: "questionnaire" %></td>
18
+ <td class="actions"><%= link_to "Duplicate", duplicate_fe_admin_question_sheet_path(question_sheet), data: {confirm: "This will take some time depending on the number of questions. Please be patient."}, method: :post, class: "duplicate" %></td>
19
+ <td class="actions"><%= link_to "Archive", archive_fe_admin_question_sheet_path(question_sheet), data: {confirm: "Are you sure you want to archive this Question Sheet?"}, method: :post, class: "archive" %></td>
20
+ <td class="actions"><%= link_to "Destroy", fe_admin_question_sheet_path(question_sheet), data: {confirm: "Are you sure you want to delete this Question Sheet?"}, method: :delete, class: "destroy delete" %></td>
21
+ </tr>
22
+ <% end %>
23
+ </table>
24
+
25
+
26
+ <table cellspacing="0" class="list">
27
+ <tr>
28
+ <th>Archived Question Sheets</th>
29
+ <th>&nbsp;</th>
30
+ <th>&nbsp;</th>
31
+ </tr>
32
+ <% for question_sheet in @archived_question_sheets %>
33
+ <tr class="<%= cycle("","alt") %>">
34
+ <td class="title"><%= link_to question_sheet.label, fe_admin_question_sheet_path(question_sheet), class: "questionnaire" %></td>
35
+ <td class="actions"><%= link_to "Duplicate", duplicate_fe_admin_question_sheet_path(question_sheet), data: {confirm: "This will take some time depending on the number of questions. Please be patient."}, method: :post, class: "duplicate" %></td>
36
+ <td class="actions"><%= link_to "Un-Archive", unarchive_fe_admin_question_sheet_path(question_sheet), method: :post, class: "unarchive" %></td>
37
+ </tr>
38
+ <% end %>
39
+ </table>
40
+ </div>
41
+
@@ -0,0 +1,15 @@
1
+ <h1>New Form</h1>
2
+
3
+ <%= error_messages_for :question_sheet %>
4
+
5
+ <%= form_for(:question_sheet, url: fe_admin_question_sheets_path) do |f| %>
6
+ <p>
7
+ <label for="question_sheet_label">Label</label>
8
+ <%= f.text_field :label, maxlength: 60 %>
9
+ </p>
10
+ <p>
11
+ <%= submit_tag "Create" %>
12
+ </p>
13
+ <% end %>
14
+
15
+ <%= link_to "Back", fe_admin_question_sheets_path %>
@@ -0,0 +1,27 @@
1
+ <script language="javascript">
2
+ var activeElement = "";
3
+ </script>
4
+
5
+ <div id="content">
6
+ <div id="controls">
7
+ <ul id="nav-controls">
8
+ <%= render "fe/admin/panels/nav_controls" %>
9
+ </ul>
10
+
11
+ <div id="panel">
12
+ <%= render "fe/admin/panels/pages_list" %>
13
+ </div>
14
+ </div>
15
+
16
+
17
+ <div id="preview">
18
+ <h2 id="sheet-name">
19
+ <%= link_to @question_sheet.label, edit_fe_admin_question_sheet_path(@question_sheet), remote: true, method: :get , class: "ctl" -%>
20
+ </h2>
21
+ <div id="page-preview">
22
+ <%= render "fe/admin/question_pages/question_page" %>
23
+ </div>
24
+ </div>
25
+
26
+ <div style="clear:both;">&nbsp;</div>
27
+ </div>
@@ -0,0 +1,2 @@
1
+ $('#sheet-name').html('<%= escape_javascript(@question_sheet.label) %>');
2
+ $('#panel').html('<%= escape_javascript(render("fe/admin/panels/prop_sheet", question_sheet: @question_sheet)) %>');
@@ -0,0 +1,53 @@
1
+ <% if @presenter.active_page %>
2
+ <% page_dom = @presenter.active_page_link.dom_id %>
3
+
4
+ <div id="<%= page_dom %>" class="answer-page" style="<% if show_first.nil? -%>display: none;<% end -%>"> <!-- this id is parsed by fe.public.js -->
5
+
6
+ <div class="page">
7
+ <%= render "fe/answer_pages/page_name" %>
8
+
9
+ <% if @elements.length > 0 -%>
10
+ <%= form_tag @presenter.active_page_link.save_path, id: "#{page_dom}-form", autocomplete: "off", onsubmit: "fe.pageHandler.savePage($('#sp_application_55716-page_331')); return false;", multipart: true do -%>
11
+ <%= hidden_field_tag "a", params[:a] %>
12
+ <ul class="questions" id="questions_list">
13
+ <% previous_element = nil %>
14
+ <% @elements.each do |element| %>
15
+ <li style="<%= "display:none" if element.hidden?(@answer_sheet, @presenter.active_page) %>" class="<%= element.class.to_s.downcase.gsub("::","_") %> <%= element.style.to_s.downcase %> <%= "conditional" if element.conditional %>" id="element_<%= element.id %>" <% if element.conditional %>data-conditional_id="<%= element.conditional_id %>" data-conditional_type="<%= element.conditional_type %>" data-conditional_answer="<%= element.conditional_answer %>" data-application_id="<%= @answer_sheet.id %>" data-answer_sheet_id_prefix="<%= @answer_sheet.class.name.underscore.gsub("/","_") %>"<% end %><% if element.slug %> data-slug="<%= element.slug %>"<% end %>>
16
+ <%= render "fe/answer_pages/element", element: element %>
17
+ </li>
18
+ <% previous_element = element %>
19
+ <% end %>
20
+ </ul>
21
+
22
+ <% unless @presenter.next_page -%>
23
+ <div id="submit_message" class="validation-advice" style="display: none;"></div>
24
+ <div>
25
+ <button type="button" class="<%= "btn btn-default" if Fe.bootstrap %> button save_button"><%= _("Save Now") %></button>
26
+ <button type="submit" class="<%= "btn btn-default" if Fe.bootstrap %> button cru-gold no-left-margin" onclick="page_handler.completeAll(); return false;" id="submit_button"><%= _("Submit") %></button>
27
+ </div>
28
+ <% else -%>
29
+ <div class="savestatus">
30
+ <%= _("Last Saved:") %> <span class="last-saved"><%= l(@answer_sheet.updated_at, format: :datetime) %></span><%= spinner(page_dom) %>
31
+ </div>
32
+ <div>
33
+ <button type="button" class="button no-left-margin save_button"><%= _("Save Now") %></button>
34
+ <button type="button" class="button cru-gold" onclick="fe.pageHandler.next(); return false;"><%= _("Next >>") %></button>
35
+ </div>
36
+ <% end -%>
37
+ <% end -%>
38
+ <% else -%>
39
+ <div style="background: #ffc;">
40
+ <p><%= _("There are no questions on this page.") %></p>
41
+ </div>
42
+ <% end -%>
43
+ </div>
44
+ </div>
45
+
46
+ <% if session[:attempted_submit] %>
47
+ <script type="text/javascript" charset="utf-8">
48
+ $(function() {
49
+ fe.pageHandler.validatePage("<%= page_dom %>")
50
+ });
51
+ </script>
52
+ <% end %>
53
+ <% end %>
@@ -0,0 +1,32 @@
1
+ <% if Fe.bootstrap %>
2
+
3
+ <div class="form-group">
4
+ <% if element.question? && element.default_label? && element.label.present? && !element.hide_label? -%>
5
+ <label for="<%= dom_id(element) %>" class="desc">
6
+ <%= raw element.label(session[:locale]) %>
7
+ <% if element.required?(@answer_sheet, @page) -%><span class="required">required</span><% end -%>
8
+ <%= tip(element.tooltip) if element.tooltip.present? %>
9
+
10
+ <% col ||= nil %>
11
+ <%= render partial: "fe/questions/" + element.ptemplate, object: element, locals: {col: col} %>
12
+ </label>
13
+ <% else %>
14
+ <% col ||= nil %>
15
+ <%= render partial: "fe/questions/" + element.ptemplate, object: element, locals: {col: col} %>
16
+ <% end -%>
17
+ </div>
18
+
19
+ <% else %>
20
+
21
+ <% if element.question? && element.default_label? && element.label.present? && !element.hide_label? -%>
22
+ <label for="<%= dom_id(element) %>" class="desc">
23
+ <%= raw element.label(session[:locale]) %>
24
+ <% if element.required?(@answer_sheet, @page) -%><span class="required"><%= _("required") %></span><% end -%>
25
+ <%= tip(element.tooltip) if element.tooltip.present? %>
26
+ </label>
27
+ <% end -%>
28
+
29
+ <% col ||= nil %>
30
+ <%= render partial: "fe/questions/" + element.ptemplate, object: element, locals: {col: col} %>
31
+
32
+ <% end %>
@@ -0,0 +1 @@
1
+ <h4 id="page-name"><%= @presenter.active_page.label(session[:locale]) %></h4>
@@ -0,0 +1,39 @@
1
+ <% if @presenter.active_page %>
2
+ <% page_dom = @presenter.active_page_link.dom_id
3
+ next_js = load_page_js(@presenter.next_page) -%>
4
+
5
+ <div id="<%= page_dom %>" class="answer-page"> <!-- this id is parsed by fe.public.js -->
6
+
7
+ <div class="page">
8
+ <%= render "fe/answer_pages/page_name" %>
9
+
10
+ <% if @elements.length > 0 -%>
11
+ <%= form_tag @presenter.active_page_link.save_path, id: "#{page_dom}-form", autocomplete: "off", onsubmit: "fe.pageHandler.savePage($("#sp_application_55716-page_331")); return false;", multipart: true do -%>
12
+ <%= hidden_field_tag "a", params[:a] %>
13
+ <ul class="questions" id="questions_list">
14
+ <% previous_element = nil %>
15
+ <% @elements.each do |element| %>
16
+ <li class="<%= element.class.to_s.downcase.gsub("::","_") %> <%= element.style.to_s.downcase %> <%= "conditional" if element.conditional %>" id="element_<%= element.id %>" <% if element.conditional %>data-conditional_id="<%= element.conditional_id %>" data-conditional_type="<%= element.conditional_type %>" data-conditional_answer="<%= element.conditional_answer %>" data-application_id="<%= @answer_sheet.id %>" data-answer_sheet_id_prefix="<%= @answer_sheet.class.name.underscore.gsub("/","_") %>"<% end %><% if element.slug %> data-slug="<%= element.slug %>"<% end %>>
17
+ <%= render "fe/answer_pages/element", element: element %>
18
+ </li>
19
+ <% previous_element = element %>
20
+ <% end %>
21
+ </ul>
22
+
23
+ <% end -%>
24
+ <% else -%>
25
+ <div style="background: #ffc;">
26
+ <p><%= _("There are no questions on this page.") %></p>
27
+ </div>
28
+ <% end -%>
29
+ </div>
30
+ </div>
31
+
32
+ <% if session[:attempted_submit] %>
33
+ <script type="text/javascript" charset="utf-8">
34
+ $(function() {
35
+ fe.pageHandler.validatePage("<%= page_dom %>")
36
+ });
37
+ </script>
38
+ <% end %>
39
+ <% end %>
@@ -0,0 +1,13 @@
1
+ <% if @saved_at_timestamp.is_a?(Time) || @saved_at_timestamp.is_a?(Date) %>
2
+ $('.last-saved').html('<%= escape_javascript(l(@saved_at_timestamp, format: :datetime)) %>')
3
+ <% end %>
4
+ <% if @answer && @answer.attachment_file_name %>
5
+ $('#<%= dom_id(@answer.question) %>_filename').html('Current File: ' +
6
+ '<%= link_to(@answer.attachment_file_name, @answer.attachment.expiring_url) %>' +
7
+ '<%= link_to(image_tag("fe/icons/minus-button.png"),
8
+ delete_file_fe_answer_sheet_page_path(@presenter.active_answer_sheet, @page, question_id: @answer.question.id),
9
+ method: :delete, remote: true) %>')
10
+ $('#<%= dom_id(@answer.question) %>_filename').effect('highlight')
11
+ <% elsif @answer %>
12
+ $('#<%= dom_id(@answer.question) %>_filename').html('')
13
+ <% end %>
@@ -0,0 +1,26 @@
1
+ <h3 id="sheet-name"><%= answer_sheet.question_sheet.label %></h3>
2
+
3
+ <% if elements.length > 0 -%>
4
+
5
+ <% elements.each do |page, page_elements| -%>
6
+ <% next unless page.has_questions? %>
7
+ <a name="<%= dom_id(page) %>" class="anchor"></a>
8
+
9
+ <div class="page" data-page-id="<%= page.id %>">
10
+ <h3><%= page.label %></h3>
11
+ <ul class="questions readonly" start="<%= @question_number %>">
12
+ <%= render partial: "fe/answer_sheets/element", collection: page_elements, locals: {elements: page_elements} %>
13
+ </ul>
14
+ </div>
15
+
16
+ <br />
17
+
18
+ <% end -%>
19
+
20
+ <% else -%>
21
+
22
+ <div style="background: #ffc;">
23
+ <p>That"s odd. There are no answers to review.</p>
24
+ </div>
25
+
26
+ <% end -%>
@@ -0,0 +1,74 @@
1
+ <% if element.kind == "Fe::QuestionGrid" || element.kind == "Fe::QuestionGridWithTotal"-%>
2
+ <li>
3
+ <% unless element.hide_label? %>
4
+ <label class="desc"><%= raw element.label %></label>
5
+ <% end %>
6
+ <table class="grid">
7
+ <%- if element.cols -%>
8
+ <tr>
9
+ <%- element.cols.split(";").each do |header| -%>
10
+ <th><%= raw header || "&nbsp;" %></th>
11
+ <%- end -%>
12
+ </tr>
13
+ <%- end -%>
14
+ <tr>
15
+ <%- col_count = 0
16
+ element.elements.each do |grid_element| -%>
17
+ <td id="element_<%= element.id %>">
18
+ <% if %w(Fe::Paragraph).include?(grid_element.kind) -%>
19
+ <%= simple_format grid_element.content %>
20
+ <% else -%>
21
+ <%# el = elements.detect {|el| el.id == grid_element.id } -%>
22
+ <% if grid_element.question? -%>
23
+ <label class="desc"><%= raw grid_element.label %></label>
24
+ <%- if @collating -%>
25
+ <%- for answer_sheet in @collated_answer_sheets[@answer_sheet] -%>
26
+ <div class="answer collate">
27
+ <span class="reviewer_name"><%= answer_sheet.collat_title %>:</span>
28
+ <span class="reviewer_answer"><%= simple_format grid_element.display_response(answer_sheet) %></span>
29
+ </div>
30
+ <%- end -%>
31
+ <%- else -%>
32
+ <span class="answer"><%= simple_format grid_element.display_response(@answer_sheet) %></span>
33
+ <%- end -%>
34
+ <% elsif grid_element.is_a?(Fe::QuestionGrid) || grid_element.is_a?(Fe::QuestionGridWithTotal) %>
35
+ <ul>
36
+ <%= render partial: "fe/answer_sheets/element", object: grid_element %>
37
+ </ul>
38
+ <% else %>
39
+ <%= render partial: "fe/questions/" + element.ptemplate, object: element %>
40
+ <% end %>
41
+ <% end -%>
42
+ </td>
43
+ <%- col_count += 1
44
+ if col_count % element.num_cols == 0 then col_count = 0 -%></tr><tr><%- end -%>
45
+ <%- end -%>
46
+ <%- while col_count < element.num_cols do
47
+ col_count += 1-%>
48
+ <td>&nbsp;</td>
49
+ <%- end unless col_count == 0-%>
50
+ </tr>
51
+ </table>
52
+ </li>
53
+ <% else %>
54
+ <li>
55
+ <% if element.question? -%>
56
+ <label class="desc"><%= raw element.label %></label>
57
+ <%- if @collating -%>
58
+ <%- for answer_sheet in @collated_answer_sheets[@answer_sheet] -%>
59
+ <div class="answer collate">
60
+ <span class="reviewer_name"><%= answer_sheet.collat_title %>:</span>
61
+ <span class="reviewer_answer"><%= simple_format element.display_response(answer_sheet) %></span>
62
+ </div>
63
+ <%- end -%>
64
+ <%- else -%>
65
+ <span class="answer"><%= simple_format element.display_response(@answer_sheet) %></span>
66
+ <%- end -%>
67
+ <% else -%>
68
+ <%= render partial: "fe/questions/" + element.ptemplate, object: element %>
69
+ <% end -%>
70
+ </li>
71
+ <% element.choice_field_children.each do |choice_field_child| %>
72
+ <%= render "fe/answer_sheets/element", element: choice_field_child %>
73
+ <% end %>
74
+ <% end -%>
@@ -0,0 +1,10 @@
1
+ <div class="submission_errors">
2
+ <p><%= _("You still need to answer questions on the following pages:") %></p>
3
+ <ul>
4
+ <% @answer_sheet.pages.each do |page| %>
5
+ <% unless page.complete?(@answer_sheet) %>
6
+ <li class="incomplete"><%= page.label %></li>
7
+ <% end %>
8
+ <% end %>
9
+ </ul>
10
+ </div>
@@ -0,0 +1,9 @@
1
+ <div class="application_section">
2
+ <% css_class = "" %>
3
+ <% if session[:attempted_submit] && page_link.page.has_questions? %>
4
+ <% css_class = page_link.page.complete?(@answer_sheet) ? "complete" : "incomplete" %>
5
+ <% end %>
6
+ <%= li_page_active_if(@presenter.active_page && page_link.page == @presenter.active_page, id: page_link.dom_id + "-li", class: css_class, style: ("display:none" if page_link.page.hidden?(@answer_sheet))) do %>
7
+ <%= link_to_function(page_link.label(session[:locale]), load_page_js(page_link), id: page_link.dom_id + "-link", "data-page-id" => page_link.dom_id, class: "page_link", href: page_link.load_path) %>
8
+ <% end -%>
9
+ </div>
@@ -0,0 +1,11 @@
1
+ <div id="panel-pages">
2
+ <h4><%= _("Application Sections") %></h4>
3
+ <div id="page_ajax_spinner" style="display:none;">
4
+ <div>
5
+ <%= image_tag "fe/ajax-loader.gif" %> <%= _("Loading...") %>
6
+ </div>
7
+ </div>
8
+ <ul id="list-pages" class="navigation-list">
9
+ <%= render partial: "fe/answer_sheets/page_link", collection: @presenter.page_links %>
10
+ </ul>
11
+ </div>
@@ -0,0 +1 @@
1
+ <%= hidden_field_tag "submit_to", submit_fe_answer_sheet_path(@answer_sheet), id: "submit_to" %>
@@ -0,0 +1 @@
1
+ <h3 id="sheet-name"><%= @presenter.sheet_title %></h3>
@@ -0,0 +1,66 @@
1
+ <% if !@presenter.active_page %>
2
+ <div>
3
+ The administrator has not set up this questionnaire yet.
4
+ </div>
5
+ <% else %>
6
+ <div id="controls">
7
+ <div id="panel">
8
+ <%= render partial: "fe/answer_sheets/pages_list" %>
9
+ </div>
10
+ <div id="legend">
11
+ <%= image_tag("fe/icons/question-balloon.png") %> <%= _("Rolling over this symbol gives you help") %><br/>
12
+ <%= image_tag("fe/icons/star-small.png") %> <%= _("Marks a required field") %>
13
+ </div>
14
+ </div>
15
+
16
+ <div id="preview">
17
+ <%= render partial: "fe/answer_sheets/title" %>
18
+ <%= render partial: "fe/answer_pages/answer_page", locals: { show_first: true } %>
19
+ </div>
20
+
21
+ <script type="text/javascript">
22
+ $(function() {
23
+ page_handler = fe.pageHandler;
24
+ page_handler.initialize("<%= @presenter.active_page_link.try(:dom_id) %>");
25
+ // Event.observe(window, "unload", page_handler.savePage);
26
+
27
+ // Validation.add("validate-phone", "Please enter a valid phone number +1-800-555-1234 x102", {
28
+ // pattern: /((\(\d{3}\)?)|(\d{3}))((\s|-|\.|\/)?)(\d{3})((\s|-|\.|\/)?)(\d{4})\s*([xX]|[eE][xX][tT])?\.?\s*\d*$/
29
+ // });
30
+ // Validation.add("validate-rating", "Please select one of the above options.", function(v,elm) {
31
+ // var p = elm.parentNode.parentNode;
32
+ // var options = p.getElementsByTagName("INPUT");
33
+ // return $A(options).any(function(elm) {
34
+ // return $F(elm);
35
+ // });
36
+ // })
37
+
38
+ // global responders for all Ajax requests
39
+ $(function() {
40
+ $(document).ajaxStart(function() {
41
+ $("#page_ajax_spinner").show();
42
+ $("#page_ajax_spinner").css({top: $(window).scrollTop() + 200});
43
+ }).ajaxComplete(function() {
44
+ $("#page_ajax_spinner").hide();
45
+ })
46
+ });
47
+ });
48
+ function updateTotals() {
49
+ // Set up js for all question grids with totals
50
+ <% if @page %>
51
+ <% @page.question_sheet.pages.collect(&:question_grid_with_totals).flatten.each do |question_grid_with_total|
52
+ question_grid_with_total.total_cols.split(",").collect(&:to_i).each do |col| -%>
53
+ try {
54
+ updateTotal("<%= "#{question_grid_with_total.id}_#{col - 1}" %>");
55
+ $(".col_<%= "#{question_grid_with_total.id}_#{col - 1}" %>").change(function(e) {
56
+ updateTotal("<%= "#{question_grid_with_total.id}_#{col - 1}" %>");
57
+ });
58
+ } catch(e) {}
59
+ <% end
60
+ end %>
61
+ <% end %>
62
+ }
63
+ $(function() { $(document).trigger("fePageLoaded"); });
64
+ </script>
65
+ <%= render "fe/answer_sheets/submit_to" %>
66
+ <% end %>
@@ -0,0 +1,11 @@
1
+ if ($('#submit_message, .submit_message').length == 0) {
2
+ $("ul#questions_list").filter(":visible").append("<li><div id=\"submit_message\"></div></li>");
3
+ }
4
+ $('#submit_message, .submit_message').html('<%= escape_javascript(render("incomplete")) %>')
5
+ <% @answer_sheet.pages.each do |page| %>
6
+ $page = $('<%= escape_javascript(render("fe/answer_sheets/page_link", page_link: @presenter.new_page_link(@answer_sheet, page))) %>');
7
+ <% id = "##{dom_id(@answer_sheet)}-#{dom_id(page)}-li" %>
8
+ $('<%= id %>').replaceWith($page.find('<%= id %>'));
9
+ <% end %>
10
+ $('#submit_message, .submit_message').show();
11
+ $('#'+fe.pageHandler.current_page+'-li').addClass('active');
@@ -0,0 +1,18 @@
1
+ <h1>Questionnaires</h1>
2
+
3
+ <% form_tag fe_answer_sheets_path do %>
4
+ <%= select_tag("question_sheet_id", options_for_select(@question_sheets)) %>
5
+ <%= submit_tag("Capture") %>
6
+ <% end -%>
7
+
8
+ <table cellspacing="0" class="list">
9
+ <% for answer_sheet in @answer_sheets %>
10
+ <tr>
11
+ <td><%= link_to answer_sheet.question_sheet.label, edit_fe_answer_sheet_path(answer_sheet) %></td>
12
+ <td><%= link_to "Review", fe_answer_sheet_path(answer_sheet), method: :get %></td>
13
+ </tr>
14
+ <% end %>
15
+ </table>
16
+
17
+ <br />
18
+
@@ -0,0 +1,8 @@
1
+ <% unless @reference.valid? %>
2
+ alert('<%= escape_javascript(@reference.errors.full_messages.join("\n").html_safe) %>');
3
+ <% else %>
4
+ <% if @reference.email_sent_at.present? %>
5
+ $('#ref_last_sent_<%= @reference.id %>').html('<%= @reference.email_sent_at.strftime("%m/%d/%Y @ %I:%M%p") %>')
6
+ $('#ref_last_sent_<%= @reference.id %>').effect("highlight", {}, 3000);
7
+ <% end %>
8
+ <% end %>
@@ -0,0 +1,13 @@
1
+ <div id="controls">
2
+ <div id="panel">
3
+ <div class="panel">
4
+ &nbsp;
5
+ </div>
6
+ </div>
7
+ </div>
8
+
9
+ <div id="preview" class="answer-page">
10
+
11
+ <%= render partial: "fe/answer_sheets/answer_sheet", locals: {answer_sheet: @answer_sheet, elements: @elements } %>
12
+
13
+ </div>
@@ -0,0 +1 @@
1
+ <% if user_signed_in? %><%= link_to(_("Log Out"), destroy_user_session_path, { method: :delete, style: "color: #fff;", id: "link-log-out" }) %><% end %>
@@ -0,0 +1 @@
1
+ Implement the applications show view in your app
@@ -0,0 +1,33 @@
1
+ <div id="help">
2
+ <h1>Form Designer Help</h1>
3
+
4
+ <h2>Pages</h2>
5
+
6
+ <p>Pages are the individual forms which make up a questionnaire. There must be
7
+ at least one page in your questionnaire, but there is no limit to the number
8
+ of pages allowed.</p>
9
+
10
+ <p>To add a page, click the "Add a page" link at the bottom of the list of
11
+ pages.</p>
12
+
13
+ <p>To edit a page's title, click the text of the title in the preview area on the right.</p>
14
+
15
+ <p>To edit the name of the questionnaire, click the text of the questionnaire's title in the preview area on the right.</p>
16
+
17
+ <h2>Elements</h2>
18
+
19
+ <p>Elements are the individual questions on a page. The list of elements can
20
+ be seen by clicking on the "Elements" tab. To add an element, simply
21
+ click the type you wish to add to your form. Once an element has been
22
+ added to a page, you can edit, reorder and add elements to grids.</p>
23
+
24
+ <p>To edit an element, click on the 'pencil' icon [ <img src="/images/fe/icons/pencil.png" style="height: 11px; width: 11px;" /> ].</p>
25
+
26
+ <p>To reorder elements, click on the 'drag' icon [ <img src="/images/fe/icons/move.png" style="height: 11px; width: 11px;" /> ]
27
+ and drag the element to the desired position in the list. If you need to scroll to get to the desired position, you can use either the scroll wheel on your mouse
28
+ or your keyboard (arrows, page up/down, etc).</p>
29
+
30
+ <p>To add an element to a grid, click on the 'drag' icon [ <img src="/images/fe/icons/move.png" style="height: 11px; width: 11px;" /> ] and drag the element onto the grid, within the gray border of the grid.</p>
31
+
32
+ <p>To remove an element from a grid, click the 'remove' icon [ <img src="/images/fe/icons/arrow_out.png" style="height: 11px; width: 11px;" /> ]. </p>
33
+ </div>
@@ -0,0 +1,18 @@
1
+ <div id="help">
2
+ <div style="float: right;"><a href="#" class="lbAction" rel="deactivate">close X</a></div>
3
+
4
+ <h1>Question Grid Help</h1>
5
+
6
+ <p>Grids will not be displayed in a grid format in the administration
7
+ system for easier editing and organization. Please view the public
8
+ application to preview the final grid format once you have fully assembled
9
+ your list of elements in the grid.</p>
10
+
11
+ <p>Set the number of columns and column headings using the <b>Column Headings</b>
12
+ field. When the formatted grid is displayed on an application, the
13
+ elements will be added left-to-right. A new row will be created depending
14
+ on the number of columns you've set for the grid. For example, if your
15
+ <b>Column Headings</b> are "Column 1;Column 2;Column 3", then you have three
16
+ columns and every three elements added to the grid will create a new
17
+ row in the grid.</p>
18
+ </div>
@@ -0,0 +1,14 @@
1
+ <% css_class = "checkbox " + acceptance.validation_class(@answer_sheet, @page)
2
+ checked = acceptance.has_answer?("1", @answer_sheet)
3
+ locked = acceptance.locked?(params, @answer_sheet, @presenter, current_person)
4
+ %>
5
+ <%= check_box_tag "answers[#{acceptance.id}]", "1",
6
+ checked,
7
+ id: dom_id(acceptance),
8
+ class: css_class,
9
+ disabled: locked,
10
+ readonly: locked %>
11
+ <label class="choice" for="<%= dom_id(acceptance) %>">
12
+ <%= raw acceptance.label(session[:locale]) %>
13
+ </label>
14
+ <%= hidden_field_tag "answers[#{acceptance.id}]", "", id: "" %>