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
@@ -1,3 +1,3 @@
1
- $('#panel').html('<%= escape_javascript(render('fe/admin/panels/prop_page', :page => @page)) %>');
1
+ $('#panel').html('<%= escape_javascript(render("fe/admin/panels/prop_page", page: @page)) %>');
2
2
  switchTab('properties');
3
3
  selectPage();
@@ -1,4 +1,4 @@
1
- $('#errors').html('<%= escape_javascript(render('errors', :element => @page)) %>')
1
+ $('#errors').html('<%= escape_javascript(render("errors", element: @page)) %>')
2
2
  <% @page.errors.each do |attr_name, message| %>
3
3
  addError("page_<%= attr_name %>")
4
4
  <% end %>
@@ -1,5 +1,5 @@
1
- $('#page-preview').html('<%= escape_javascript(render('fe/admin/question_pages/question_page')) %>')
2
- $('#nav-controls').html('<%= escape_javascript(render('fe/admin/panels/nav_controls')) %>')
1
+ $('#page-preview').html('<%= escape_javascript(render("fe/admin/question_pages/question_page")) %>')
2
+ $('#nav-controls').html('<%= escape_javascript(render("fe/admin/panels/nav_controls")) %>')
3
3
  switchTab("pages_list")
4
4
  $('#list-pages li').removeClass('active')
5
5
  $('#link-<%= dom_id(@page) %>').addClass('active')
@@ -1,3 +1,3 @@
1
- $('#panel').html('<%= escape_javascript(render('fe/admin/panels/' + @panel_name)) %>')
1
+ $('#panel').html('<%= escape_javascript(render("fe/admin/panels/#{@panel_name}")) %>')
2
2
  switchTab('<%= @tab_name %>')
3
3
  clearCurrentElement()
@@ -1,2 +1,2 @@
1
1
  $("#page-name").html('<%= escape_javascript(@page.label) %>')
2
- $('#panel').html('<%= escape_javascript(render('admin/panels/pages_list')) %>')
2
+ $('#panel').html('<%= escape_javascript(render("admin/panels/pages_list")) %>')
@@ -1,3 +1,3 @@
1
- $('#panel').html('<%= escape_javascript(render('fe/admin/panels/prop_sheet', :question_sheet => @question_sheet)) %>');
1
+ $('#panel').html('<%= escape_javascript(render("fe/admin/panels/prop_sheet", question_sheet: @question_sheet)) %>');
2
2
  clearPageName()
3
3
  clearCurrentElement()
@@ -1,4 +1,4 @@
1
- $('#errors').html('<%= escape_javascript(render('errors', :page => @question_sheet)) %>');
1
+ $('#errors').html('<%= escape_javascript(render("errors", page: @question_sheet)) %>');
2
2
 
3
3
  <% @question_sheet.errors.each do |attr_name, message| %>
4
4
  addError('question_sheet_<%= attr_name %>')
@@ -5,7 +5,7 @@
5
5
  <div style="background: #ffe5df; border: solid 1px #efbeb3; padding: 9px; margin: 0 0 18px;"><%= flash[:error] %></div>
6
6
  <% end -%>
7
7
 
8
- <%= link_to 'New Form', fe_admin_question_sheets_path(), :method => :post, :class => "add-link" %>
8
+ <%= link_to "New Form", fe_admin_question_sheets_path(), method: :post, class: "add-link" %>
9
9
  <br/>
10
10
  <table cellspacing="0" class="list">
11
11
  <tr>
@@ -14,10 +14,10 @@
14
14
  </tr>
15
15
  <% for question_sheet in @active_question_sheets %>
16
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", :class => 'delete' %></td>
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
21
  </tr>
22
22
  <% end %>
23
23
  </table>
@@ -31,9 +31,9 @@
31
31
  </tr>
32
32
  <% for question_sheet in @archived_question_sheets %>
33
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>
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
37
  </tr>
38
38
  <% end %>
39
39
  </table>
@@ -2,14 +2,14 @@
2
2
 
3
3
  <%= error_messages_for :question_sheet %>
4
4
 
5
- <% form_for(:question_sheet, :url => admin_question_sheets_path) do |f| %>
5
+ <%= form_for(:question_sheet, url: fe_admin_question_sheets_path) do |f| %>
6
6
  <p>
7
7
  <label for="question_sheet_label">Label</label>
8
- <%= f.text_field :label, :maxlength => 60 %>
8
+ <%= f.text_field :label, maxlength: 60 %>
9
9
  </p>
10
10
  <p>
11
11
  <%= submit_tag "Create" %>
12
12
  </p>
13
13
  <% end %>
14
14
 
15
- <%= link_to 'Back', admin_question_sheets_path %>
15
+ <%= link_to "Back", fe_admin_question_sheets_path %>
@@ -5,21 +5,21 @@ var activeElement = "";
5
5
  <div id="content">
6
6
  <div id="controls">
7
7
  <ul id="nav-controls">
8
- <%= render 'fe/admin/panels/nav_controls' %>
8
+ <%= render "fe/admin/panels/nav_controls" %>
9
9
  </ul>
10
10
 
11
11
  <div id="panel">
12
- <%= render 'fe/admin/panels/pages_list' %>
12
+ <%= render "fe/admin/panels/pages_list" %>
13
13
  </div>
14
14
  </div>
15
15
 
16
16
 
17
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" -%>
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
20
  </h2>
21
21
  <div id="page-preview">
22
- <%= render 'fe/admin/question_pages/question_page' %>
22
+ <%= render "fe/admin/question_pages/question_page" %>
23
23
  </div>
24
24
  </div>
25
25
 
@@ -1,2 +1,2 @@
1
1
  $('#sheet-name').html('<%= escape_javascript(@question_sheet.label) %>');
2
- $('#panel').html('<%= escape_javascript(render('fe/admin/panels/prop_sheet', :question_sheet => @question_sheet)) %>');
2
+ $('#panel').html('<%= escape_javascript(render("fe/admin/panels/prop_sheet", question_sheet: @question_sheet)) %>');
@@ -1,6 +1,5 @@
1
1
  <% if @presenter.active_page %>
2
- <% page_dom = @presenter.active_page_link.dom_id
3
- next_js = load_page_js(@presenter.next_page) -%>
2
+ <% page_dom = @presenter.active_page_link.dom_id %>
4
3
 
5
4
  <div id="<%= page_dom %>" class="answer-page" style="<% if show_first.nil? -%>display: none;<% end -%>"> <!-- this id is parsed by fe.public.js -->
6
5
 
@@ -8,37 +7,37 @@
8
7
  <%= render "fe/answer_pages/page_name" %>
9
8
 
10
9
  <% if @elements.length > 0 -%>
11
- <%= form_tag @presenter.active_page_link.save_path, :id => "#{page_dom}-form", :onsubmit => "$.fe.pageHandler.savePage($('#sp_application_55716-page_331')); return false;", :multipart => true do -%>
12
- <%= hidden_field_tag 'a', params[:a] %>
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] %>
13
12
  <ul class="questions" id="questions_list">
14
13
  <% previous_element = nil %>
15
14
  <% @elements.each do |element| %>
16
- <li style="<%= 'display:none' if previous_element && previous_element.conditional == element && !previous_element.conditional_match(@answer_sheet) %>" 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 %>>
17
- <%= render 'fe/answer_pages/element', :element => 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 %>
18
17
  </li>
19
18
  <% previous_element = element %>
20
19
  <% end %>
21
20
  </ul>
22
21
 
23
- <% if next_js.empty? -%>
22
+ <% unless @presenter.next_page -%>
24
23
  <div id="submit_message" class="validation-advice" style="display: none;"></div>
25
24
  <div>
26
- <button type="button" class="button save_button"><%= _('Save Now') %></button>
27
- <button type="submit" class="button cru-gold no-left-margin" onclick="page_handler.completeAll(); return false;" id="submit_button"><%= _('Submit') %></button>
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>
28
27
  </div>
29
28
  <% else -%>
30
29
  <div class="savestatus">
31
- <%= _('Last Saved:') %> <span class="last-saved"><%= l(@answer_sheet.updated_at, :format => :datetime) %></span><%= spinner(page_dom) %>
30
+ <%= _("Last Saved:") %> <span class="last-saved"><%= l(@answer_sheet.updated_at, format: :datetime) %></span><%= spinner(page_dom) %>
32
31
  </div>
33
32
  <div>
34
- <button type="button" class="button no-left-margin save_button"><%= _('Save Now') %></button>
35
- <button type="button" class="button cru-gold" onclick="<%= next_js %>"><%= _('Next >>') %></button>
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>
36
35
  </div>
37
36
  <% end -%>
38
37
  <% end -%>
39
38
  <% else -%>
40
39
  <div style="background: #ffc;">
41
- <p><%= _('There are no questions on this page.') %></p>
40
+ <p><%= _("There are no questions on this page.") %></p>
42
41
  </div>
43
42
  <% end -%>
44
43
  </div>
@@ -47,7 +46,7 @@
47
46
  <% if session[:attempted_submit] %>
48
47
  <script type="text/javascript" charset="utf-8">
49
48
  $(function() {
50
- $.fe.pageHandler.validatePage('<%= page_dom %>')
49
+ fe.pageHandler.validatePage("<%= page_dom %>")
51
50
  });
52
51
  </script>
53
52
  <% end %>
@@ -1,12 +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 %>
1
20
 
2
21
  <% if element.question? && element.default_label? && element.label.present? && !element.hide_label? -%>
3
22
  <label for="<%= dom_id(element) %>" class="desc">
4
23
  <%= raw element.label(session[:locale]) %>
5
- <% if element.required?(@answer_sheet, @page) -%><span class="required"><%= _('required') %></span><% end -%>
24
+ <% if element.required?(@answer_sheet, @page) -%><span class="required"><%= _("required") %></span><% end -%>
6
25
  <%= tip(element.tooltip) if element.tooltip.present? %>
7
26
  </label>
8
27
  <% end -%>
9
28
 
10
29
  <% col ||= nil %>
11
- <%= render :partial => 'fe/questions/' + element.ptemplate, :object => element, :locals => {:col => col} %>
30
+ <%= render partial: "fe/questions/" + element.ptemplate, object: element, locals: {col: col} %>
12
31
 
32
+ <% end %>
@@ -1 +1 @@
1
- <h4 id='page-name'><%= @presenter.active_page.label(session[:locale]) %></h4>
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 %>
@@ -1,5 +1,13 @@
1
- $('.last-saved').html('<%= escape_javascript(l(@saved_at_timestamp, :format => :datetime)) %>')
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 %>
2
4
  <% if @answer && @answer.attachment_file_name %>
3
- $('#<%= dom_id(@answer.question) %>_filename').html('Current File: <%= link_to(@answer.attachment_file_name, @answer.attachment.url) %>')
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) %>')
4
10
  $('#<%= dom_id(@answer.question) %>_filename').effect('highlight')
11
+ <% elsif @answer %>
12
+ $('#<%= dom_id(@answer.question) %>_filename').html('')
5
13
  <% end %>
@@ -1,15 +1,15 @@
1
- <h3 id='sheet-name'><%= answer_sheet.question_sheet.label %></h3>
1
+ <h3 id="sheet-name"><%= answer_sheet.question_sheet.label %></h3>
2
2
 
3
3
  <% if elements.length > 0 -%>
4
4
 
5
5
  <% elements.each do |page, page_elements| -%>
6
6
  <% next unless page.has_questions? %>
7
- <a name="<%= dom_id(page) %>"></a>
7
+ <a name="<%= dom_id(page) %>" class="anchor"></a>
8
8
 
9
9
  <div class="page" data-page-id="<%= page.id %>">
10
10
  <h3><%= page.label %></h3>
11
11
  <ul class="questions readonly" start="<%= @question_number %>">
12
- <%= render :partial => 'fe/answer_sheets/element', :collection => page_elements, :locals => {:elements => page_elements} %>
12
+ <%= render partial: "fe/answer_sheets/element", collection: page_elements, locals: {elements: page_elements} %>
13
13
  </ul>
14
14
  </div>
15
15
 
@@ -20,7 +20,7 @@
20
20
  <% else -%>
21
21
 
22
22
  <div style="background: #ffc;">
23
- <p>That's odd. There are no answers to review.</p>
23
+ <p>That"s odd. There are no answers to review.</p>
24
24
  </div>
25
25
 
26
26
  <% end -%>
@@ -1,11 +1,13 @@
1
1
  <% if element.kind == "Fe::QuestionGrid" || element.kind == "Fe::QuestionGridWithTotal"-%>
2
2
  <li>
3
- <label class="desc"><%= raw element.label %></label>
3
+ <% unless element.hide_label? %>
4
+ <label class="desc"><%= raw element.label %></label>
5
+ <% end %>
4
6
  <table class="grid">
5
7
  <%- if element.cols -%>
6
8
  <tr>
7
- <%- element.cols.split(';').each do |header| -%>
8
- <th><%= raw header || '&nbsp;' %></th>
9
+ <%- element.cols.split(";").each do |header| -%>
10
+ <th><%= raw header || "&nbsp;" %></th>
9
11
  <%- end -%>
10
12
  </tr>
11
13
  <%- end -%>
@@ -31,10 +33,10 @@
31
33
  <%- end -%>
32
34
  <% elsif grid_element.is_a?(Fe::QuestionGrid) || grid_element.is_a?(Fe::QuestionGridWithTotal) %>
33
35
  <ul>
34
- <%= render :partial => 'fe/answer_sheets/element', :object => grid_element %>
36
+ <%= render partial: "fe/answer_sheets/element", object: grid_element %>
35
37
  </ul>
36
38
  <% else %>
37
- <%= render :partial => 'fe/questions/' + element.ptemplate, :object => element %>
39
+ <%= render partial: "fe/questions/" + element.ptemplate, object: element %>
38
40
  <% end %>
39
41
  <% end -%>
40
42
  </td>
@@ -63,10 +65,10 @@
63
65
  <span class="answer"><%= simple_format element.display_response(@answer_sheet) %></span>
64
66
  <%- end -%>
65
67
  <% else -%>
66
- <%= render :partial => 'fe/questions/' + element.ptemplate, :object => element %>
68
+ <%= render partial: "fe/questions/" + element.ptemplate, object: element %>
67
69
  <% end -%>
68
70
  </li>
69
71
  <% element.choice_field_children.each do |choice_field_child| %>
70
- <%= render 'fe/answer_sheets/element', element: choice_field_child %>
72
+ <%= render "fe/answer_sheets/element", element: choice_field_child %>
71
73
  <% end %>
72
74
  <% end -%>
@@ -1,5 +1,5 @@
1
1
  <div class="submission_errors">
2
- <p><%= _('You still need to answer questions on the following pages:') %></p>
2
+ <p><%= _("You still need to answer questions on the following pages:") %></p>
3
3
  <ul>
4
4
  <% @answer_sheet.pages.each do |page| %>
5
5
  <% unless page.complete?(@answer_sheet) %>
@@ -1,7 +1,9 @@
1
- <% css_class = '' %>
2
- <% if session[:attempted_submit] && page_link.page.has_questions? %>
3
- <% css_class = page_link.page.complete?(@answer_sheet) ? 'complete' : 'incomplete' %>
4
- <% end %>
5
- <%= 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 %>
6
- <%= 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) %>
7
- <% end -%>
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>
@@ -1,11 +1,11 @@
1
1
  <div id="panel-pages">
2
- <h4><%= _('Application Sections') %></h4>
2
+ <h4><%= _("Application Sections") %></h4>
3
3
  <div id="page_ajax_spinner" style="display:none;">
4
4
  <div>
5
- <%= image_tag 'fe/ajax-loader.gif' %> <%= _('Loading...') %>
5
+ <%= image_tag "fe/ajax-loader.gif" %> <%= _("Loading...") %>
6
6
  </div>
7
7
  </div>
8
8
  <ul id="list-pages" class="navigation-list">
9
- <%= render :partial => 'fe/answer_sheets/page_link', :collection => @presenter.page_links %>
9
+ <%= render partial: "fe/answer_sheets/page_link", collection: @presenter.page_links %>
10
10
  </ul>
11
11
  </div>
@@ -1 +1 @@
1
- <%= hidden_field_tag 'submit_to', submit_fe_answer_sheet_path(@answer_sheet), :id => 'submit_to' %>
1
+ <%= hidden_field_tag "submit_to", submit_fe_answer_sheet_path(@answer_sheet), id: "submit_to" %>
@@ -1 +1 @@
1
- <h3 id='sheet-name'><%= @presenter.sheet_title %></h3>
1
+ <h3 id="sheet-name"><%= @presenter.sheet_title %></h3>
@@ -5,31 +5,31 @@
5
5
  <% else %>
6
6
  <div id="controls">
7
7
  <div id="panel">
8
- <%= render :partial => 'fe/answer_sheets/pages_list' %>
8
+ <%= render partial: "fe/answer_sheets/pages_list" %>
9
9
  </div>
10
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') %>
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
13
  </div>
14
14
  </div>
15
15
 
16
16
  <div id="preview">
17
- <%= render :partial => 'fe/answer_sheets/title' %>
18
- <%= render :partial => 'fe/answer_pages/answer_page', :locals => { :show_first => true } %>
17
+ <%= render partial: "fe/answer_sheets/title" %>
18
+ <%= render partial: "fe/answer_pages/answer_page", locals: { show_first: true } %>
19
19
  </div>
20
20
 
21
21
  <script type="text/javascript">
22
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);
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
26
 
27
- // Validation.add('validate-phone', 'Please enter a valid phone number +1-800-555-1234 x102', {
27
+ // Validation.add("validate-phone", "Please enter a valid phone number +1-800-555-1234 x102", {
28
28
  // pattern: /((\(\d{3}\)?)|(\d{3}))((\s|-|\.|\/)?)(\d{3})((\s|-|\.|\/)?)(\d{4})\s*([xX]|[eE][xX][tT])?\.?\s*\d*$/
29
29
  // });
30
- // Validation.add('validate-rating', 'Please select one of the above options.', function(v,elm) {
30
+ // Validation.add("validate-rating", "Please select one of the above options.", function(v,elm) {
31
31
  // var p = elm.parentNode.parentNode;
32
- // var options = p.getElementsByTagName('INPUT');
32
+ // var options = p.getElementsByTagName("INPUT");
33
33
  // return $A(options).any(function(elm) {
34
34
  // return $F(elm);
35
35
  // });
@@ -38,10 +38,10 @@
38
38
  // global responders for all Ajax requests
39
39
  $(function() {
40
40
  $(document).ajaxStart(function() {
41
- $('#page_ajax_spinner').show();
42
- $('#page_ajax_spinner').css({top: $(window).scrollTop() + 200});
41
+ $("#page_ajax_spinner").show();
42
+ $("#page_ajax_spinner").css({top: $(window).scrollTop() + 200});
43
43
  }).ajaxComplete(function() {
44
- $('#page_ajax_spinner').hide();
44
+ $("#page_ajax_spinner").hide();
45
45
  })
46
46
  });
47
47
  });
@@ -49,18 +49,18 @@
49
49
  // Set up js for all question grids with totals
50
50
  <% if @page %>
51
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| -%>
52
+ question_grid_with_total.total_cols.split(",").collect(&:to_i).each do |col| -%>
53
53
  try {
54
- updateTotal('<%= "#{question_grid_with_total.id}_#{col - 1}" %>');
54
+ updateTotal("<%= "#{question_grid_with_total.id}_#{col - 1}" %>");
55
55
  $(".col_<%= "#{question_grid_with_total.id}_#{col - 1}" %>").change(function(e) {
56
- updateTotal('<%= "#{question_grid_with_total.id}_#{col - 1}" %>');
56
+ updateTotal("<%= "#{question_grid_with_total.id}_#{col - 1}" %>");
57
57
  });
58
58
  } catch(e) {}
59
59
  <% end
60
60
  end %>
61
61
  <% end %>
62
62
  }
63
- $(function() { $(document).trigger('fePageLoaded'); });
63
+ $(function() { $(document).trigger("fePageLoaded"); });
64
64
  </script>
65
65
  <%= render "fe/answer_sheets/submit_to" %>
66
66
  <% end %>
@@ -1,8 +1,11 @@
1
- if ($('#submit_message').length == 0) {
1
+ if ($('#submit_message, .submit_message').length == 0) {
2
2
  $("ul#questions_list").filter(":visible").append("<li><div id=\"submit_message\"></div></li>");
3
3
  }
4
- $('#submit_message').html('<%= escape_javascript(render('incomplete')) %>')
4
+ $('#submit_message, .submit_message').html('<%= escape_javascript(render("incomplete")) %>')
5
5
  <% @answer_sheet.pages.each do |page| %>
6
- $('#<%= dom_id(@answer_sheet) %>-<%= dom_id(page) %>-li').replaceWith('<%= escape_javascript(render('fe/answer_sheets/page_link', :page_link => @presenter.new_page_link(@answer_sheet, 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 %>'));
7
9
  <% end %>
8
- $('#submit_message').show();
10
+ $('#submit_message, .submit_message').show();
11
+ $('#'+fe.pageHandler.current_page+'-li').addClass('active');
@@ -9,7 +9,7 @@
9
9
  <% for answer_sheet in @answer_sheets %>
10
10
  <tr>
11
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>
12
+ <td><%= link_to "Review", fe_answer_sheet_path(answer_sheet), method: :get %></td>
13
13
  </tr>
14
14
  <% end %>
15
15
  </table>
@@ -8,6 +8,6 @@
8
8
 
9
9
  <div id="preview" class="answer-page">
10
10
 
11
- <%= render :partial => 'fe/answer_sheets/answer_sheet', :locals => {:answer_sheet => @answer_sheet, :elements => @elements } %>
11
+ <%= render partial: "fe/answer_sheets/answer_sheet", locals: {answer_sheet: @answer_sheet, elements: @elements } %>
12
12
 
13
13
  </div>
@@ -1 +1 @@
1
- <% if user_signed_in? %><%= link_to(_("Log Out"), destroy_user_session_path, { :method => :delete, :style => "color: #fff;", :id => "link-log-out" }) %><% end %>
1
+ <% if user_signed_in? %><%= link_to(_("Log Out"), destroy_user_session_path, { method: :delete, style: "color: #fff;", id: "link-log-out" }) %><% end %>
@@ -1,13 +1,14 @@
1
- <% css_class = 'checkbox ' + acceptance.validation_class(@answer_sheet)
2
- checked = acceptance.has_answer?('1', @answer_sheet)
3
- -%>
4
- <%= check_box_tag "answers[#{acceptance.id}]", '1',
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",
5
6
  checked,
6
- :id => dom_id(acceptance),
7
- :class => css_class,
8
- :disabled => @answer_sheet.frozen?&&!@answer_sheet.try(:reference?),
9
- :readonly => @answer_sheet.frozen?&&!@answer_sheet.try(:reference?) %>
7
+ id: dom_id(acceptance),
8
+ class: css_class,
9
+ disabled: locked,
10
+ readonly: locked %>
10
11
  <label class="choice" for="<%= dom_id(acceptance) %>">
11
12
  <%= raw acceptance.label(session[:locale]) %>
12
13
  </label>
13
- <%= hidden_field_tag "answers[#{acceptance.id}]", '', :id => '' %>
14
+ <%= hidden_field_tag "answers[#{acceptance.id}]", "", id: "" %>