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,5 @@
1
+ $('#submit_message').html('<%= escape_javascript(render('incomplete')) %>')
2
+ <% @answer_sheet.pages.each do |page| %>
3
+ $('#<%= dom_id(@answer_sheet) %>-<%= dom_id(page) %>-li').replaceWith('<%= escape_javascript(render('answer_sheets/page_link', :page_link => @presenter.new_page_link(@answer_sheet, page))) %>')
4
+ <% end %>
5
+ $('#submit_message').show();
@@ -0,0 +1,18 @@
1
+ <h1>Questionnaires</h1>
2
+
3
+ <% form_tag 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_answer_sheet_path(answer_sheet) %></td>
12
+ <td><%= link_to 'Review', 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 => 'answer_sheets/answer_sheet', :locals => {:answer_sheet => @answer_sheet, :elements => @elements } %>
12
+
13
+ </div>
@@ -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,13 @@
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',
5
+ checked,
6
+ :id => dom_id(acceptance),
7
+ :class => css_class,
8
+ :disabled => @answer_sheet.frozen?&&!@answer_sheet.reference?,
9
+ :readonly => @answer_sheet.frozen?&&!@answer_sheet.reference? %>
10
+ <label class="choice" for="<%= dom_id(acceptance) %>">
11
+ <%= raw acceptance.label %>
12
+ </label>
13
+ <%= hidden_field_tag "answers[#{acceptance.id}]", '', :id => '' %>
@@ -0,0 +1,42 @@
1
+ <% if @presenter %>
2
+ <% if @answer_sheet.frozen? && !@answer_sheet.reference? %>
3
+ Current File: <%= link_to(answer.attachment_file_name, answer.attachment.url) %>
4
+ <% else %>
5
+ <div class="uploader">
6
+ <input id="<%= dom_id(attachment_field) %>_file_uploader" name="image_uploader" type="file" />
7
+ <!-- width: 350px -->
8
+ <span id="<%= dom_id(attachment_field) %>_filename">
9
+ <% answer = attachment_field.responses(@answer_sheet).first
10
+ if answer.present? %>
11
+ Current File: <%= link_to(answer.attachment_file_name, answer.attachment.url) %>
12
+ <% end %>
13
+ </span>
14
+ </div>
15
+
16
+ <script type="text/javascript" charset="utf-8">
17
+ <% session_key_name = Rails.application.config.session_options[:key] %>
18
+ $('#<%= dom_id(attachment_field) %>_file_uploader').uploadify({
19
+ uploader : '<%= asset_path "fe/uploadify/uploadify.swf" %>',
20
+ script : '<%= save_file_answer_sheet_page_path(@presenter.active_answer_sheet, @page, :question_id => attachment_field.id) %>',
21
+ fileDesc : 'Pick a file',
22
+ fileExt : '*.*',
23
+ auto : true,
24
+ sizeLimit : <%= 100.megabytes %>,
25
+ width : 350,
26
+ height : 30,
27
+ multi : true,
28
+ simUploadLimit : 2,
29
+ method : 'POST',
30
+ cancelImg : '<%= asset_path "fe/uploadify/cancel.png" %>',
31
+ onComplete : function(a, b, c, response){ eval(response); },
32
+ buttonText : 'Attach a file',
33
+ scriptData : {
34
+ '_http_accept': 'application/javascript',
35
+ '_method': 'post',
36
+ '<%= session_key_name %>' : encodeURIComponent('<%= u cookies[session_key_name] %>'),
37
+ 'authenticity_token': encodeURIComponent('<%= u form_authenticity_token %>')
38
+ }
39
+ });
40
+ </script>
41
+ <% end %>
42
+ <% end %>
@@ -0,0 +1,49 @@
1
+ <% if checkbox_field.hide_option_labels? && !['question_pages', 'question_sheets', 'elements'].include?(controller.controller_name) %>
2
+ <tr id="<%= dom_id(checkbox_field) %>">
3
+ <td>
4
+ <label for="<%= dom_id(checkbox_field) %>" class="desc">
5
+ <%= raw checkbox_field.label %>
6
+ <% if checkbox_field.required?(@answer_sheet) -%><span class="required">required</span><% end -%>
7
+ <%= tip(checkbox_field.tooltip) if checkbox_field.tooltip.present? %>
8
+ </label>
9
+ </td>
10
+ <% checkbox_field.choices.each_with_index do |choice, num| -%>
11
+ <td>
12
+ <% css_class = 'checkbox ' -%>
13
+ <% dom_id = dom_id(checkbox_field) + "_" + pretty_tag(choice[1])
14
+ last_choice = (num == checkbox_field.choices.length - 1)
15
+ css_class += checkbox_field.validation_class(@answer_sheet) if last_choice
16
+ -%>
17
+ <%= hidden_field_tag "answers[#{checkbox_field.id}][#{num}]", '', :id => '' %>
18
+ <div class="field field_check">
19
+ <%= check_box_tag "answers[#{checkbox_field.id}][#{num}]", choice[1],
20
+ checkbox_field.has_answer?(choice[1], @answer_sheet),
21
+ :id => dom_id,
22
+ :class => css_class,
23
+ :disabled => @answer_sheet.frozen?&&!@presenter.reference?,
24
+ :readonly => @answer_sheet.frozen?&&!@presenter.reference? %>
25
+ </div>
26
+ </td>
27
+ <% end -%>
28
+ </tr>
29
+ <% else %>
30
+ <div id="<%= dom_id(checkbox_field) %>">
31
+ <% css_class = 'checkbox ' -%>
32
+ <% checkbox_field.choices.each_with_index do |choice, num| -%>
33
+ <% dom_id = dom_id(checkbox_field) + "_" + pretty_tag(choice[1])
34
+ last_choice = (num == checkbox_field.choices.length - 1)
35
+ css_class += checkbox_field.validation_class(@answer_sheet) if last_choice
36
+ -%>
37
+ <%= hidden_field_tag "answers[#{checkbox_field.id}][#{num}]", '', :id => '' %>
38
+ <div class="field field_check">
39
+ <%= check_box_tag "answers[#{checkbox_field.id}][#{num}]", choice[1],
40
+ checkbox_field.has_answer?(choice[1], @answer_sheet),
41
+ :id => dom_id,
42
+ :class => css_class,
43
+ :disabled => @answer_sheet.frozen?&&!@presenter.reference?,
44
+ :readonly => @answer_sheet.frozen?&&!@presenter.reference? %>
45
+ <label class="choice" for="<%= dom_id %>"><%= choice[0] %></label>
46
+ </div>
47
+ <% end -%>
48
+ </div>
49
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <% locked = country.locked?(params, @answer_sheet, @presenter) %>
2
+ <%= select_tag "answers[#{country.id}]",
3
+ options_for_select([''] + Carmen.countries, country.response(@answer_sheet).to_s),
4
+ :class => 'select ' + country.validation_class(@answer_sheet),
5
+ :id => dom_id(country),
6
+ :disabled => locked,
7
+ :readonly => locked %>
@@ -0,0 +1,7 @@
1
+ <%= calendar_date_select_tag "answers[#{date_field.id}]", date_field.format_date_response(@answer_sheet),
2
+ :class => 'text ' + date_field.validation_class(@answer_sheet),
3
+ :id => dom_id(date_field),
4
+ :disabled => @answer_sheet.frozen?&&!@presenter.reference?,
5
+ :readonly => true %>
6
+ <div id="advice-validate-date-<%= dom_id(date_field) %>" class="validation-advice" style="display: none;">Please enter a valid date (MM/DD/YYYY).</div>
7
+ <div id="advice-required-<%= dom_id(date_field) %>" class="validation-advice" style="display: none;">This is a required field.</div>
@@ -0,0 +1,9 @@
1
+ <%= select_month(date_field_mmyy.response(@answer_sheet), :include_blank => true,
2
+ :prefix => "answers[#{date_field_mmyy.id}]",
3
+ :class => 'select ' + date_field_mmyy.validation_class(@answer_sheet)) %>
4
+ <%= select_year(date_field_mmyy.response(@answer_sheet), :include_blank => true,
5
+ :start_year => Time.now.year - 50, :end_year => Time.now.year + 7,
6
+ :prefix => "answers[#{date_field_mmyy.id}]",
7
+ :class => 'select ' + date_field_mmyy.validation_class(@answer_sheet)) %>
8
+
9
+ <% # not validated because class doesn't pass, see ticket #6000 -%>
@@ -0,0 +1,7 @@
1
+ <% locked = drop_down_field.locked?(params, @answer_sheet, @presenter) %>
2
+ <%= select_tag "answers[#{drop_down_field.id}]",
3
+ options_for_select([""] + drop_down_field.choices, drop_down_field.response(@answer_sheet).to_s),
4
+ :class => 'select ' + drop_down_field.validation_class(@answer_sheet),
5
+ :id => dom_id(drop_down_field),
6
+ :disabled => locked,
7
+ :readonly => locked %>
@@ -0,0 +1 @@
1
+ <div class="p_content"><%= raw paragraph.content %></div>
@@ -0,0 +1,65 @@
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, question_grid.id) %>">
3
+ <% if question_grid.label.present? && !question_grid.hide_label? -%>
4
+ <label class="desc gridname">
5
+ <%= raw question_grid.label %>
6
+ <% if question_grid.required?(@answer_sheet) -%><span class="required">required</span><% end -%>
7
+ </label>
8
+ <% end %>
9
+ <div class="sub_q">
10
+ <!-- Create a sortable list for each grid on the page -->
11
+ <ul class="questions" id="questions_list_<%= question_grid.id %>" data-sortable="true" data-sortable-url="<%= reorder_admin_question_sheet_page_elements_path(@page.question_sheet_id, @page.id) %>" data-sortable-handle=".handle">
12
+ <%- if question_grid.elements.length > 0 -%>
13
+ <%= render :partial => 'admin/question_pages/element', :collection => question_grid.elements, :locals => {:in_grid => true} %>
14
+ <%- else -%>
15
+ Grid
16
+ <%- end -%>
17
+ </ul>
18
+ </div>
19
+ </div>
20
+ <%- else -%>
21
+ <% if question_grid.label.present? && !question_grid.hide_label? -%>
22
+ <label class="desc gridname"><%= raw question_grid.label %></label>
23
+ <% end %>
24
+ <% headers = question_grid.cols.to_s.split(';') %>
25
+ <% if headers.length > 1 %>
26
+ <table class="grid <%= question_grid.css_class %>" id="<%= question_grid.css_id %>">
27
+ <% if headers.detect {|h| h.strip.present?} %>
28
+ <tr>
29
+ <%- headers.each do |header| -%>
30
+ <th><%= raw header || '&nbsp;' %></th>
31
+ <%- end -%>
32
+ </tr>
33
+ <% end %>
34
+ <% if question_grid.style == 'radio' %>
35
+ <% question_grid.elements.each do |element| -%>
36
+ <%= render :partial => 'answer_pages/element', :object => element %>
37
+ <% end %>
38
+ <% else %>
39
+ <tr >
40
+ <%- col_count = 0
41
+ question_grid.elements.each do |element| -%>
42
+ <td id="element_<%= element.id %>" class="hidecell">
43
+ <%# grid_el = @elements.to_a.find {|el| el.id == element.id} %>
44
+ <%= render :partial => 'answer_pages/element', :object => element, :locals => {:col => col_count} %>
45
+ </td>
46
+ <%- col_count += 1
47
+ if col_count % question_grid.num_cols == 0 && element != question_grid.elements.last then col_count = 0 -%></tr><tr><%- end -%>
48
+ <%- end -%>
49
+ <%- while col_count < question_grid.num_cols do
50
+ col_count += 1-%>
51
+ <td>&nbsp;</td>
52
+ <%- end unless col_count == 0-%>
53
+ </tr>
54
+ <% end %>
55
+ </table>
56
+ <% else %>
57
+ <% if headers[0].to_s.strip.present? %>
58
+ <div class="header"><%= headers[0] %></div>
59
+ <% end %>
60
+ <% question_grid.elements.each do |element| -%>
61
+ <div class="row" id="element_<%= element.id %>"><%= render :partial => 'answer_pages/element', :object => element, :locals => {:in_grid => true} %></div>
62
+ <% end %>
63
+ <div class="clear"></div>
64
+ <% end %>
65
+ <%- end -%>
@@ -0,0 +1,57 @@
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, question_grid_with_total.id) %>">
3
+ <label class="desc"><%= raw question_grid_with_total.label %></label>
4
+ <div>
5
+ <ul class="questions" id="questions_list_<%= question_grid_with_total.id %>">
6
+ <%- if question_grid_with_total.elements.length > 0 -%>
7
+ <%= render :partial => 'question_pages/element', :collection => question_grid_with_total.elements, :locals => {:in_grid => true} %>
8
+ <%- else -%>
9
+ Grid
10
+ <%- end -%>
11
+ </ul>
12
+ </div>
13
+ </div>
14
+ <%- else -%>
15
+ <label class="desc"><%= raw question_grid_with_total.label %></label>
16
+ <table class="grid">
17
+ <% headers = question_grid_with_total.cols.to_s.split(';') %>
18
+ <% if headers.detect {|h| h.strip.present?} %>
19
+ <tr>
20
+ <%- headers.each do |header| -%>
21
+ <th><%= header || '&nbsp;' %></th>
22
+ <%- end -%>
23
+ </tr>
24
+ <% end %>
25
+ <tr >
26
+ <%- col_count = 0
27
+ question_grid_with_total.elements.each do |element| -%>
28
+ <td id="element_<%= element.id %>">
29
+ <% grid_el = @elements.to_a.find {|el| el.id == element.id} %>
30
+ <%= render :partial => 'answer_pages/element', :object => grid_el, :locals => {:in_grid => true, :col => col_count} if grid_el %>
31
+ </td>
32
+ <%- col_count += 1
33
+ if col_count % question_grid_with_total.num_cols == 0 && element != question_grid_with_total.elements.last then col_count = 0 -%></tr><tr><%- end -%>
34
+ <%- end -%>
35
+ <%- while col_count < question_grid_with_total.num_cols do
36
+ col_count += 1-%>
37
+ <td>&nbsp;</td>
38
+ <%- end unless col_count == 0-%>
39
+ </tr>
40
+ <%- if question_grid_with_total.total_cols.present? -%>
41
+ <tr>
42
+ <td>Total</td>
43
+ <%- total_cols = question_grid_with_total.total_cols.split(',').collect(&:to_i)
44
+ (question_grid_with_total.num_cols - 1).times do |i|
45
+ if total_cols.include?(i + 2) -%>
46
+ <td>
47
+ <%= text_field_tag "total_#{question_grid_with_total.id}_#{i + 1}", '', :class => 'text validate-number', :readonly => true %>
48
+ </td>
49
+ <% else %>
50
+ <td>&nbsp;</td>
51
+ <% end %>
52
+ <%- end -%>
53
+ </tr>
54
+ <%- end -%>
55
+ </table>
56
+ <%- end -%>
57
+
@@ -0,0 +1,9 @@
1
+ <ul>
2
+ <% questions.each do |question| %>
3
+ <li><%= link_to(use_existing_admin_question_sheet_page_element_path(:question_sheet_id => @page.question_sheet_id, :page_id => @page.id, :id => question.id),
4
+ :remote => true, :method => :post) do %>
5
+ <span>select</span><label><%= raw question.label %></label>
6
+ <% end %>
7
+ </li>
8
+ <% end %>
9
+ </ul>
@@ -0,0 +1,41 @@
1
+ <% css_class = 'radio ' -%>
2
+ <% css_class += 'required' if radio_button_field.required? %>
3
+ <% if radio_button_field.hide_option_labels? && !['question_pages', 'question_sheets', 'elements'].include?(controller.controller_name) %>
4
+ <tr id="<%= dom_id(radio_button_field) %>">
5
+ <td class="col1">
6
+ <label for="<%= dom_id(radio_button_field) %>" class="desc">
7
+ <%= raw radio_button_field.label %>
8
+ <% if radio_button_field.required?(@answer_sheet) -%><span class="required">required</span><% end -%>
9
+ <%= tip(radio_button_field.tooltip) if radio_button_field.tooltip.present? %>
10
+ </label>
11
+ </td>
12
+ <% radio_button_field.choices.each_with_index do |choice, num| -%>
13
+ <td class="col">
14
+ <% dom_id = dom_id(radio_button_field) + "_" + pretty_tag(choice[1])
15
+ last_choice = (num == radio_button_field.choices.length - 1)
16
+ css_class += radio_button_field.validation_class(@answer_sheet) if last_choice
17
+ checked = radio_button_field.has_answer?(choice[1], @answer_sheet) -%>
18
+ <%= radio_button_tag "answers[#{radio_button_field.id}]", choice[1], checked,
19
+ :id => dom_id,
20
+ :class => css_class,
21
+ :disabled => @answer_sheet.frozen?&&!@presenter.reference?,
22
+ :readonly => @answer_sheet.frozen?&&!@presenter.reference? %>
23
+ </td>
24
+ <% end -%>
25
+ </tr>
26
+ <% else %>
27
+ <div id="<%= dom_id(radio_button_field) %>">
28
+ <% radio_button_field.choices.each_with_index do |choice, num| -%>
29
+ <% dom_id = dom_id(radio_button_field) + "_" + pretty_tag(choice[1])
30
+ last_choice = (num == radio_button_field.choices.length - 1)
31
+ css_class += radio_button_field.validation_class(@answer_sheet) if last_choice
32
+ checked = radio_button_field.has_answer?(choice[1], @answer_sheet) -%>
33
+ <%= radio_button_tag "answers[#{radio_button_field.id}]", choice[1], checked,
34
+ :id => dom_id,
35
+ :class => css_class,
36
+ :disabled => @answer_sheet.frozen?&&!@presenter.reference?,
37
+ :readonly => @answer_sheet.frozen?&&!@presenter.reference? %>
38
+ <label class="choice" for="<%= dom_id %>"><%= choice[0] %></label>
39
+ <% end -%>
40
+ </div>
41
+ <% end %>
@@ -0,0 +1,25 @@
1
+ <% dom_id = "" %>
2
+ <div id="<%= dom_id(rating) %>">
3
+ <table cellspacing="0" class="rating">
4
+ <tr>
5
+ <% css_class = ' ' -%>
6
+ <% rating.choices.each_with_index do |choice, num| -%>
7
+ <% dom_id = dom_id(rating) + "_" + pretty_tag(choice[1])
8
+ last_choice = (num == rating.choices.length - 1)
9
+ css_class += rating.validation_class(@answer_sheet) if last_choice
10
+ checked = rating.has_answer?(choice[1],@answer_sheet) -%>
11
+ <td><%= radio_button_tag "answers[#{rating.id}]", choice[1], checked,
12
+ :id => dom_id,
13
+ :class => css_class,
14
+ :disabled => @answer_sheet.frozen?&&!@presenter.reference?,
15
+ :readonly => @answer_sheet.frozen?&&!@presenter.reference? %></td>
16
+ <% end -%>
17
+ </tr>
18
+ <tr>
19
+ <% rating.choices.each do |choice| %>
20
+ <td><%= choice[0] %></td>
21
+ <% end -%>
22
+ </tr>
23
+ </table>
24
+ <div id="advice-validate-rating-<%= dom_id %>" class="validation-advice" style="display: none;">Please select one of the above options.</div>
25
+ </div>