fe 0.0.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +16 -36
  3. data/app/assets/javascripts/fe/admin.js +0 -1
  4. data/app/assets/javascripts/fe/fe.admin.js +40 -16
  5. data/app/assets/javascripts/fe/fe.common.js +48 -14
  6. data/app/assets/javascripts/fe/fe.public.js +1 -414
  7. data/app/assets/javascripts/fe/fe.public.nojquery.js +450 -0
  8. data/app/assets/javascripts/fe/jquery.validate.pack.js +3 -15
  9. data/app/assets/stylesheets/360front.css +0 -0
  10. data/app/assets/stylesheets/fe/fe.screen.css.scss.erb +69 -10
  11. data/app/controllers/fe/admin/elements_controller.rb +64 -48
  12. data/app/controllers/fe/admin/email_templates_controller.rb +2 -2
  13. data/app/controllers/fe/admin/question_pages_controller.rb +1 -1
  14. data/app/controllers/fe/admin/question_sheets_controller.rb +2 -103
  15. data/app/controllers/fe/concerns/admin/question_sheets_controller_concern.rb +112 -0
  16. data/app/controllers/fe/concerns/answer_pages_controller_concern.rb +2 -1
  17. data/app/controllers/fe/concerns/answer_sheets_controller_concern.rb +1 -1
  18. data/app/controllers/fe/concerns/application_controller_concern.rb +13 -0
  19. data/app/controllers/fe/reference_sheets_controller.rb +2 -0
  20. data/app/controllers/fe/references_controller.rb +1 -0
  21. data/app/helpers/fe/application_helper.rb +5 -0
  22. data/app/mailers/fe/notifier.rb +11 -4
  23. data/app/models/answer_sheet.rb +2 -0
  24. data/app/models/fe/application.rb +2 -1
  25. data/app/models/fe/concerns/answer_pages_presenter_concern.rb +10 -1
  26. data/app/models/fe/concerns/answer_sheet_concern.rb +38 -8
  27. data/app/models/fe/concerns/choice_field_concern.rb +17 -10
  28. data/app/models/fe/date_field.rb +1 -1
  29. data/app/models/fe/element.rb +105 -31
  30. data/app/models/fe/page.rb +52 -20
  31. data/app/models/fe/page_element.rb +6 -1
  32. data/app/models/fe/page_link.rb +6 -3
  33. data/app/models/fe/person.rb +11 -8
  34. data/app/models/fe/question.rb +2 -6
  35. data/app/models/fe/question_grid.rb +1 -1
  36. data/app/models/fe/question_grid_with_total.rb +15 -0
  37. data/app/models/fe/question_set.rb +1 -1
  38. data/app/models/fe/question_sheet.rb +15 -13
  39. data/app/models/fe/reference_question.rb +0 -10
  40. data/app/models/fe/reference_sheet.rb +17 -13
  41. data/app/models/staff.rb +2 -0
  42. data/app/validators/email_validator.rb +11 -0
  43. data/app/views/fe/admin/elements/create.js.erb +1 -0
  44. data/app/views/fe/admin/elements/drop.js.erb +1 -0
  45. data/app/views/fe/admin/elements/duplicate.js.erb +1 -0
  46. data/app/views/fe/admin/panels/_advanced_options.html.erb +9 -3
  47. data/app/views/fe/admin/panels/_common_fields.html.erb +19 -5
  48. data/app/views/fe/admin/panels/_page.html.erb +1 -1
  49. data/app/views/fe/admin/panels/_prop_choice_field.html.erb +20 -11
  50. data/app/views/fe/admin/panels/_prop_element.html.erb +2 -9
  51. data/app/views/fe/admin/panels/_prop_page.html.erb +8 -3
  52. data/app/views/fe/admin/panels/_prop_paragraph.html.erb +38 -24
  53. data/app/views/fe/admin/panels/_prop_section.html.erb +8 -2
  54. data/app/views/fe/admin/panels/_prop_sheet.html.erb +4 -1
  55. data/app/views/fe/admin/question_pages/_element.html.erb +11 -1
  56. data/app/views/fe/answer_pages/_answer_page.html.erb +9 -8
  57. data/app/views/fe/answer_pages/_element.html.erb +6 -7
  58. data/app/views/fe/answer_pages/_page_name.html.erb +1 -0
  59. data/app/views/fe/answer_pages/update.js.erb +3 -3
  60. data/app/views/fe/answer_sheets/_answer_sheet.html.erb +3 -3
  61. data/app/views/fe/answer_sheets/_element.html.erb +52 -34
  62. data/app/views/fe/answer_sheets/_incomplete.html.erb +1 -1
  63. data/app/views/fe/answer_sheets/_page_link.html.erb +2 -2
  64. data/app/views/fe/answer_sheets/_pages_list.html.erb +3 -3
  65. data/app/views/fe/answer_sheets/_submit_to.html.erb +1 -0
  66. data/app/views/fe/answer_sheets/edit.html.erb +14 -14
  67. data/app/views/fe/answer_sheets/incomplete.js.erb +3 -0
  68. data/app/views/fe/answer_sheets/index.html.erb +3 -3
  69. data/app/views/fe/answer_sheets/show.html.erb +1 -1
  70. data/app/views/fe/applications/_logout.html.erb +1 -0
  71. data/app/views/fe/applications/show.html.erb +1 -0
  72. data/app/views/fe/questions/fe/_acceptance.html.erb +3 -3
  73. data/app/views/fe/questions/fe/_attachment_field.html.erb +7 -3
  74. data/app/views/fe/questions/fe/_checkbox_field.html.erb +26 -24
  75. data/app/views/fe/questions/fe/_date_field.html.erb +1 -2
  76. data/app/views/fe/questions/fe/_date_field_mmyy.html.erb +2 -2
  77. data/app/views/fe/questions/fe/_drop_down_field.html.erb +3 -2
  78. data/app/views/fe/questions/fe/_paragraph.html.erb +1 -1
  79. data/app/views/fe/questions/fe/_question_grid.html.erb +14 -9
  80. data/app/views/fe/questions/fe/_question_grid_with_total.html.erb +21 -14
  81. data/app/views/fe/questions/fe/_questions.html.erb +2 -2
  82. data/app/views/fe/questions/fe/_radio_button_field.html.erb +12 -11
  83. data/app/views/fe/questions/fe/_rating.html.erb +9 -8
  84. data/app/views/fe/questions/fe/_reference_discipler.html.erb +1 -1
  85. data/app/views/fe/questions/fe/_reference_friend.html.erb +1 -1
  86. data/app/views/fe/questions/fe/_reference_parent.html.erb +1 -1
  87. data/app/views/fe/questions/fe/_reference_peer.html.erb +1 -1
  88. data/app/views/fe/questions/fe/_reference_question.html.erb +22 -15
  89. data/app/views/fe/questions/fe/_reference_roommate.html.erb +1 -1
  90. data/app/views/fe/questions/fe/_reference_spiritual.html.erb +1 -1
  91. data/app/views/fe/questions/fe/_reference_staff.html.erb +1 -1
  92. data/app/views/fe/questions/fe/_section.html.erb +1 -1
  93. data/app/views/fe/questions/fe/_text_area_field.html.erb +10 -3
  94. data/app/views/fe/questions/fe/_text_field.html.erb +1 -1
  95. data/app/views/fe/questions/fe/_yes_no_field.erb +3 -3
  96. data/app/views/fe/reference_pages/_reference.html.erb +11 -11
  97. data/app/views/fe/reference_pages/edit.html.erb +7 -7
  98. data/app/views/fe/reference_sheets/done.html.erb +2 -2
  99. data/app/views/fe/reference_sheets/not_found.html.erb +4 -4
  100. data/app/views/fe/references/edit.html.erb +6 -6
  101. data/app/views/fe/references/show.html.erb +7 -7
  102. data/app/views/fe/references/submit.js.erb +1 -1
  103. data/app/views/fe/submit_pages/_thankyou.html.erb +1 -1
  104. data/app/views/fe/submit_pages/edit.html.erb +9 -9
  105. data/app/views/layouts/fe/_error_messages_for.html.erb +7 -0
  106. data/app/views/layouts/fe/application.html.erb +1 -1
  107. data/config/routes.rb +0 -36
  108. data/db/migrate/20131003044250_create_reference_sheets.rb +1 -0
  109. data/db/migrate/20140623153424_create_fe_people.rb +1 -1
  110. data/db/migrate/20140624180246_create_fe_addresses.rb +1 -1
  111. data/db/migrate/20140624182216_create_fe_phone_numbers.rb +16 -0
  112. data/db/migrate/20140625160545_create_fe_users.rb +1 -1
  113. data/db/migrate/20150504221439_add_all_element_ids_to_pages.rb +5 -0
  114. data/db/migrate/20150713022326_add_locale_columns.rb +9 -0
  115. data/db/migrate/20150714220730_add_locale_to_answer_sheet.rb +5 -0
  116. data/db/migrate/20150928085325_change_pages_all_element_ids_to_text.rb +5 -0
  117. data/db/migrate/20150930191538_add_locale_to_reference_sheets.rb +5 -0
  118. data/lib/access_key_generator.rb +12 -0
  119. data/lib/distinct_distinct_patch.rb +20 -0
  120. data/lib/fe.rb +4 -0
  121. data/lib/fe/engine.rb +16 -4
  122. data/lib/fe/version.rb +1 -1
  123. data/spec/controllers/fe/admin/elements_controller_spec.rb +201 -1
  124. data/spec/controllers/fe/admin/email_templates_controller_spec.rb +26 -1
  125. data/spec/controllers/fe/admin/question_pages_controller_spec.rb +8 -1
  126. data/spec/controllers/fe/admin/question_sheets_controller_spec.rb +48 -1
  127. data/spec/controllers/fe/answer_pages_controller_spec.rb +73 -1
  128. data/spec/controllers/fe/answer_sheets_controller_spec.rb +80 -1
  129. data/spec/controllers/fe/reference_pages_controller.rb +4 -0
  130. data/spec/controllers/fe/references_controller_spec.rb +4 -0
  131. data/spec/controllers/fe/submit_pages_controller_spec.rb +4 -0
  132. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  133. data/spec/dummy/app/helpers/application_helper.rb +9 -0
  134. data/spec/dummy/app/models/application.rb +3 -0
  135. data/spec/dummy/app/models/person.rb +11 -0
  136. data/spec/dummy/app/models/user.rb +3 -0
  137. data/spec/dummy/config/application.rb +2 -1
  138. data/spec/dummy/config/database.yml +20 -17
  139. data/spec/dummy/config/environments/production.rb +1 -5
  140. data/spec/dummy/config/environments/test.rb +3 -1
  141. data/spec/dummy/config/initializers/fast_gettext.rb +5 -0
  142. data/spec/dummy/config/secrets.yml +2 -2
  143. data/spec/dummy/db/migrate/20141203214017_core.fe_engine.rb +92 -0
  144. data/spec/dummy/db/migrate/20141203214018_create_reference_sheets.fe_engine.rb +25 -0
  145. data/spec/dummy/db/migrate/20141203214019_add_element_and_answer_fields.fe_engine.rb +11 -0
  146. data/spec/dummy/db/migrate/20141203214020_create_email_templates.fe_engine.rb +18 -0
  147. data/spec/dummy/db/migrate/20141203214021_add_max_lengths.fe_engine.rb +9 -0
  148. data/spec/dummy/db/migrate/20141203214022_create_join_table.fe_engine.rb +12 -0
  149. data/spec/dummy/db/migrate/20141203214023_remove_question_id_from_element.fe_engine.rb +10 -0
  150. data/spec/dummy/db/migrate/20141203214024_create_fe_people.fe_engine.rb +13 -0
  151. data/spec/dummy/db/migrate/20141203214025_create_fe_addresses.fe_engine.rb +21 -0
  152. data/{db/migrate/20140624182216_create_create_fe_phone_numbers.rb → spec/dummy/db/migrate/20141203214026_create_create_fe_phone_numbers.fe_engine.rb} +1 -0
  153. data/spec/dummy/db/migrate/20141203214027_create_fe_users.fe_engine.rb +13 -0
  154. data/spec/dummy/db/migrate/20141203214028_add_conditional_type_to_elements.fe_engine.rb +6 -0
  155. data/spec/dummy/db/migrate/20141203214029_add_conditional_answer_to_elements.fe_engine.rb +6 -0
  156. data/spec/dummy/db/migrate/20141203214030_remove_short_value_column.fe_engine.rb +6 -0
  157. data/spec/dummy/db/migrate/20141203214031_move_conditional_ids_used_for_choice_field_to_their_own_column.fe_engine.rb +8 -0
  158. data/spec/dummy/db/migrate/20150123215803_create_users.rb +9 -0
  159. data/spec/dummy/db/migrate/20150504222619_add_all_element_ids_to_pages.fe_engine.rb +6 -0
  160. data/spec/dummy/db/migrate/20150930190001_create_fe_phone_numbers.fe_engine.rb +20 -0
  161. data/spec/dummy/db/migrate/20150930190002_add_locale_columns.fe_engine.rb +10 -0
  162. data/spec/dummy/db/migrate/20150930190003_add_locale_to_answer_sheet.fe_engine.rb +6 -0
  163. data/spec/dummy/db/migrate/20150930190004_change_pages_all_element_ids_to_text.fe_engine.rb +6 -0
  164. data/spec/dummy/db/migrate/20150930191756_add_locale_to_reference_sheets.fe_engine.rb +6 -0
  165. data/spec/dummy/db/schema.rb +50 -20
  166. data/spec/dummy/log/development.log +5 -0
  167. data/spec/factories/applications.rb +0 -1
  168. data/spec/factories/dummy_applications.rb +6 -0
  169. data/spec/factories/dummy_people.rb +6 -0
  170. data/spec/factories/dummy_users.rb +6 -0
  171. data/spec/factories/elements.rb +28 -3
  172. data/spec/factories/email_templates.rb +5 -0
  173. data/spec/factories/fe_email_templates.rb +9 -0
  174. data/spec/factories/fe_people.rb +0 -2
  175. data/spec/factories/fe_user.rb +6 -0
  176. data/spec/factories/question_sheet.rb +1 -1
  177. data/spec/factories/reference_sheets.rb +9 -0
  178. data/spec/mailers/fe/notifier_spec.rb +39 -0
  179. data/spec/models/fe/choice_field_spec.rb +20 -0
  180. data/spec/models/fe/element_spec.rb +185 -0
  181. data/spec/models/fe/page_spec.rb +112 -0
  182. data/spec/models/fe/question_sheet_spec.rb +106 -0
  183. data/spec/models/fe/reference_sheet_spec.rb +20 -0
  184. data/spec/rails_helper.rb +41 -13
  185. data/spec/support/choices.xml +6 -0
  186. metadata +136 -48
  187. data/app/assets/javascripts/fe/rails.extra.js +0 -6
  188. data/app/controllers/fe/applications_controller.rb +0 -183
  189. data/app/controllers/fe/payments_controller.rb +0 -184
  190. data/app/models/fe/payment.rb +0 -77
  191. data/app/models/fe/payment_question.rb +0 -22
  192. data/app/views/fe/admin/panels/_prop_payment_question.html.erb +0 -1
  193. data/app/views/fe/application/_logout.html.erb +0 -1
  194. data/app/views/fe/payment_pages/_credit.html.erb +0 -47
  195. data/app/views/fe/payment_pages/_mail.html.erb +0 -27
  196. data/app/views/fe/payment_pages/_payment.html.erb +0 -6
  197. data/app/views/fe/payment_pages/_staff.html.erb +0 -25
  198. data/app/views/fe/payment_pages/_staff_results.html.erb +0 -17
  199. data/app/views/fe/payment_pages/edit.html.erb +0 -75
  200. data/app/views/fe/payment_pages/staff_search.js.erb +0 -2
  201. data/app/views/fe/payments/_credit.html.erb +0 -47
  202. data/app/views/fe/payments/_errors.html.erb +0 -1
  203. data/app/views/fe/payments/_payment.html.erb +0 -13
  204. data/app/views/fe/payments/_staff.html.erb +0 -21
  205. data/app/views/fe/payments/_staff_results.html.erb +0 -18
  206. data/app/views/fe/payments/approve.js.erb +0 -3
  207. data/app/views/fe/payments/create.js.erb +0 -19
  208. data/app/views/fe/payments/destroy.js.erb +0 -7
  209. data/app/views/fe/payments/edit.html.erb +0 -56
  210. data/app/views/fe/payments/error.js.erb +0 -3
  211. data/app/views/fe/payments/no_access.html.erb +0 -7
  212. data/app/views/fe/payments/staff_search.js.erb +0 -1
  213. data/app/views/fe/payments/update.html.erb +0 -24
  214. data/app/views/fe/questions/fe/_payment_question.html.erb +0 -70
  215. data/db/migrate/20140828045339_create_payments.rb +0 -13
  216. data/spec/dummy/db/test.sqlite3 +0 -0
  217. data/spec/factories/payments.rb +0 -7
  218. data/spec/models/fe/payment_question_spec.rb +0 -65
@@ -6,6 +6,7 @@
6
6
  $('#element_form_<%= dom_id(@element) %>').show();
7
7
  selectElement("#element_<%= @element.id %>");
8
8
  $.scrollTo("#element_<%= @element.id %>");
9
+ setUpSortables();
9
10
  <% else %>
10
11
  alert('That question already exists on this question sheet')
11
12
  <% end %>
@@ -1,2 +1,3 @@
1
1
  $('#page-preview').html('<%= escape_javascript(render('fe/admin/question_pages/question_page', :page => @page)) %>')
2
2
  $('#list-pages li').removeClass('active')
3
+ setUpJsHelpers();
@@ -1,2 +1,3 @@
1
1
  $('#page-preview').html('<%= escape_javascript(render('fe/admin/question_pages/question_page')) %>')
2
2
  selectElement("#element_<%= @element.id %>")
3
+ setUpSortables();
@@ -12,7 +12,7 @@
12
12
  <%= radio_button_tag :future_affect, "no" %>
13
13
  <%= label_tag :future_affect_no, "No" %>
14
14
  <% if @element.conditional.present? %>
15
- <script>$(function() { $("#future_affect_yes").click(); });</script>
15
+ <script>$(function() { $("#<%= dom_id(element) %>-pnl-advanced input[name=future_affect][value=yes]").click(); });</script>
16
16
  <% end %>
17
17
  <div class='future_answer' style='display:none'>
18
18
  What answer should show the element or page? <%= f.text_field "conditional_answer" %>
@@ -20,18 +20,24 @@
20
20
  Enter multiple answers separated by commas to match using an OR condition. Ex: "Option A, Option B" will match either "Option A" or "Option B" answers
21
21
  </div>
22
22
  <div class='future_target' style='display:none'>
23
- Should it show the next element or a page further down the application?
23
+ <label>Should it show the next element or a page further down the application?</label>
24
24
  <%= f.radio_button :conditional_type, "Fe::Element" %>
25
25
  <%= f.label :conditional_type_feelement, "Next Element" %>
26
26
  <%= f.radio_button :conditional_type, "Fe::Page" %>
27
27
  <%= f.label :conditional_type_fepage, "Page" %>
28
+ <%= f.radio_button :conditional_type, "", style: 'display:none' %>
29
+ <script>$(function() { $("#<%= dom_id(element) %>-pnl-advanced .future_target input[checked]").click(); });</script>
28
30
  </div>
29
31
  <div class='future_page' style='<%= 'display:none' unless @element.conditional.is_a?(Fe::Page) %>'>
30
- Which page? <%= f.collection_select :conditional_id, @page.question_sheet.pages, :id, :label %>
32
+ <label>Which page? </label>
33
+ <%= f.collection_select :conditional_id, @page.question_sheet.pages, :id, :label, include_blank: true %>
31
34
  </div>
32
35
  </div>
33
36
  <br/>
34
37
 
38
+ <p><label for="css_class" class="desc">Css Class</label>
39
+ <%= f.text_field :css_class %></p>
40
+
35
41
  <p><label for="element_object" class="desc">Object Name</label>
36
42
  <%= f.text_field :object_name %></p>
37
43
 
@@ -1,16 +1,30 @@
1
1
  <p>
2
- <label for="element_label" class="desc">Label <span class="required">required</span></label>
2
+ <label for="element_label" class="desc">Label (English) <span class="required">required</span></label>
3
3
  <%= f.text_field :label, :maxlength => Fe::Element.max_label_length %>
4
4
  </p>
5
- <div class="field">
6
- <label for="element_tooltip" class="desc">Tip</label>
5
+ <% @page.question_sheet.languages.select(&:present?).each do |language| %>
6
+ <p>
7
+ <label for="element_label_translations_<%= language %>" class="desc">Label (<%= Fe::LANGUAGES[language] %>) <span class="required">required</span></label>
8
+ <%= text_field_tag "element[label_translations][#{language}]", @element.label_translations[language] %>
9
+ </p>
10
+ <% end %>
11
+
12
+ <p>
13
+ <label for="element_tooltip" class="desc">Tip (English)</label>
7
14
  <%= f.text_field :tooltip %>
8
- </div>
15
+ </p>
16
+ <% @page.question_sheet.languages.select(&:present?).each do |language| %>
17
+ <p>
18
+ <label for="element_tip_translations_<%= language %>" class="desc">Tip (<%= Fe::LANGUAGES[language] %>)</label>
19
+ <%= text_field_tag "element[tip_translations][#{language}]", @element.tip_translations[language] %>
20
+ </p>
21
+ <% end %>
22
+
9
23
  <p>
10
24
  <label for="element_slug" class="desc">Variable</label>
11
25
  <%= f.text_field :slug %>
12
26
  <p>
13
-
27
+
14
28
  <p>
15
29
  <%= f.check_box :required, :class => 'inlinecheck' %>
16
30
  <label for="element_required" class="inline">This field is required</label>
@@ -1,3 +1,3 @@
1
- <li id="link-<%= dom_id(page) %>" <% if page == current_page -%> class="active"<% end -%>>
1
+ <li id="link-<%= dom_id(page) %>" class="sortable <% if page == current_page %>active<% end -%>">
2
2
  <%= link_to page.label, fe_admin_question_sheet_page_path(page.question_sheet_id, page.id), :remote => true, :method => :get %>
3
3
  </li>
@@ -17,30 +17,39 @@
17
17
 
18
18
  <%= render 'fe/admin/panels/common_fields', :f => f %>
19
19
 
20
- <div id="choices_section" style="display:<%= ['acceptance', 'yes-no'].include?(@element.style) ? 'none' : 'block' %>">
20
+ <div class="choices_section" style="display:<%= ['acceptance', 'yes-no'].include?(@element.style) ? 'none' : 'block' %>">
21
21
  <h3>Choices<br/>
22
22
  <% showXML = !@element.source.blank? %>
23
- <a id="link-show-xml" style="font-size: 11px; font-weight: normal; display:<% if showXML -%>none<%else-%>block<%end-%>" href="javascript:void(0);" onclick="$('xmlChoices').show();$('link-show-csv').show();$('link-show-xml').hide();$('csvChoices').hide();">Use External XML Feed</a>
24
- <a id="link-show-csv" style="font-size: 11px; font-weight: normal; display:<% if showXML -%>block<%else-%>none<%end-%>" href="javascript:void(0);" onclick="$('csvChoices').show();$('link-show-xml').show();$('link-show-csv').hide();$('xmlChoices').hide();">Manually Enter Choices</a></h3>
23
+ <a class="link-show-xml" style="font-size: 11px; font-weight: normal; display:<% if showXML -%>none<%else-%>block<%end-%>" href="javascript:void(0);">Use External XML Feed</a>
24
+ <a class="link-show-csv" style="font-size: 11px; font-weight: normal; display:<% if showXML -%>block<%else-%>none<%end-%>" href="javascript:void(0);">Manually Enter Choices</a></h3>
25
+
26
+ <div class="csvChoices" style="display:<% if showXML -%>none<%else-%>block<%end-%>">
27
+ <p>
28
+ <label for="element_content" class="desc">Choices (English)</label>
29
+ <%= f.text_area :content, :rows => 6, :cols => 80 %>
30
+ </p>
31
+ <% @page.question_sheet.languages.select(&:present?).each do |language| %>
32
+ <p>
33
+ <label for="element_content_translations_<%= language %>" class="desc">Choices (<%= Fe::LANGUAGES[language] %>)</label>
34
+ <%= text_area_tag "element[content_translations][#{language}]", @element.content_translations[language], :rows => 6, :cols => 80 %>
35
+ </p>
36
+ <% end %>
25
37
 
26
- <div id="csvChoices" style="display:<% if showXML -%>none<%else-%>block<%end-%>">
27
- <p><label for="element_content" class="desc">Choices</label>
28
- <%= f.text_area :content, :rows => 4, :cols => 25 %></p>
29
38
  </div>
30
39
 
31
40
  <p>
32
41
  <%= f.check_box :hide_option_labels, :class => 'inlinecheck' %>
33
42
  <label for="element_hide_option_labels" class="inline">Hide Option Labels</label>
34
43
  </p>
35
-
36
- <div id="xmlChoices" style="display:<% if showXML -%>block<%else-%>none<%end-%>">
44
+
45
+ <div class="xmlChoices" style="display:<% if showXML -%>block<%else-%>none<%end-%>">
37
46
  <p><label for="element_source" class="desc">XML Feed for Choices</label>
38
47
  <%= f.text_field :source %></p>
39
-
48
+
40
49
  <p><label for="element_text_xpath" class="desc">XPath to Choice Text</label>
41
50
  <%= f.text_field :text_xpath %></p>
42
-
51
+
43
52
  <p><label for="element_value_xpath" class="desc">XPath to Choice Value</label>
44
53
  <%= f.text_field :value_xpath %></p>
45
54
  </div>
46
- </div>
55
+ </div>
@@ -1,6 +1,6 @@
1
1
  <div id="panel-properties-element" class="panel" style="display:block;">
2
2
  <p>Update the settings for this element.</p>
3
-
3
+
4
4
  <div id="errors">
5
5
  <%= render 'errors', :element => element %>
6
6
  </div>
@@ -8,21 +8,14 @@
8
8
  <%= form_for :element, :url => fe_admin_question_sheet_page_element_path( @page.question_sheet_id, @page.id, element.id), :remote => true, :html => {:method => :put} do |f| -%>
9
9
 
10
10
  <%= render 'fe/admin/panels/prop_' + element.class.to_s.split('::').last.underscore, :f => f, :element => element %>
11
-
11
+
12
12
  <% if element.question? -%>
13
- <!-- <h3>Dependency</h3>
14
- <p><strong>Ask this question if:</strong></p>
15
- <% element.conditions.each_with_index do |condition, i| %>
16
- <%#= render :partial => 'fe/admin/panels/condition', :object => condition, :locals => {:i => i} %>
17
- <% end %> -->
18
-
19
13
  <%= render 'fe/admin/panels/advanced_options', :f => f, :element => element %>
20
14
  <% end-%>
21
15
 
22
16
  <p class="buttons">
23
17
  <button type="submit"><span>Update</span></button>
24
18
  <%= link_to('Close', '#', 'data-dom_id' => dom_id(element), :class => 'close_prop') %>
25
- <%#= link_to('Delete', fe_admin_question_sheet_page_element_path( @page.question_sheet_id, @page.id, element.id), :remote => true, :method => :delete, data: {:confirm => "Are you sure you want to delete this element?"}) %>
26
19
  </p>
27
20
 
28
21
  <% end -%>
@@ -6,14 +6,19 @@
6
6
  </div>
7
7
 
8
8
  <%= form_for(page, :url => fe_admin_question_sheet_page_path(page.question_sheet_id, page.id), :remote => true, :html => {:method => :put}) do |f| %>
9
- <p><label for="" class="desc">Label <span class="required">required</span></label>
9
+ <p><label for="" class="desc">Label (English) <span class="required">required</span></label>
10
10
  <%= f.text_field :label, maxlength: 100, size: 40 %></p>
11
-
11
+ <% page.question_sheet.languages.select(&:present?).each do |language| %>
12
+ <p>
13
+ <label for="fe_page_label_translations_<%= language %>" class="desc">Label (<%= Fe::LANGUAGES[language] %>) <span class="required">required</span></label>
14
+ <%= text_field_tag "fe_page[label_translations][#{language}]", page.label_translations[language] %>
15
+ </p>
16
+ <% end %>
12
17
  <p><label for="" class="desc">Hidden</label>
13
18
  <%= f.check_box :hidden %></p>
14
19
 
15
20
  <p class="buttons">
16
- <%= submit_tag "Update &raquo;".html_safe %>
21
+ <%= submit_tag "Update &raquo;".html_safe, data: { disable_with: "Please wait..." } %>
17
22
  </p>
18
23
  <p class="buttons"><%= link_to "Delete", fe_admin_question_sheet_page_path(page.question_sheet_id, page.id), :remote => true, :method => :delete, data: {confirm: "Are you sure you want to delete this page?"} %></p>
19
24
  <% end %>
@@ -1,32 +1,46 @@
1
1
  <p>
2
- <label for="element_content" class="desc">Paragraph Content</label>
3
- <%= f.text_area :content, :rows => 4, :cols => 25, :id => "element_content_#{element.id}" %>
2
+ <label for="element_content" class="desc">Paragraph Content (English)</label>
3
+ <%= f.text_area :content, :rows => 6, :cols => 80, :id => "element_content_#{element.id}" %>
4
+ </p>
5
+ <% @page.question_sheet.languages.select(&:present?).each do |language| %>
6
+ <p>
7
+ <label for="element_content_translations_<%= language %>" class="desc">Paragraph Content (<%= Fe::LANGUAGES[language] %>)</label>
8
+ <%= text_area_tag "element[content_translations][#{language}]", @element.content_translations[language], :rows => 6, :cols => 80 %>
9
+ </p>
10
+ <% end %>
11
+
12
+ <p>
13
+ <label for="element_css_class" class="desc">Css Class</label>
14
+ <%= f.text_field :css_class %>
4
15
  </p>
5
16
 
6
17
  <script type="text/javascript" charset="utf-8">
7
18
  $(function() {
8
- if (CKEDITOR.instances['element_content_<%= element.id %>']) {
9
- CKEDITOR.instances['element_content_<%= element.id %>'].destroy();
10
- }
11
- editor = CKEDITOR.replace( 'element_content_<%= element.id %>', {
12
- toolbar : [['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link']],
13
- on :
14
- {
15
- instanceReady : function( ev )
16
- {
17
- // Output paragraphs as <p>Text</p>.
18
- this.dataProcessor.writer.setRules( 'p',
19
- {
20
- indent : false,
21
- breakBeforeOpen : true,
22
- breakAfterOpen : false,
23
- breakBeforeClose : false,
24
- breakAfterClose : true
25
- });
26
- }
27
- }
19
+ if (typeof(CKEDITOR) !== 'undefined') {
20
+ if (CKEDITOR.instances['element_content_<%= element.id %>']) {
21
+ CKEDITOR.instances['element_content_<%= element.id %>'].destroy();
22
+ }
23
+ editor = CKEDITOR.replace( 'element_content_<%= element.id %>', {
24
+ toolbar : [['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link']],
25
+ on :
26
+ {
27
+ instanceReady : function( ev )
28
+ {
29
+ // Output paragraphs as <p>Text</p>.
30
+ this.dataProcessor.writer.setRules( 'p',
31
+ {
32
+ indent : false,
33
+ breakBeforeOpen : true,
34
+ breakAfterOpen : false,
35
+ breakBeforeClose : false,
36
+ breakAfterClose : true
37
+ });
38
+ }
39
+ }
28
40
 
29
- }
30
- );
41
+ }
42
+ );
43
+ }
31
44
  });
32
45
  </script>
46
+
@@ -1,2 +1,8 @@
1
- <p><label for="element_label" class="desc">Heading Label <span class="required">required</span></label>
2
- <%= f.text_field :label, :maxlength => Fe::Element.max_label_length %></p>
1
+ <p><label for="element_label" class="desc">Heading Label <span class="required">required</span></label>
2
+ <%= f.text_field :label, :maxlength => Fe::Element.max_label_length %></p>
3
+ <% @page.question_sheet.languages.select(&:present?).each do |language| %>
4
+ <p>
5
+ <label for="element_label_translations_<%= language %>" class="desc">Label (<%= Fe::LANGUAGES[language] %>) <span class="required">required</span></label>
6
+ <%= text_field_tag "element[label_translations][#{language}]", @element.label_translations[language] %>
7
+ </p>
8
+ <% end %>
@@ -10,8 +10,11 @@
10
10
  <p><label for="" class="desc">Label <span class="required">required</span></label>
11
11
  <%= f.text_field :label, :maxlength => 50 %></p>
12
12
 
13
+ <p><label for="" class="desc">Languages (in addition to english)</label>
14
+ <%= f.select :languages, Fe::LANGUAGES.collect {|k, v| [v, k]}, {}, { size: 3, multiple: true } %></p>
15
+
13
16
  <p class="buttons">
14
- <%= submit_tag"Update &raquo;".html_safe %></p>
17
+ <%= submit_tag "Update &raquo;".html_safe, data: { disable_with: "Please wait..." } %></p>
15
18
 
16
19
  <% end %>
17
20
  </div>
@@ -1,4 +1,10 @@
1
- <li class="element" id="element_<%= element.id %>">
1
+ <% container_element = element.is_a?(Fe::QuestionGrid) || (element.is_a?(Fe::ChoiceField) && element.style == 'yes-no') %>
2
+ <% if container_element %>
3
+ <!-- add a droppable block before and after each container element (question_grid / choice_field) so that the admin can move elements out of a container element -->
4
+ <li class="droppable around-container before-container" data-element_id="<%= element.id %>" data-url="<%= drop_fe_admin_question_sheet_page_element_path(@page.question_sheet_id, @page.id, element.id, before: true) %>"></li>
5
+ <% end %>
6
+
7
+ <li class="element sortable <%= 'container' if container_element %>" id="element_<%= element.id %>" data-element_id="<%= element.id %>">
2
8
  <div class="controls">
3
9
  <ul>
4
10
  <li><%= link_to "edit", edit_fe_admin_question_sheet_page_element_path(@page.question_sheet.id, @page.id, element.id), :remote => true, :method => :get, :class => "edit", :title => "Edit this element" %></li>
@@ -16,3 +22,7 @@
16
22
  <div class="q q_form" id="element_form_<%= dom_id(element) %>">
17
23
  </div>
18
24
  </li>
25
+
26
+ <% if container_element %>
27
+ <li class="droppable around-container after-container" data-element_id="<%= element.id %>" data-url="<%= drop_fe_admin_question_sheet_page_element_path(@page.question_sheet_id, @page.id, element.id, after: true) %>"></li>
28
+ <% end %>
@@ -5,14 +5,15 @@
5
5
  <div id="<%= page_dom %>" class="answer-page" style="<% if show_first.nil? -%>display: none;<% end -%>"> <!-- this id is parsed by fe.public.js -->
6
6
 
7
7
  <div class="page">
8
- <h4 id='page-name'><%= @presenter.active_page.label %></h4>
8
+ <%= render "fe/answer_pages/page_name" %>
9
9
 
10
10
  <% if @elements.length > 0 -%>
11
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] %>
12
13
  <ul class="questions" id="questions_list">
13
14
  <% previous_element = nil %>
14
15
  <% @elements.each do |element| %>
15
- <li style="<%= 'display:none' if previous_element && previous_element.conditional == element && !previous_element.conditional_match(@answer_sheet) %>" class="<%= element.class.to_s.downcase %> <%= 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 %>"<% end %>>
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 %>>
16
17
  <%= render 'fe/answer_pages/element', :element => element %>
17
18
  </li>
18
19
  <% previous_element = element %>
@@ -22,22 +23,22 @@
22
23
  <% if next_js.empty? -%>
23
24
  <div id="submit_message" class="validation-advice" style="display: none;"></div>
24
25
  <div>
25
- <button type="button" class="button save_button">Save Now</button>
26
- <button type="submit" style="background-color: #f9b625; border: 2px solid #f8ae0c; color: white !important;" class="button cru-gold no-left-margin" onclick="page_handler.completeAll(); return false;" id="submit_button">Submit</button>
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>
27
28
  </div>
28
29
  <% else -%>
29
30
  <div class="savestatus">
30
- Last Saved: <span class="last-saved"><%= l(@answer_sheet.updated_at, :format => :datetime) %></span><%= spinner(page_dom) %>
31
+ <%= _('Last Saved:') %> <span class="last-saved"><%= l(@answer_sheet.updated_at, :format => :datetime) %></span><%= spinner(page_dom) %>
31
32
  </div>
32
33
  <div>
33
- <button type="button" class="button no-left-margin save_button">Save Now</button>
34
- <button type="button" class="button cru-gold" onclick="<%= next_js %>">Next >></button>
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>
35
36
  </div>
36
37
  <% end -%>
37
38
  <% end -%>
38
39
  <% else -%>
39
40
  <div style="background: #ffc;">
40
- <p>There are no questions on this page.</p>
41
+ <p><%= _('There are no questions on this page.') %></p>
41
42
  </div>
42
43
  <% end -%>
43
44
  </div>
@@ -1,13 +1,12 @@
1
+
1
2
  <% if element.question? && element.default_label? && element.label.present? && !element.hide_label? -%>
2
3
  <label for="<%= dom_id(element) %>" class="desc">
3
- <%= raw element.label %>
4
- <% if element.required?(@answer_sheet) -%><span class="required">required</span><% end -%>
4
+ <%= raw element.label(session[:locale]) %>
5
+ <% if element.required?(@answer_sheet, @page) -%><span class="required"><%= _('required') %></span><% end -%>
5
6
  <%= tip(element.tooltip) if element.tooltip.present? %>
6
7
  </label>
7
8
  <% end -%>
8
9
 
9
- <% begin %>
10
- <%= render :partial => 'fe/questions/' + element.ptemplate, :object => element, :locals => {:col => nil} %>
11
- <% rescue => ex %>
12
- <% raise ex %>
13
- <% end %>
10
+ <% col ||= nil %>
11
+ <%= render :partial => 'fe/questions/' + element.ptemplate, :object => element, :locals => {:col => col} %>
12
+
@@ -0,0 +1 @@
1
+ <h4 id='page-name'><%= @presenter.active_page.label(session[:locale]) %></h4>
@@ -1,5 +1,5 @@
1
- $('.last-saved').html('<%= escape_javascript(l(@answer_sheet.updated_at, :format => :datetime)) %>')
1
+ $('.last-saved').html('<%= escape_javascript(l(@saved_at_timestamp, :format => :datetime)) %>')
2
2
  <% if @answer && @answer.attachment_file_name %>
3
- $('#attachment_field_<%= @answer.question_id %>_filename').html('Current File: <%= link_to(@answer.attachment_file_name, @answer.attachment.url) %>')
4
- $('#attachment_field_<%= @answer.question_id %>_filename').effect('highlight')
3
+ $('#<%= dom_id(@answer.question) %>_filename').html('Current File: <%= link_to(@answer.attachment_file_name, @answer.attachment.url) %>')
4
+ $('#<%= dom_id(@answer.question) %>_filename').effect('highlight')
5
5
  <% end %>
@@ -2,11 +2,11 @@
2
2
 
3
3
  <% if elements.length > 0 -%>
4
4
 
5
- <% elements.each do |page_id, page_elements| -%>
6
- <% page = Fe::Page.find(page_id) %>
5
+ <% elements.each do |page, page_elements| -%>
7
6
  <% next unless page.has_questions? %>
7
+ <a name="<%= dom_id(page) %>"></a>
8
8
 
9
- <div class="page">
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
12
  <%= render :partial => 'fe/answer_sheets/element', :collection => page_elements, :locals => {:elements => page_elements} %>
@@ -1,39 +1,54 @@
1
- <% if element.kind == "Fe::QuestionGrid" -%>
1
+ <% if element.kind == "Fe::QuestionGrid" || element.kind == "Fe::QuestionGridWithTotal"-%>
2
2
  <li>
3
- <label class="desc"><%= raw element.label %></label>
4
- <table class="grid">
5
- <%- if element.cols -%>
6
- <tr>
7
- <%- element.cols.split(';').each do |header| -%>
8
- <th><%= raw header || '&nbsp;' %></th>
9
- <%- end -%>
10
- </tr>
11
- <%- end -%>
12
- <tr>
13
- <%- col_count = 0
14
- element.elements.each do |grid_element| -%>
15
- <td id="element_<%= element.id %>">
16
- <% if %w(Fe::Paragraph).include?(grid_element.kind) -%>
17
- <%= simple_format grid_element.content %>
18
- <% else -%>
19
- <%# el = elements.detect {|el| el.id == grid_element.id } -%>
20
- <% if grid_element.question? -%>
21
- <label class="desc"><%= raw grid_element.label %></label>
22
- <% end %>
23
- <span class="answer"><%= simple_format grid_element.display_response(@answer_sheet) %></span>
24
- <% end -%>
25
- </td>
26
- <%- col_count += 1
27
- if col_count % element.num_cols == 0 then col_count = 0 -%></tr><tr><%- end -%>
28
- <%- end -%>
29
- <%- while col_count < element.num_cols do
30
- col_count += 1-%>
31
- <td>&nbsp;</td>
32
- <%- end unless col_count == 0-%>
33
- </tr>
34
- </table>
3
+ <label class="desc"><%= raw element.label %></label>
4
+ <table class="grid">
5
+ <%- if element.cols -%>
6
+ <tr>
7
+ <%- element.cols.split(';').each do |header| -%>
8
+ <th><%= raw header || '&nbsp;' %></th>
9
+ <%- end -%>
10
+ </tr>
11
+ <%- end -%>
12
+ <tr>
13
+ <%- col_count = 0
14
+ element.elements.each do |grid_element| -%>
15
+ <td id="element_<%= element.id %>">
16
+ <% if %w(Fe::Paragraph).include?(grid_element.kind) -%>
17
+ <%= simple_format grid_element.content %>
18
+ <% else -%>
19
+ <%# el = elements.detect {|el| el.id == grid_element.id } -%>
20
+ <% if grid_element.question? -%>
21
+ <label class="desc"><%= raw grid_element.label %></label>
22
+ <%- if @collating -%>
23
+ <%- for answer_sheet in @collated_answer_sheets[@answer_sheet] -%>
24
+ <div class="answer collate">
25
+ <span class="reviewer_name"><%= answer_sheet.collat_title %>:</span>
26
+ <span class="reviewer_answer"><%= simple_format grid_element.display_response(answer_sheet) %></span>
27
+ </div>
28
+ <%- end -%>
29
+ <%- else -%>
30
+ <span class="answer"><%= simple_format grid_element.display_response(@answer_sheet) %></span>
31
+ <%- end -%>
32
+ <% elsif grid_element.is_a?(Fe::QuestionGrid) || grid_element.is_a?(Fe::QuestionGridWithTotal) %>
33
+ <ul>
34
+ <%= render :partial => 'fe/answer_sheets/element', :object => grid_element %>
35
+ </ul>
36
+ <% else %>
37
+ <%= render :partial => 'fe/questions/' + element.ptemplate, :object => element %>
38
+ <% end %>
39
+ <% end -%>
40
+ </td>
41
+ <%- col_count += 1
42
+ if col_count % element.num_cols == 0 then col_count = 0 -%></tr><tr><%- end -%>
43
+ <%- end -%>
44
+ <%- while col_count < element.num_cols do
45
+ col_count += 1-%>
46
+ <td>&nbsp;</td>
47
+ <%- end unless col_count == 0-%>
48
+ </tr>
49
+ </table>
35
50
  </li>
36
- <% elsif element.question_grid_id.nil? && element.conditional_id.nil? -%>
51
+ <% else %>
37
52
  <li>
38
53
  <% if element.question? -%>
39
54
  <label class="desc"><%= raw element.label %></label>
@@ -51,4 +66,7 @@
51
66
  <%= render :partial => 'fe/questions/' + element.ptemplate, :object => element %>
52
67
  <% end -%>
53
68
  </li>
69
+ <% element.choice_field_children.each do |choice_field_child| %>
70
+ <%= render 'fe/answer_sheets/element', element: choice_field_child %>
71
+ <% end %>
54
72
  <% end -%>