fe 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +20 -0
  4. data/Rakefile +48 -0
  5. data/app/assets/images/fe/ajax-loader.gif +0 -0
  6. data/app/assets/images/fe/butgrad.png +0 -0
  7. data/app/assets/images/fe/icons/add.png +0 -0
  8. data/app/assets/images/fe/icons/application_form.png +0 -0
  9. data/app/assets/images/fe/icons/application_form_add.png +0 -0
  10. data/app/assets/images/fe/icons/arrow-move.png +0 -0
  11. data/app/assets/images/fe/icons/arrow_out.png +0 -0
  12. data/app/assets/images/fe/icons/asterisk_yellow.png +0 -0
  13. data/app/assets/images/fe/icons/book-open-list.png +0 -0
  14. data/app/assets/images/fe/icons/book_open.png +0 -0
  15. data/app/assets/images/fe/icons/briefcase.png +0 -0
  16. data/app/assets/images/fe/icons/calendar_view_day.png +0 -0
  17. data/app/assets/images/fe/icons/checkbox.png +0 -0
  18. data/app/assets/images/fe/icons/copy_paste.gif +0 -0
  19. data/app/assets/images/fe/icons/disk.png +0 -0
  20. data/app/assets/images/fe/icons/document--pencil.png +0 -0
  21. data/app/assets/images/fe/icons/document-copy.png +0 -0
  22. data/app/assets/images/fe/icons/map_magnify.png +0 -0
  23. data/app/assets/images/fe/icons/minus-button.png +0 -0
  24. data/app/assets/images/fe/icons/move.png +0 -0
  25. data/app/assets/images/fe/icons/page_error.png +0 -0
  26. data/app/assets/images/fe/icons/page_valid.png +0 -0
  27. data/app/assets/images/fe/icons/page_white.png +0 -0
  28. data/app/assets/images/fe/icons/page_white_add.png +0 -0
  29. data/app/assets/images/fe/icons/page_white_error.png +0 -0
  30. data/app/assets/images/fe/icons/paper-clip.png +0 -0
  31. data/app/assets/images/fe/icons/pencil-small.png +0 -0
  32. data/app/assets/images/fe/icons/pencil.png +0 -0
  33. data/app/assets/images/fe/icons/question-balloon.png +0 -0
  34. data/app/assets/images/fe/icons/radio.png +0 -0
  35. data/app/assets/images/fe/icons/star-small.png +0 -0
  36. data/app/assets/images/fe/icons/table.png +0 -0
  37. data/app/assets/images/fe/icons/text_align_left.png +0 -0
  38. data/app/assets/images/fe/icons/text_horizontalrule.png +0 -0
  39. data/app/assets/images/fe/icons/textfield.png +0 -0
  40. data/app/assets/images/fe/indent.png +0 -0
  41. data/app/assets/images/fe/overlay.png +0 -0
  42. data/app/assets/images/fe/selected_bg.jpg +0 -0
  43. data/app/assets/images/fe/status.gif +0 -0
  44. data/app/assets/images/fe/tooltip/black.png +0 -0
  45. data/app/assets/images/fe/tooltip/black_arrow.png +0 -0
  46. data/app/assets/images/fe/tooltip/black_arrow_big.png +0 -0
  47. data/app/assets/images/fe/tooltip/black_big.png +0 -0
  48. data/app/assets/images/fe/tooltip/white.png +0 -0
  49. data/app/assets/images/fe/tooltip/white_arrow.png +0 -0
  50. data/app/assets/images/fe/tooltip/white_arrow_big.png +0 -0
  51. data/app/assets/images/fe/tooltip/white_big.png +0 -0
  52. data/app/assets/images/fe/uploadify/cancel.png +0 -0
  53. data/app/assets/images/fe/uploadify/uploadify.swf +0 -0
  54. data/app/assets/javascripts/fe/admin.js +7 -0
  55. data/app/assets/javascripts/fe/jquery.metadata.js +122 -0
  56. data/app/assets/javascripts/fe/jquery.scrollTo-min.js +7 -0
  57. data/app/assets/javascripts/fe/jquery.uploadify.v2.1.0.js +258 -0
  58. data/app/assets/javascripts/fe/jquery.validate.pack.js +15 -0
  59. data/app/assets/javascripts/fe/qe.admin.js +115 -0
  60. data/app/assets/javascripts/fe/qe.common.js +57 -0
  61. data/app/assets/javascripts/fe/qe.public.js +331 -0
  62. data/app/assets/javascripts/fe/swfobject.js +4 -0
  63. data/app/assets/stylesheets/fe/qe.screen.css.scss.erb +552 -0
  64. data/app/assets/stylesheets/fe/reset.css +55 -0
  65. data/app/assets/stylesheets/fe/validation.css +91 -0
  66. data/app/controllers/fe/admin/elements_controller.rb +185 -0
  67. data/app/controllers/fe/admin/email_templates_controller.rb +61 -0
  68. data/app/controllers/fe/admin/question_pages_controller.rb +113 -0
  69. data/app/controllers/fe/admin/question_sheets_controller.rb +106 -0
  70. data/app/controllers/fe/answer_pages_controller.rb +3 -0
  71. data/app/controllers/fe/answer_sheets_controller.rb +3 -0
  72. data/app/controllers/fe/concerns/answer_pages_controller_concern.rb +80 -0
  73. data/app/controllers/fe/concerns/answer_sheets_controller_concern.rb +84 -0
  74. data/app/controllers/fe/reference_sheets_controller.rb +29 -0
  75. data/app/helpers/fe/answer_pages_helper.rb +19 -0
  76. data/app/helpers/fe/application_helper.rb +49 -0
  77. data/app/mailers/fe/notifier.rb +22 -0
  78. data/app/models/fe/answer.rb +13 -0
  79. data/app/models/fe/answer_pages_presenter.rb +13 -0
  80. data/app/models/fe/answer_sheet.rb +10 -0
  81. data/app/models/fe/answer_sheet_question_sheet.rb +7 -0
  82. data/app/models/fe/attachment_field.rb +7 -0
  83. data/app/models/fe/choice_field.rb +7 -0
  84. data/app/models/fe/concerns/answer_concern.rb +36 -0
  85. data/app/models/fe/concerns/answer_pages_presenter_concern.rb +99 -0
  86. data/app/models/fe/concerns/answer_sheet_concern.rb +61 -0
  87. data/app/models/fe/concerns/choice_field_concern.rb +131 -0
  88. data/app/models/fe/condition.rb +53 -0
  89. data/app/models/fe/date_field.rb +52 -0
  90. data/app/models/fe/element.rb +164 -0
  91. data/app/models/fe/email_template.rb +7 -0
  92. data/app/models/fe/option.rb +10 -0
  93. data/app/models/fe/option_group.rb +10 -0
  94. data/app/models/fe/page.rb +101 -0
  95. data/app/models/fe/page_element.rb +9 -0
  96. data/app/models/fe/page_link.rb +15 -0
  97. data/app/models/fe/paragraph.rb +10 -0
  98. data/app/models/fe/payment.rb +52 -0
  99. data/app/models/fe/payment_question.rb +22 -0
  100. data/app/models/fe/presenter.rb +23 -0
  101. data/app/models/fe/question.rb +256 -0
  102. data/app/models/fe/question_grid.rb +26 -0
  103. data/app/models/fe/question_grid_with_total.rb +11 -0
  104. data/app/models/fe/question_set.rb +82 -0
  105. data/app/models/fe/question_sheet.rb +73 -0
  106. data/app/models/fe/reference_question.rb +42 -0
  107. data/app/models/fe/reference_sheet.rb +149 -0
  108. data/app/models/fe/section.rb +12 -0
  109. data/app/models/fe/state_chooser.rb +10 -0
  110. data/app/models/fe/text_field.rb +29 -0
  111. data/app/views/fe/admin/elements/_errors.html.erb +1 -0
  112. data/app/views/fe/admin/elements/create.js.erb +11 -0
  113. data/app/views/fe/admin/elements/destroy.js.erb +4 -0
  114. data/app/views/fe/admin/elements/drop.js.erb +2 -0
  115. data/app/views/fe/admin/elements/duplicate.js.erb +2 -0
  116. data/app/views/fe/admin/elements/edit.js.erb +4 -0
  117. data/app/views/fe/admin/elements/error.js.erb +4 -0
  118. data/app/views/fe/admin/elements/new.js.erb +10 -0
  119. data/app/views/fe/admin/elements/reorder.js.erb +0 -0
  120. data/app/views/fe/admin/elements/update.js.erb +9 -0
  121. data/app/views/fe/admin/email_templates/_form.html.erb +8 -0
  122. data/app/views/fe/admin/email_templates/edit.html.erb +13 -0
  123. data/app/views/fe/admin/email_templates/index.html.erb +20 -0
  124. data/app/views/fe/admin/email_templates/new.html.erb +11 -0
  125. data/app/views/fe/admin/panels/_advanced_options.html.erb +16 -0
  126. data/app/views/fe/admin/panels/_common_fields.html.erb +24 -0
  127. data/app/views/fe/admin/panels/_condition.html.erb +6 -0
  128. data/app/views/fe/admin/panels/_insert.html.erb +39 -0
  129. data/app/views/fe/admin/panels/_nav_controls.html.erb +6 -0
  130. data/app/views/fe/admin/panels/_page.html.erb +3 -0
  131. data/app/views/fe/admin/panels/_pages_list.html.erb +16 -0
  132. data/app/views/fe/admin/panels/_prop_attachment_field.html.erb +2 -0
  133. data/app/views/fe/admin/panels/_prop_choice_field.html.erb +46 -0
  134. data/app/views/fe/admin/panels/_prop_date_field.html.erb +7 -0
  135. data/app/views/fe/admin/panels/_prop_element.html.erb +30 -0
  136. data/app/views/fe/admin/panels/_prop_page.html.erb +21 -0
  137. data/app/views/fe/admin/panels/_prop_paragraph.html.erb +32 -0
  138. data/app/views/fe/admin/panels/_prop_question_grid.html.erb +23 -0
  139. data/app/views/fe/admin/panels/_prop_question_grid_with_total.html.erb +14 -0
  140. data/app/views/fe/admin/panels/_prop_reference_question.html.erb +12 -0
  141. data/app/views/fe/admin/panels/_prop_section.html.erb +2 -0
  142. data/app/views/fe/admin/panels/_prop_sheet.html.erb +17 -0
  143. data/app/views/fe/admin/panels/_prop_text_field.html.erb +20 -0
  144. data/app/views/fe/admin/question_pages/_element.html.erb +18 -0
  145. data/app/views/fe/admin/question_pages/_element_show.html.erb +10 -0
  146. data/app/views/fe/admin/question_pages/_errors.html.erb +1 -0
  147. data/app/views/fe/admin/question_pages/_question_page.html.erb +13 -0
  148. data/app/views/fe/admin/question_pages/create.js.erb +11 -0
  149. data/app/views/fe/admin/question_pages/destroy.js.erb +5 -0
  150. data/app/views/fe/admin/question_pages/edit.js.erb +3 -0
  151. data/app/views/fe/admin/question_pages/error.js.erb +4 -0
  152. data/app/views/fe/admin/question_pages/show.js.erb +8 -0
  153. data/app/views/fe/admin/question_pages/show_panel.js.erb +3 -0
  154. data/app/views/fe/admin/question_pages/update.js.erb +2 -0
  155. data/app/views/fe/admin/question_sheets/_errors.html.erb +1 -0
  156. data/app/views/fe/admin/question_sheets/edit.js.erb +3 -0
  157. data/app/views/fe/admin/question_sheets/error.js.erb +5 -0
  158. data/app/views/fe/admin/question_sheets/index.html.erb +41 -0
  159. data/app/views/fe/admin/question_sheets/new.html.erb +15 -0
  160. data/app/views/fe/admin/question_sheets/show.html.erb +27 -0
  161. data/app/views/fe/admin/question_sheets/update.js.erb +2 -0
  162. data/app/views/fe/answer_pages/_answer_page.html.erb +56 -0
  163. data/app/views/fe/answer_pages/_element.html.erb +9 -0
  164. data/app/views/fe/answer_pages/update.js.erb +5 -0
  165. data/app/views/fe/answer_sheets/_answer_sheet.html.erb +24 -0
  166. data/app/views/fe/answer_sheets/_element.html.erb +54 -0
  167. data/app/views/fe/answer_sheets/_incomplete.html.erb +10 -0
  168. data/app/views/fe/answer_sheets/_page_link.html.erb +7 -0
  169. data/app/views/fe/answer_sheets/_pages_list.html.erb +11 -0
  170. data/app/views/fe/answer_sheets/_title.html.erb +1 -0
  171. data/app/views/fe/answer_sheets/edit.html.erb +60 -0
  172. data/app/views/fe/answer_sheets/incomplete.js.erb +5 -0
  173. data/app/views/fe/answer_sheets/index.html.erb +18 -0
  174. data/app/views/fe/answer_sheets/send_reference_invite.js.erb +8 -0
  175. data/app/views/fe/answer_sheets/show.html.erb +13 -0
  176. data/app/views/fe/help/builder.html +33 -0
  177. data/app/views/fe/help/question_grid.html +18 -0
  178. data/app/views/fe/questions/_acceptance.html.erb +13 -0
  179. data/app/views/fe/questions/_attachment_field.html.erb +42 -0
  180. data/app/views/fe/questions/_checkbox_field.html.erb +49 -0
  181. data/app/views/fe/questions/_country.html.erb +7 -0
  182. data/app/views/fe/questions/_date_field.html.erb +7 -0
  183. data/app/views/fe/questions/_date_field_mmyy.html.erb +9 -0
  184. data/app/views/fe/questions/_drop_down_field.html.erb +7 -0
  185. data/app/views/fe/questions/_paragraph.html.erb +1 -0
  186. data/app/views/fe/questions/_question_grid.html.erb +65 -0
  187. data/app/views/fe/questions/_question_grid_with_total.html.erb +57 -0
  188. data/app/views/fe/questions/_questions.html.erb +9 -0
  189. data/app/views/fe/questions/_radio_button_field.html.erb +41 -0
  190. data/app/views/fe/questions/_rating.html.erb +25 -0
  191. data/app/views/fe/questions/_reference_discipler.html.erb +1 -0
  192. data/app/views/fe/questions/_reference_friend.html.erb +1 -0
  193. data/app/views/fe/questions/_reference_parent.html.erb +1 -0
  194. data/app/views/fe/questions/_reference_peer.html.erb +1 -0
  195. data/app/views/fe/questions/_reference_question.html.erb +38 -0
  196. data/app/views/fe/questions/_reference_roommate.html.erb +1 -0
  197. data/app/views/fe/questions/_reference_spiritual.html.erb +1 -0
  198. data/app/views/fe/questions/_reference_staff.html.erb +1 -0
  199. data/app/views/fe/questions/_section.html.erb +1 -0
  200. data/app/views/fe/questions/_state_chooser.html.erb +7 -0
  201. data/app/views/fe/questions/_text_area_field.html.erb +6 -0
  202. data/app/views/fe/questions/_text_field.html.erb +8 -0
  203. data/app/views/fe/questions/_yes_no.html.erb +17 -0
  204. data/app/views/fe/questions/_yes_no_field.erb +17 -0
  205. data/app/views/fe/reference_sheets/not_found.html.erb +5 -0
  206. data/app/views/layouts/fe/application.html.erb +31 -0
  207. data/app/views/layouts/fe/qe.admin.html.erb +30 -0
  208. data/config/routes.rb +49 -0
  209. data/db/migrate/20131003041856_core.rb +91 -0
  210. data/db/migrate/20131003044250_create_reference_sheets.rb +23 -0
  211. data/db/migrate/20131003044436_add_element_and_answer_fields.rb +10 -0
  212. data/db/migrate/20131003044518_create_email_templates.rb +17 -0
  213. data/db/migrate/20131003044621_add_max_lengths.rb +8 -0
  214. data/db/migrate/20131003044714_create_join_table.rb +11 -0
  215. data/db/migrate/20131016162128_remove_question_id_from_element.rb +9 -0
  216. data/lib/fe.rb +22 -0
  217. data/lib/fe/engine.rb +19 -0
  218. data/lib/fe/version.rb +3 -0
  219. data/lib/generators/fe/install_generator.rb +132 -0
  220. data/lib/tasks/qe_tasks.rake +4 -0
  221. data/spec/controllers/fe/admin/elements_controller_spec.rb +4 -0
  222. data/spec/controllers/fe/admin/email_templates_controller_spec.rb +4 -0
  223. data/spec/controllers/fe/admin/question_pages_controller_spec.rb +4 -0
  224. data/spec/controllers/fe/admin/question_sheets_controller_spec.rb +4 -0
  225. data/spec/controllers/fe/answer_pages_controller_spec.rb +4 -0
  226. data/spec/controllers/fe/answer_sheets_controller_spec.rb +4 -0
  227. data/spec/controllers/fe/reference_sheets_controller_spec.rb +4 -0
  228. data/spec/factories/answer_sheets.rb +5 -0
  229. data/spec/factories/answers.rb +4 -0
  230. data/spec/factories/paragraphs.rb +4 -0
  231. data/spec/factories/question_sheet.rb +5 -0
  232. data/spec/factories/reference_questions.rb +4 -0
  233. data/spec/models/fe/answer_sheet_question_sheet_spec.rb +6 -0
  234. data/spec/models/fe/answer_sheet_spec.rb +8 -0
  235. data/spec/models/fe/answer_spec.rb +13 -0
  236. data/spec/models/fe/attachment_field_spec.rb +4 -0
  237. data/spec/models/fe/choice_field_spec.rb +5 -0
  238. data/spec/models/fe/condition_spec.rb +8 -0
  239. data/spec/models/fe/date_field_spec.rb +49 -0
  240. data/spec/models/fe/element_spec.rb +12 -0
  241. data/spec/models/fe/email_template_spec.rb +5 -0
  242. data/spec/models/fe/option_group_spec.rb +4 -0
  243. data/spec/models/fe/option_spec.rb +4 -0
  244. data/spec/models/fe/page_element_spec.rb +6 -0
  245. data/spec/models/fe/page_link_spec.rb +4 -0
  246. data/spec/models/fe/page_spec.rb +14 -0
  247. data/spec/models/fe/paragraph_spec.rb +17 -0
  248. data/spec/models/fe/question_grid_spec.rb +4 -0
  249. data/spec/models/fe/question_grid_with_total_spec.rb +4 -0
  250. data/spec/models/fe/question_set_spec.rb +4 -0
  251. data/spec/models/fe/question_sheet_spec.rb +8 -0
  252. data/spec/models/fe/question_spec.rb +20 -0
  253. data/spec/models/fe/reference_question_spec.rb +17 -0
  254. data/spec/models/fe/reference_sheet_spec.rb +11 -0
  255. data/spec/models/fe/section_spec.rb +4 -0
  256. data/spec/models/fe/state_chooser_spec.rb +4 -0
  257. data/spec/models/fe/text_field_spec.rb +17 -0
  258. data/spec/spec_helper.rb +66 -0
  259. data/spec/support/database.txt +28 -0
  260. metadata +508 -0
@@ -0,0 +1 @@
1
+ <%= render 'questions/reference_question', :reference_question => reference_discipler, :title => 'Discipler Reference' %>
@@ -0,0 +1 @@
1
+ <%= render 'questions/reference_question', :reference_question => reference_friend, :title => 'Friend Reference' %>
@@ -0,0 +1 @@
1
+ <%= render 'questions/reference_question', :reference_question => reference_parent, :title => 'Parent Reference' %>
@@ -0,0 +1 @@
1
+ <%= render 'questions/reference_question', :reference_question => reference_peer, :title => 'Peer Reference' %>
@@ -0,0 +1,38 @@
1
+ <% reference = reference_question.response(@answer_sheet) %>
2
+ <% reference ||= ReferenceSheet.new %>
3
+ <% css_class = reference_question.required?(@answer_sheet) ? 'required' : '' %>
4
+ <% email_css_class = reference_question.required?(@answer_sheet) ? 'required validate-email' : '' %>
5
+ <% phone_css_class = reference_question.required?(@answer_sheet) ? 'required validate-phone' : '' %>
6
+ <%#= hidden_field_tag "reference[#{reference.id}]", :class => reference_question.required? && !reference.email_sent? ? 'required' : '' %>
7
+ <div id="<%= dom_id(reference_question) %>" class="reference_question">
8
+ <ul class="questions level1">
9
+ <li>
10
+ <label for="<%= "name_#{reference.id}" %>" class="desc">First Name</label>
11
+ <%= text_field_tag "reference[#{reference.id}][first_name]", reference.first_name, :class => "text #{css_class}", :id => "name_#{reference.id}", :readonly => !@answer_sheet.try(:can_change_references?), :disabled => !@answer_sheet.try(:can_change_references?) %>
12
+ </li>
13
+ <li>
14
+ <label for="<%= "name_#{reference.id}" %>" class="desc">Last Name</label>
15
+ <%= text_field_tag "reference[#{reference.id}][last_name]", reference.last_name, :class => "text #{css_class}", :id => "name_#{reference.id}", :readonly => !@answer_sheet.try(:can_change_references?), :disabled => !@answer_sheet.try(:can_change_references?) %>
16
+ </li>
17
+ <li>
18
+ <label for="<%= "name_#{reference.id}" %>" class="desc">Relationship to You</label>
19
+ <%= text_field_tag "reference[#{reference.id}][relationship]", reference.relationship, :class => "text #{css_class}", :id => "name_#{reference.id}", :readonly => !@answer_sheet.try(:can_change_references?), :disabled => !@answer_sheet.try(:can_change_references?) %>
20
+ </li>
21
+ <li>
22
+ <label for="<%= "email_#{reference.id}" %>" class="desc">E-mail</label>
23
+ <% if (!reference.email.blank?) %><div class="warningText">Please be aware that any changes to this email address after your reference has started filling out their form will cause their answers to be lost.</div><% end %>
24
+ <%= text_field_tag "reference[#{reference.id}][email]", reference.email, :class => "text #{email_css_class}", :id => "email_#{reference.id}", :readonly => !@answer_sheet.try(:can_change_references?), :disabled => !@answer_sheet.try(:can_change_references?) %>
25
+ </li>
26
+ <li>
27
+ <label for="<%= "phone_#{reference.id}" %>" class="desc">Phone</label>
28
+ <%= text_field_tag "reference[#{reference.id}][phone]", reference.phone, :class => "text #{phone_css_class}", :id => "phone_#{reference.id}", :readonly => !@answer_sheet.try(:can_change_references?), :disabled => !@answer_sheet.try(:can_change_references?) %>
29
+ </li>
30
+ <li><p>An invitation will be sent to this reference when you submit your application. If you would
31
+ like to get a head start, please feel free to click 'Send Email Invitation' below.<br/>
32
+ <em><strong>If you already submitted your application and have returned to update your reference information - you must click "Send Email Invitation" after you
33
+ have edited the information in order for your reference to receive another email. </strong></em></p></li>
34
+
35
+ <li><%= link_to('Send Email Invitation', @answer_sheet ? send_reference_invite_answer_sheet_path(@answer_sheet, :reference_id => reference.id) : '#', :class => 'reference_send_invite') %>
36
+ <br/>Invitation last sent: <span id="ref_last_sent_<%= reference.id %>"><% if reference.email_sent_at.nil? -%>Never<% else %><%= reference.email_sent_at.strftime("%m/%d/%Y @ %I:%M%p") %><% end %></span></li>
37
+ </ul>
38
+ </div>
@@ -0,0 +1 @@
1
+ <%= render 'questions/reference_question', :reference_question => reference_roommate, :title => 'Roommate Reference' %>
@@ -0,0 +1 @@
1
+ <%= render 'questions/reference_question', :reference_question => reference_spiritual, :title => 'Spiritual Reference' %>
@@ -0,0 +1 @@
1
+ <%= render 'questions/reference_question', :reference_question => reference_staff, :title => 'Staff Reference' %>
@@ -0,0 +1 @@
1
+ <h4><%= raw section.label %></h4>
@@ -0,0 +1,7 @@
1
+ <% locked = state_chooser.locked?(params, @answer_sheet, @presenter) %>
2
+ <%= select_tag "answers[#{state_chooser.id}]",
3
+ options_for_select(["", ['Not Listed','N/A']] + state_chooser.choices, [state_chooser.response(@answer_sheet).to_s]),
4
+ :class => 'select ' + state_chooser.validation_class(@answer_sheet),
5
+ :id => dom_id(state_chooser),
6
+ :disabled => locked,
7
+ :readonly => locked %>
@@ -0,0 +1,6 @@
1
+ <%= text_area_tag "answers[#{text_area_field.id}]", text_area_field.response(@answer_sheet),
2
+ :class => 'text ' + text_area_field.validation_class(@answer_sheet),
3
+ :id => dom_id(text_area_field),
4
+ :rows => 6,
5
+ :disabled => @answer_sheet.frozen?&&!@presenter.reference?,
6
+ :readonly => @answer_sheet.frozen?&&!@presenter.reference? %>
@@ -0,0 +1,8 @@
1
+ <% locked = text_field.locked?(params, @answer_sheet, @presenter) %>
2
+ <%= text_field_tag "answers[#{text_field.id}]", text_field.response(@answer_sheet),
3
+ :class => "text #{text_field.question_grid_id.present? ? "col_#{text_field.question_grid_id}_#{col}" : ''}" + text_field.validation_class(@answer_sheet),
4
+ :id => dom_id(text_field),
5
+ :disabled => locked,
6
+ :readonly => locked,
7
+ :maxlength => text_field.max_length.to_i > 0 ? text_field.max_length : 255 %>
8
+
@@ -0,0 +1,17 @@
1
+ <%- if ['question_pages', 'question_sheets', 'elements'].include?(controller.controller_name) -%>
2
+ <div class="droppable" data-url="<%= drop_admin_question_sheet_page_element_path(@page.question_sheet_id, @page.id, yes_no.id) %>">
3
+ <%= render 'questions/yes_no_field', :yes_no => yes_no %>
4
+ <ul class="questions" id="questions_list_<%= yes_no.id %>" data-sortable="true" data-sortable-url="<%= reorder_admin_question_sheet_page_elements_path(@page.question_sheet_id, @page.id) %>" data-sortable-handle=".handle">
5
+ <%= render :partial => 'admin/question_pages/element', :collection => yes_no.elements, :locals => {:in_grid => true} %>
6
+ </ul>
7
+ </div>
8
+ <% else %>
9
+ <%= render 'questions/yes_no_field', :yes_no => yes_no %>
10
+ <ul class="questions" id="questions_list_<%= yes_no.id %>" style="<%= yes_no.has_answer?(1,@answer_sheet) ? '' : 'display:none' %>">
11
+ <%= render :partial => 'answer_pages/element', :collection => yes_no.elements, :locals => {:in_grid => false, :in_conditional => true} %>
12
+ </ul>
13
+ <script type="text/javascript" charset="utf-8">
14
+ $(document).on('click', '#<%= dom_id(yes_no) %>_1', function() {$('#questions_list_<%= yes_no.id %>').show(); $('input', '#questions_list_<%= yes_no.id %>').addClass('required'); });
15
+ $(document).on('click', '#<%= dom_id(yes_no) %>_0', function() {$('#questions_list_<%= yes_no.id %>').hide(); $('input', '#questions_list_<%= yes_no.id %>').removeClass('required'); });
16
+ </script>
17
+ <% end %>
@@ -0,0 +1,17 @@
1
+ <div id="<%= dom_id(yes_no) %>" class="choice_field" style="white-space: nowrap;">
2
+ <% css_class = ' ' -%>
3
+ <% yes_no.choices.each_with_index do |choice, num| -%>
4
+ <% dom_id = dom_id(yes_no) + "_" + pretty_tag(choice[1])
5
+ css_class += yes_no.validation_class(@answer_sheet) if num == 0
6
+ checked = yes_no.has_answer?(choice[1],@answer_sheet) -%>
7
+ <div class="field field_check yesno">
8
+ <%= radio_button_tag "answers[#{yes_no.id}]", choice[1], checked,
9
+ :id => dom_id,
10
+ :class => css_class,
11
+ :disabled => @answer_sheet.frozen?&&!@presenter.reference?,
12
+ :readonly => @answer_sheet.frozen?&&!@presenter.reference? %>
13
+ <label class="choice horiz" for="<%= dom_id %>"><%= choice[0] %></label>
14
+ </div>
15
+ <% end -%>
16
+ <div class="clear"></div>
17
+ </div>
@@ -0,0 +1,5 @@
1
+ We weren't able to find a reference associated with this link. The are two common reason for this issue:
2
+ <ol>
3
+ <li>1. The applicant has picked someone else to do their reference.</li>
4
+ <li>2. The link in your email was wrapped onto two lines. Check to make sure what you see in the address bar of your browser is the full link you see in your email.</li>
5
+ </ol>
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5
+ <head>
6
+ <title>Dynamic Forms</title>
7
+ <%= javascript_include_tag 'https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js' ,
8
+ 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js' %>
9
+ <%= stylesheet_link_tag 'jquery-ui-1.8.2.custom' %>
10
+ <%= stylesheet_link_tag 'sp' %>
11
+ <%= questionnaire_engine_includes(:area => :public) %>
12
+ <%= javascript_include_tag 'rails', 'rails.extra' %>
13
+ <%= csrf_meta_tag %>
14
+ </head>
15
+ <body>
16
+
17
+ <div id="wrapper">
18
+ <div id="header">
19
+ </div>
20
+
21
+ <div id="main">
22
+ <%= yield %>
23
+ </div>
24
+ </div>
25
+
26
+ <div id="footer">
27
+ Form Engine | Created by <a href="http://www.26am.com">26AM Design Studio</a>
28
+ </div>
29
+
30
+ </body>
31
+ </html>
@@ -0,0 +1,30 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5
+ <head>
6
+ <title>Dynamic Forms</title>
7
+ <%= stylesheet_link_tag 'fe/fe.screen' %>
8
+
9
+ <%= javascript_include_tag 'fe/admin' %>
10
+ <%= csrf_meta_tag %>
11
+ </head>
12
+ <body>
13
+
14
+ <div id="status" style="display: none;"><div class="status_content"><%= image_tag('fe/status.gif', :id => "status-img" ) %> <span id="status-msg">Please Wait...</span></div></div>
15
+
16
+ <div id="wrapper">
17
+ <div id="header">
18
+ <ul id="nav-main">
19
+ <li class="active"><%= link_to 'Forms', admin_question_sheets_path %></li>
20
+ <div class="clear"></div>
21
+ </ul>
22
+ </div>
23
+
24
+ <div id="main">
25
+ <%= yield %>
26
+ </div>
27
+ </div>
28
+
29
+ </body>
30
+ </html>
@@ -0,0 +1,49 @@
1
+ Rails.application.routes.draw do
2
+
3
+ namespace :admin do
4
+ resources :email_templates
5
+ resources :question_sheets do
6
+ member do
7
+ post :archive
8
+ post :unarchive
9
+ post :duplicate
10
+ end
11
+ resources :pages, # pages/
12
+ :controller => :question_pages do # question_sheet_pages_path(),
13
+ collection do
14
+ post :reorder
15
+ end
16
+ member do
17
+ get :show_panel
18
+ end
19
+ resources :elements do
20
+ collection do
21
+ post :reorder
22
+ end
23
+ member do
24
+ get :remove_from_grid
25
+ post :use_existing
26
+ post :drop
27
+ post :duplicate
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ # form capture and review
35
+ resources :reference_sheets
36
+ resources :answer_sheets do
37
+ member do
38
+ post :send_reference_invite
39
+ post :submit
40
+ end
41
+ resources :page, :controller => :answer_pages do
42
+ member do
43
+ post :save_file
44
+ end
45
+ end
46
+ end
47
+
48
+ resources :elements
49
+ end
@@ -0,0 +1,91 @@
1
+ class Core < ActiveRecord::Migration
2
+ def change
3
+ create_table Fe::QuestionSheet.table_name do |t|
4
+ t.string :label, :limit => 100, :null => false # name used internally in admin
5
+ t.boolean :archived, :default => false, :nil => false
6
+ t.timestamps
7
+ end
8
+
9
+ create_table Fe.answer_sheet_class.constantize.table_name do |t|
10
+ t.integer :question_sheet_id
11
+ t.datetime :created_at
12
+ t.datetime :completed_at
13
+ t.timestamps
14
+ end
15
+
16
+ add_index Fe.answer_sheet_class.constantize.table_name, :question_sheet_id, name: 'question_sheet_id'
17
+
18
+ create_table Fe::Page.table_name do |t|
19
+ t.integer :question_sheet_id, :null => false
20
+ t.string :label, :limit => 60, :null => false # page title
21
+ t.integer :number # page number (order)
22
+ t.boolean :no_cache, :default => false
23
+ t.boolean :hidden, :default => false
24
+ t.timestamps
25
+ end
26
+
27
+ create_table Fe::Element.table_name do |t|
28
+ t.integer :question_grid_id, :null => true
29
+ t.string :kind, :limit => 40, :null => false # single table inheritance: class name
30
+ t.string :style, :limit => 40 # render style
31
+ t.string :label, :limit => 255 # question label, section heading
32
+ t.text :content, :null => true # for content/instructions, and for choices (one per line)
33
+ t.boolean :required # question is required?
34
+ t.string :slug, :limit => 36 # variable reference
35
+ t.integer :position
36
+ t.string :object_name, :attribute_name
37
+ t.string :source
38
+ t.string :value_xpath
39
+ t.string :text_xpath
40
+ t.string :cols
41
+ t.boolean :is_confidential, :default => false
42
+ t.string :total_cols
43
+ t.string :css_id
44
+ t.string :css_class
45
+ t.integer :question_sheet_id, :null => false
46
+ t.timestamps
47
+ end
48
+ add_index Fe::Element.table_name, :slug
49
+
50
+ create_table Fe::PageElement.table_name do |t|
51
+ t.integer :page_id
52
+ t.integer :element_id
53
+ t.integer :position
54
+ t.timestamps
55
+ end
56
+
57
+ add_index Fe::PageElement.table_name, [:page_id, :element_id], name: 'page_element'
58
+
59
+
60
+ create_table Fe::Answer.table_name do |t|
61
+ t.integer :answer_sheet_id, :null => false
62
+ t.integer :question_id, :null => false
63
+ t.text :value
64
+ t.string :short_value, :null => true, :limit => 255 # indexed copy of :value
65
+ # paperclip columns
66
+ t.integer :attachment_file_size
67
+ t.string :attachment_content_type
68
+ t.string :attachment_file_name
69
+ t.datetime :attachment_updated_at
70
+ t.timestamps
71
+ end
72
+
73
+ add_index Fe::Answer.table_name, :short_value
74
+ add_index Fe::Answer.table_name, [:answer_sheet_id, :question_id], name: 'answer_sheet_question'
75
+
76
+ create_table Fe::Condition.table_name do |t|
77
+ t.integer :question_sheet_id, :null => false
78
+ t.integer :trigger_id, :null => false
79
+ t.string :expression, :null => false, :limit => 255
80
+ t.integer :toggle_page_id, :null => false
81
+ t.integer :toggle_id, :null => true # null if toggles whole page
82
+ t.timestamps
83
+ end
84
+
85
+ add_index Fe::Condition.table_name, :question_sheet_id
86
+ add_index Fe::Condition.table_name, :trigger_id
87
+ add_index Fe::Condition.table_name, :toggle_page_id
88
+ add_index Fe::Condition.table_name, :toggle_id
89
+
90
+ end
91
+ end
@@ -0,0 +1,23 @@
1
+ class CreateReferenceSheets < ActiveRecord::Migration
2
+ def change
3
+ create_table Fe::ReferenceSheet.table_name do |t|
4
+ t.integer :question_id
5
+ t.integer :applicant_answer_sheet_id
6
+ t.datetime :email_sent_at
7
+ t.string :relationship
8
+ t.string :title
9
+ t.string :first_name
10
+ t.string :last_name
11
+ t.string :phone
12
+ t.string :email
13
+ t.string :status
14
+ t.datetime :submitted_at
15
+ t.string :access_key
16
+ t.timestamps
17
+ end
18
+
19
+ add_column Fe::Element.table_name, :related_question_sheet_id, :integer
20
+ add_index Fe::ReferenceSheet.table_name, :question_id
21
+ add_index Fe::ReferenceSheet.table_name, :applicant_answer_sheet_id
22
+ end
23
+ end
@@ -0,0 +1,10 @@
1
+ class AddElementAndAnswerFields < ActiveRecord::Migration
2
+ def change
3
+ add_column Fe::Element.table_name, :conditional_id, :integer
4
+ add_column Fe::Element.table_name, :tooltip, :text
5
+ add_column Fe::Element.table_name, :hide_label, :boolean, :default => false, :nil => false
6
+ add_column Fe::Element.table_name, :hide_option_labels, :boolean, :default => false, :nil => false
7
+
8
+ #add_index Fe::Element.table_name, :conditional_id
9
+ end
10
+ end
@@ -0,0 +1,17 @@
1
+ class CreateEmailTemplates < ActiveRecord::Migration
2
+ def up
3
+ create_table Fe::EmailTemplate.table_name do |t|
4
+ t.string :name, :limit => 1000, :null => false
5
+ t.text :content
6
+ t.boolean :enabled
7
+ t.string :subject
8
+
9
+ t.timestamps
10
+ end
11
+ add_index Fe::EmailTemplate.table_name, :name
12
+ end
13
+
14
+ def down
15
+ remove_table Fe::EmailTemplate.table_name
16
+ end
17
+ end
@@ -0,0 +1,8 @@
1
+ class AddMaxLengths < ActiveRecord::Migration
2
+ def change
3
+ add_column Fe::Element.table_name, :max_length, :integer
4
+
5
+ add_index Fe::Element.table_name, :conditional_id
6
+ add_index Fe::Element.table_name, :question_grid_id
7
+ end
8
+ end
@@ -0,0 +1,11 @@
1
+ class CreateJoinTable < ActiveRecord::Migration
2
+ def change
3
+ create_table Fe::AnswerSheetQuestionSheet.table_name do |t|
4
+ t.integer :answer_sheet_id
5
+ t.integer :question_sheet_id
6
+ t.timestamps
7
+ end
8
+
9
+ add_index Fe::AnswerSheetQuestionSheet.table_name, [:answer_sheet_id, :question_sheet_id], name: 'answer_sheet_question_sheet'
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ class RemoveQuestionIdFromElement < ActiveRecord::Migration
2
+ def up
3
+ remove_column Fe::Element.table_name, :question_sheet_id
4
+ end
5
+
6
+ def down
7
+ add_column Fe::Element.table_name, :question_sheet_id, :integer
8
+ end
9
+ end
@@ -0,0 +1,22 @@
1
+ require "fe/engine"
2
+
3
+ module Fe
4
+ # prefix for database tables
5
+ mattr_accessor :table_name_prefix
6
+ self.table_name_prefix ||= 'fe_'
7
+
8
+ mattr_accessor :answer_sheet_class
9
+ self.answer_sheet_class ||='Fe::AnswerSheet'
10
+
11
+ mattr_accessor :from_email
12
+ self.from_email ||= 'info@example.com'
13
+
14
+ def self.next_label(prefix, labels)
15
+ max = labels.inject(0) do |m, label|
16
+ num = label[/^#{prefix} ([0-9]+)$/i, 1].to_i # extract your digits
17
+ num > m ? num : m
18
+ end
19
+
20
+ "#{prefix} #{max.next}"
21
+ end
22
+ end