fe 0.0.4 → 2.0.0
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.
- checksums.yaml +5 -5
- data/README.md +4 -4
- data/Rakefile +16 -36
- data/app/assets/config/fe/manifest.js +3 -0
- data/app/assets/config/manifest.js +3 -0
- data/app/assets/javascripts/application.js.erb +1 -1
- data/app/assets/javascripts/fe/admin.js +0 -2
- data/app/assets/javascripts/fe/fe.admin.js +40 -20
- data/app/assets/javascripts/fe/fe.common.js.erb +98 -0
- data/app/assets/javascripts/fe/fe.public.js +2 -416
- data/app/assets/javascripts/fe/fe.public.nojquery.js.erb +526 -0
- data/app/assets/javascripts/fe/jquery.html5_upload.js +258 -0
- data/app/assets/javascripts/fe/jquery.validate.pack.js +3 -15
- data/app/assets/stylesheets/fe/fe.screen.css.scss.erb +90 -10
- data/app/assets/stylesheets/fe/validation.css +5 -1
- data/app/controllers/concerns/fe/admin/question_sheets_controller_concern.rb +111 -0
- data/app/controllers/concerns/fe/answer_pages_controller_concern.rb +131 -0
- data/app/controllers/{fe/concerns → concerns/fe}/answer_sheets_controller_concern.rb +15 -7
- data/app/controllers/{fe/concerns → concerns/fe}/application_controller_concern.rb +15 -2
- data/app/controllers/fe/admin/elements_controller.rb +102 -64
- data/app/controllers/fe/admin/email_templates_controller.rb +7 -7
- data/app/controllers/fe/admin/question_pages_controller.rb +9 -9
- data/app/controllers/fe/admin/question_sheets_controller.rb +2 -103
- data/app/controllers/fe/reference_pages_controller.rb +11 -11
- data/app/controllers/fe/reference_sheets_controller.rb +6 -4
- data/app/controllers/fe/references_controller.rb +20 -19
- data/app/controllers/fe/submit_pages_controller.rb +5 -5
- data/app/helpers/fe/answer_pages_helper.rb +1 -1
- data/app/helpers/fe/application_helper.rb +8 -3
- data/app/jobs/fe/update_reference_sheet_visibility_job.rb +11 -0
- data/app/mailers/fe/notifier.rb +12 -5
- data/app/models/answer_sheet.rb +2 -0
- data/app/models/application_record.rb +3 -0
- data/app/models/{fe/concerns → concerns/fe}/answer_concern.rb +2 -2
- data/app/models/{fe/concerns → concerns/fe}/answer_pages_presenter_concern.rb +15 -5
- data/app/models/concerns/fe/answer_sheet_concern.rb +125 -0
- data/app/models/{fe/concerns → concerns/fe}/choice_field_concern.rb +56 -31
- data/app/models/fe/address.rb +2 -2
- data/app/models/fe/answer.rb +1 -1
- data/app/models/fe/answer_sheet.rb +1 -1
- data/app/models/fe/answer_sheet_question_sheet.rb +2 -2
- data/app/models/fe/application.rb +15 -10
- data/app/models/fe/condition.rb +4 -4
- data/app/models/fe/date_field.rb +2 -2
- data/app/models/fe/element.rb +201 -45
- data/app/models/fe/email_address.rb +2 -2
- data/app/models/fe/email_template.rb +1 -1
- data/app/models/fe/page.rb +138 -31
- data/app/models/fe/page_element.rb +8 -3
- data/app/models/fe/page_link.rb +6 -3
- data/app/models/fe/paragraph.rb +1 -1
- data/app/models/fe/person.rb +16 -13
- data/app/models/fe/phone_number.rb +1 -1
- data/app/models/fe/question.rb +64 -44
- data/app/models/fe/question_grid.rb +16 -4
- data/app/models/fe/question_grid_with_total.rb +15 -0
- data/app/models/fe/question_set.rb +54 -14
- data/app/models/fe/question_sheet.rb +54 -19
- data/app/models/fe/reference_question.rb +9 -13
- data/app/models/fe/reference_sheet.rb +113 -54
- data/app/models/fe/state_chooser.rb +2 -2
- data/app/models/fe/text_field.rb +2 -2
- data/app/models/fe/user.rb +1 -1
- data/app/models/staff.rb +8 -6
- data/app/validators/email_validator.rb +11 -0
- data/app/views/fe/admin/elements/create.js.erb +4 -3
- data/app/views/fe/admin/elements/destroy.js.erb +1 -1
- data/app/views/fe/admin/elements/drop.js.erb +2 -1
- data/app/views/fe/admin/elements/duplicate.js.erb +2 -1
- data/app/views/fe/admin/elements/edit.js.erb +1 -1
- data/app/views/fe/admin/elements/error.js.erb +1 -1
- data/app/views/fe/admin/elements/new.js.erb +13 -6
- data/app/views/fe/admin/elements/update.js.erb +1 -1
- data/app/views/fe/admin/email_templates/_form.html.erb +3 -3
- data/app/views/fe/admin/email_templates/edit.html.erb +3 -3
- data/app/views/fe/admin/email_templates/index.html.erb +3 -3
- data/app/views/fe/admin/email_templates/new.html.erb +3 -3
- data/app/views/fe/admin/panels/_advanced_options.html.erb +16 -10
- data/app/views/fe/admin/panels/_common_boolean_fields.html.erb +1 -0
- data/app/views/fe/admin/panels/_common_boolean_fields_default.html.erb +11 -0
- data/app/views/fe/admin/panels/_common_fields.html.erb +18 -19
- data/app/views/fe/admin/panels/_condition.html.erb +1 -1
- data/app/views/fe/admin/panels/_insert.html.erb +25 -25
- data/app/views/fe/admin/panels/_nav_controls.html.erb +4 -4
- data/app/views/fe/admin/panels/_page.html.erb +2 -2
- data/app/views/fe/admin/panels/_pages_list.html.erb +3 -3
- data/app/views/fe/admin/panels/_prop_attachment_field.html.erb +2 -2
- data/app/views/fe/admin/panels/_prop_choice_field.html.erb +52 -24
- data/app/views/fe/admin/panels/_prop_date_field.html.erb +1 -1
- data/app/views/fe/admin/panels/_prop_element.html.erb +7 -14
- data/app/views/fe/admin/panels/_prop_page.html.erb +11 -6
- data/app/views/fe/admin/panels/_prop_paragraph.html.erb +38 -24
- data/app/views/fe/admin/panels/_prop_question_grid.html.erb +7 -2
- data/app/views/fe/admin/panels/_prop_question_grid_with_total.html.erb +2 -2
- data/app/views/fe/admin/panels/_prop_reference_question.html.erb +3 -3
- data/app/views/fe/admin/panels/_prop_section.html.erb +8 -2
- data/app/views/fe/admin/panels/_prop_sheet.html.erb +7 -4
- data/app/views/fe/admin/panels/_prop_text_field.html.erb +12 -12
- data/app/views/fe/admin/question_pages/_element.html.erb +16 -6
- data/app/views/fe/admin/question_pages/_element_show.html.erb +2 -2
- data/app/views/fe/admin/question_pages/_question_page.html.erb +4 -4
- data/app/views/fe/admin/question_pages/create.js.erb +3 -3
- data/app/views/fe/admin/question_pages/destroy.js.erb +3 -3
- data/app/views/fe/admin/question_pages/edit.js.erb +1 -1
- data/app/views/fe/admin/question_pages/error.js.erb +1 -1
- data/app/views/fe/admin/question_pages/show.js.erb +2 -2
- data/app/views/fe/admin/question_pages/show_panel.js.erb +1 -1
- data/app/views/fe/admin/question_pages/update.js.erb +1 -1
- data/app/views/fe/admin/question_sheets/edit.js.erb +1 -1
- data/app/views/fe/admin/question_sheets/error.js.erb +1 -1
- data/app/views/fe/admin/question_sheets/index.html.erb +8 -8
- data/app/views/fe/admin/question_sheets/new.html.erb +3 -3
- data/app/views/fe/admin/question_sheets/show.html.erb +5 -5
- data/app/views/fe/admin/question_sheets/update.js.erb +1 -1
- data/app/views/fe/answer_pages/_answer_page.html.erb +14 -14
- data/app/views/fe/answer_pages/_element.html.erb +25 -6
- data/app/views/fe/answer_pages/_page_name.html.erb +1 -0
- data/app/views/fe/answer_pages/show.html.erb +39 -0
- data/app/views/fe/answer_pages/update.js.erb +11 -3
- data/app/views/fe/answer_sheets/_answer_sheet.html.erb +6 -6
- data/app/views/fe/answer_sheets/_element.html.erb +55 -35
- data/app/views/fe/answer_sheets/_incomplete.html.erb +1 -1
- data/app/views/fe/answer_sheets/_page_link.html.erb +9 -7
- data/app/views/fe/answer_sheets/_pages_list.html.erb +4 -4
- data/app/views/fe/answer_sheets/_submit_to.html.erb +1 -0
- data/app/views/fe/answer_sheets/_title.html.erb +1 -1
- data/app/views/fe/answer_sheets/edit.html.erb +24 -24
- data/app/views/fe/answer_sheets/incomplete.js.erb +9 -3
- data/app/views/fe/answer_sheets/index.html.erb +3 -3
- data/app/views/fe/answer_sheets/show.html.erb +1 -1
- data/app/views/fe/applications/_logout.html.erb +1 -0
- data/app/views/fe/applications/show.html.erb +1 -0
- data/app/views/fe/questions/fe/_acceptance.html.erb +11 -10
- data/app/views/fe/questions/fe/_attachment_field.html.erb +133 -10
- data/app/views/fe/questions/fe/_checkbox_field.html.erb +34 -30
- data/app/views/fe/questions/fe/_country.html.erb +6 -6
- data/app/views/fe/questions/fe/_date_field.html.erb +5 -5
- data/app/views/fe/questions/fe/_date_field_mmyy.html.erb +8 -8
- data/app/views/fe/questions/fe/_drop_down_field.html.erb +7 -6
- data/app/views/fe/questions/fe/_paragraph.html.erb +1 -1
- data/app/views/fe/questions/fe/_question_grid.html.erb +21 -16
- data/app/views/fe/questions/fe/_question_grid_with_total.html.erb +25 -18
- data/app/views/fe/questions/fe/_questions.html.erb +11 -5
- data/app/views/fe/questions/fe/_radio_button_field.html.erb +42 -25
- data/app/views/fe/questions/fe/_rating.html.erb +57 -18
- data/app/views/fe/questions/fe/_reference_discipler.html.erb +1 -1
- data/app/views/fe/questions/fe/_reference_friend.html.erb +1 -1
- data/app/views/fe/questions/fe/_reference_parent.html.erb +1 -1
- data/app/views/fe/questions/fe/_reference_peer.html.erb +1 -1
- data/app/views/fe/questions/fe/_reference_question.html.erb +44 -21
- data/app/views/fe/questions/fe/_reference_roommate.html.erb +1 -1
- data/app/views/fe/questions/fe/_reference_spiritual.html.erb +1 -1
- data/app/views/fe/questions/fe/_reference_staff.html.erb +1 -1
- data/app/views/fe/questions/fe/_section.html.erb +1 -1
- data/app/views/fe/questions/fe/_state_chooser.html.erb +6 -6
- data/app/views/fe/questions/fe/_text_area_field.html.erb +17 -6
- data/app/views/fe/questions/fe/_text_field.html.erb +7 -6
- data/app/views/fe/questions/fe/_yes_no.html.erb +8 -8
- data/app/views/fe/questions/fe/_yes_no_field.erb +12 -9
- data/app/views/fe/reference_pages/_reference.html.erb +15 -15
- data/app/views/fe/reference_pages/edit.html.erb +9 -9
- data/app/views/fe/reference_sheets/done.html.erb +2 -2
- data/app/views/fe/reference_sheets/not_found.html.erb +4 -4
- data/app/views/fe/references/edit.html.erb +6 -6
- data/app/views/fe/references/show.html.erb +8 -8
- data/app/views/fe/references/submit.js.erb +3 -3
- data/app/views/fe/submit_pages/_thankyou.html.erb +1 -1
- data/app/views/fe/submit_pages/edit.html.erb +12 -12
- data/app/views/fe/submit_pages/error.js.erb +1 -1
- data/app/views/fe/submit_pages/submit.js.erb +2 -2
- data/app/views/layouts/fe/_error_messages_for.html.erb +7 -0
- data/app/views/layouts/fe/application.html.erb +4 -5
- data/app/views/layouts/fe/fe_admin.html.erb +30 -0
- data/app/views.current/fe/admin/elements/_errors.html.erb +11 -0
- data/app/views.current/fe/admin/elements/create.js.erb +12 -0
- data/app/views.current/fe/admin/elements/destroy.js.erb +4 -0
- data/app/views.current/fe/admin/elements/drop.js.erb +3 -0
- data/app/views.current/fe/admin/elements/duplicate.js.erb +3 -0
- data/app/views.current/fe/admin/elements/edit.js.erb +4 -0
- data/app/views.current/fe/admin/elements/error.js.erb +4 -0
- data/app/views.current/fe/admin/elements/new.js.erb +17 -0
- data/app/views.current/fe/admin/elements/reorder.js.erb +0 -0
- data/app/views.current/fe/admin/elements/update.js.erb +9 -0
- data/app/views.current/fe/admin/email_templates/_form.html.erb +8 -0
- data/app/views.current/fe/admin/email_templates/edit.html.erb +13 -0
- data/app/views.current/fe/admin/email_templates/index.html.erb +20 -0
- data/app/views.current/fe/admin/email_templates/new.html.erb +11 -0
- data/app/views.current/fe/admin/panels/_advanced_options.html.erb +49 -0
- data/app/views.current/fe/admin/panels/_common_boolean_fields.html.erb +1 -0
- data/app/views.current/fe/admin/panels/_common_boolean_fields_default.html.erb +11 -0
- data/app/views.current/fe/admin/panels/_common_fields.html.erb +23 -0
- data/app/views.current/fe/admin/panels/_condition.html.erb +6 -0
- data/app/views.current/fe/admin/panels/_insert.html.erb +39 -0
- data/app/views.current/fe/admin/panels/_nav_controls.html.erb +6 -0
- data/app/views.current/fe/admin/panels/_page.html.erb +3 -0
- data/app/views.current/fe/admin/panels/_pages_list.html.erb +16 -0
- data/app/views.current/fe/admin/panels/_prop_attachment_field.html.erb +2 -0
- data/app/views.current/fe/admin/panels/_prop_choice_field.html.erb +74 -0
- data/app/views.current/fe/admin/panels/_prop_date_field.html.erb +7 -0
- data/app/views.current/fe/admin/panels/_prop_element.html.erb +23 -0
- data/app/views.current/fe/admin/panels/_prop_page.html.erb +26 -0
- data/app/views.current/fe/admin/panels/_prop_paragraph.html.erb +46 -0
- data/app/views.current/fe/admin/panels/_prop_question_grid.html.erb +28 -0
- data/app/views.current/fe/admin/panels/_prop_question_grid_with_total.html.erb +14 -0
- data/app/views.current/fe/admin/panels/_prop_reference_question.html.erb +12 -0
- data/app/views.current/fe/admin/panels/_prop_section.html.erb +8 -0
- data/app/views.current/fe/admin/panels/_prop_sheet.html.erb +20 -0
- data/app/views.current/fe/admin/panels/_prop_text_field.html.erb +20 -0
- data/app/views.current/fe/admin/question_pages/_element.html.erb +28 -0
- data/app/views.current/fe/admin/question_pages/_element_show.html.erb +10 -0
- data/app/views.current/fe/admin/question_pages/_errors.html.erb +10 -0
- data/app/views.current/fe/admin/question_pages/_question_page.html.erb +13 -0
- data/app/views.current/fe/admin/question_pages/create.js.erb +11 -0
- data/app/views.current/fe/admin/question_pages/destroy.js.erb +5 -0
- data/app/views.current/fe/admin/question_pages/edit.js.erb +3 -0
- data/app/views.current/fe/admin/question_pages/error.js.erb +4 -0
- data/app/views.current/fe/admin/question_pages/show.js.erb +9 -0
- data/app/views.current/fe/admin/question_pages/show_panel.js.erb +3 -0
- data/app/views.current/fe/admin/question_pages/update.js.erb +2 -0
- data/app/views.current/fe/admin/question_sheets/_errors.html.erb +11 -0
- data/app/views.current/fe/admin/question_sheets/edit.js.erb +3 -0
- data/app/views.current/fe/admin/question_sheets/error.js.erb +5 -0
- data/app/views.current/fe/admin/question_sheets/index.html.erb +41 -0
- data/app/views.current/fe/admin/question_sheets/new.html.erb +15 -0
- data/app/views.current/fe/admin/question_sheets/show.html.erb +27 -0
- data/app/views.current/fe/admin/question_sheets/update.js.erb +2 -0
- data/app/views.current/fe/answer_pages/_answer_page.html.erb +53 -0
- data/app/views.current/fe/answer_pages/_element.html.erb +32 -0
- data/app/views.current/fe/answer_pages/_page_name.html.erb +1 -0
- data/app/views.current/fe/answer_pages/show.html.erb +39 -0
- data/app/views.current/fe/answer_pages/update.js.erb +13 -0
- data/app/views.current/fe/answer_sheets/_answer_sheet.html.erb +26 -0
- data/app/views.current/fe/answer_sheets/_element.html.erb +74 -0
- data/app/views.current/fe/answer_sheets/_incomplete.html.erb +10 -0
- data/app/views.current/fe/answer_sheets/_page_link.html.erb +9 -0
- data/app/views.current/fe/answer_sheets/_pages_list.html.erb +11 -0
- data/app/views.current/fe/answer_sheets/_submit_to.html.erb +1 -0
- data/app/views.current/fe/answer_sheets/_title.html.erb +1 -0
- data/app/views.current/fe/answer_sheets/edit.html.erb +66 -0
- data/app/views.current/fe/answer_sheets/incomplete.js.erb +11 -0
- data/app/views.current/fe/answer_sheets/index.html.erb +18 -0
- data/app/views.current/fe/answer_sheets/send_reference_invite.js.erb +8 -0
- data/app/views.current/fe/answer_sheets/show.html.erb +13 -0
- data/app/views.current/fe/applications/_logout.html.erb +1 -0
- data/app/views.current/fe/applications/show.html.erb +1 -0
- data/app/views.current/fe/help/builder.html +33 -0
- data/app/views.current/fe/help/question_grid.html +18 -0
- data/app/views.current/fe/questions/fe/_acceptance.html.erb +14 -0
- data/app/views.current/fe/questions/fe/_attachment_field.html.erb +165 -0
- data/app/views.current/fe/questions/fe/_checkbox_field.html.erb +53 -0
- data/app/views.current/fe/questions/fe/_country.html.erb +7 -0
- data/app/views.current/fe/questions/fe/_date_field.html.erb +7 -0
- data/app/views.current/fe/questions/fe/_date_field_mmyy.html.erb +9 -0
- data/app/views.current/fe/questions/fe/_drop_down_field.html.erb +8 -0
- data/app/views.current/fe/questions/fe/_paragraph.html.erb +1 -0
- data/app/views.current/fe/questions/fe/_question_grid.html.erb +70 -0
- data/app/views.current/fe/questions/fe/_question_grid_with_total.html.erb +64 -0
- data/app/views.current/fe/questions/fe/_questions.html.erb +15 -0
- data/app/views.current/fe/questions/fe/_radio_button_field.html.erb +60 -0
- data/app/views.current/fe/questions/fe/_rating.html.erb +64 -0
- data/app/views.current/fe/questions/fe/_reference_discipler.html.erb +1 -0
- data/app/views.current/fe/questions/fe/_reference_friend.html.erb +1 -0
- data/app/views.current/fe/questions/fe/_reference_parent.html.erb +1 -0
- data/app/views.current/fe/questions/fe/_reference_peer.html.erb +1 -0
- data/app/views.current/fe/questions/fe/_reference_question.html.erb +61 -0
- data/app/views.current/fe/questions/fe/_reference_roommate.html.erb +1 -0
- data/app/views.current/fe/questions/fe/_reference_spiritual.html.erb +1 -0
- data/app/views.current/fe/questions/fe/_reference_staff.html.erb +1 -0
- data/app/views.current/fe/questions/fe/_section.html.erb +1 -0
- data/app/views.current/fe/questions/fe/_state_chooser.html.erb +7 -0
- data/app/views.current/fe/questions/fe/_text_area_field.html.erb +17 -0
- data/app/views.current/fe/questions/fe/_text_field.html.erb +9 -0
- data/app/views.current/fe/questions/fe/_yes_no.html.erb +17 -0
- data/app/views.current/fe/questions/fe/_yes_no_field.erb +20 -0
- data/app/views.current/fe/reference_pages/_reference.html.erb +31 -0
- data/app/views.current/fe/reference_pages/edit.html.erb +24 -0
- data/app/views.current/fe/reference_sheets/done.html.erb +2 -0
- data/app/views.current/fe/reference_sheets/not_found.html.erb +5 -0
- data/app/views.current/fe/reference_sheets/submitted.js.erb +1 -0
- data/app/views.current/fe/references/edit.html.erb +8 -0
- data/app/views.current/fe/references/send_invite.js.erb +7 -0
- data/app/views.current/fe/references/show.html.erb +18 -0
- data/app/views.current/fe/references/submit.js.erb +3 -0
- data/app/views.current/fe/submit_pages/_errors.html.erb +1 -0
- data/app/views.current/fe/submit_pages/_thankyou.html.erb +2 -0
- data/app/views.current/fe/submit_pages/edit.html.erb +36 -0
- data/app/views.current/fe/submit_pages/error.js.erb +1 -0
- data/app/views.current/fe/submit_pages/submit.js.erb +3 -0
- data/app/views.current/layouts/fe/_error_messages_for.html.erb +7 -0
- data/app/views.current/layouts/fe/application.html.erb +47 -0
- data/app/{views/layouts/fe/fe.admin.html.erb → views.current/layouts/fe/fe_admin.html.erb} +4 -4
- data/config/initializers/paper_trail.rb +3 -0
- data/config/routes.rb +3 -37
- data/db/migrate/20131003041856_core.rb +23 -23
- data/db/migrate/20131003044250_create_reference_sheets.rb +2 -1
- data/db/migrate/20131003044436_add_element_and_answer_fields.rb +3 -3
- data/db/migrate/20131003044518_create_email_templates.rb +2 -2
- data/db/migrate/20131003044621_add_max_lengths.rb +1 -1
- data/db/migrate/20131003044714_create_join_table.rb +1 -1
- data/db/migrate/20131016162128_remove_question_id_from_element.rb +1 -1
- data/db/migrate/20140623153424_create_fe_people.rb +2 -2
- data/db/migrate/20140624180246_create_fe_addresses.rb +2 -2
- data/db/migrate/{20140624182216_create_create_fe_phone_numbers.rb → 20140624182216_create_fe_phone_numbers.rb} +2 -2
- data/db/migrate/20140625160545_create_fe_users.rb +2 -2
- data/db/migrate/20140808202507_add_conditional_type_to_elements.rb +1 -1
- data/db/migrate/20140808203609_add_conditional_answer_to_elements.rb +1 -1
- data/db/migrate/20141103204704_remove_short_value_column.rb +1 -1
- data/db/migrate/20141109154522_move_conditional_ids_used_for_choice_field_to_their_own_column.rb +1 -1
- data/db/migrate/20150504221439_add_all_element_ids_to_pages.rb +5 -0
- data/db/migrate/20150713022326_add_locale_columns.rb +9 -0
- data/db/migrate/20150714220730_add_locale_to_answer_sheet.rb +5 -0
- data/db/migrate/20150925181652_add_share_to_elements.rb +5 -0
- data/db/migrate/20150928085325_change_pages_all_element_ids_to_text.rb +5 -0
- data/db/migrate/20150930191538_add_locale_to_reference_sheets.rb +5 -0
- data/db/migrate/20151021181928_switch_conditional_answer_separator_to_semicolon.rb +7 -0
- data/db/migrate/20151021184250_add_question_sheet_id_in_refs.rb +12 -0
- data/db/migrate/20160201185838_add_visible_and_visibility_cache_key_to_reference_sheets.rb +6 -0
- data/db/migrate/20160805221415_add_rating_extra_labels.rb +10 -0
- data/db/migrate/20181108201746_create_versions.rb +80 -0
- data/db/migrate/20181218201130_increase_slug_length.rb +5 -0
- data/lib/access_key_generator.rb +12 -0
- data/lib/distinct_distinct_patch.rb +20 -0
- data/lib/fe/engine.rb +26 -14
- data/lib/fe/version.rb +1 -1
- data/lib/fe.rb +11 -1
- data/spec/controllers/fe/admin/elements_controller_spec.rb +211 -1
- data/spec/controllers/fe/admin/email_templates_controller_spec.rb +26 -1
- data/spec/controllers/fe/admin/question_pages_controller_spec.rb +8 -1
- data/spec/controllers/fe/admin/question_sheets_controller_spec.rb +48 -1
- data/spec/controllers/fe/answer_pages_controller_spec.rb +129 -1
- data/spec/controllers/fe/answer_sheets_controller_spec.rb +136 -1
- data/spec/controllers/fe/reference_pages_controller.rb +4 -0
- data/spec/controllers/fe/references_controller_spec.rb +4 -0
- data/spec/controllers/fe/submit_pages_controller_spec.rb +4 -0
- data/spec/dummy/app/assets/config/manifest.js +0 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +9 -0
- data/spec/dummy/app/models/application.rb +3 -0
- data/spec/dummy/app/models/person.rb +11 -0
- data/spec/dummy/app/models/user.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +2 -2
- data/spec/dummy/config/application.rb +3 -1
- data/spec/dummy/config/database.yml +20 -17
- data/spec/dummy/config/environments/production.rb +1 -5
- data/spec/dummy/config/environments/test.rb +4 -2
- data/spec/dummy/config/initializers/assets.rb +5 -2
- data/spec/dummy/config/initializers/fast_gettext.rb +5 -0
- data/spec/dummy/config/initializers/to_unsafe_h.rb +5 -0
- data/spec/dummy/config/initializers/to_unsafe_h.rb.new +5 -0
- data/spec/dummy/config/secrets.yml +2 -2
- data/spec/dummy/db/migrate/20141203214017_core.fe_engine.rb +92 -0
- data/spec/dummy/db/migrate/20141203214018_create_reference_sheets.fe_engine.rb +25 -0
- data/spec/dummy/db/migrate/20141203214019_add_element_and_answer_fields.fe_engine.rb +11 -0
- data/spec/dummy/db/migrate/20141203214020_create_email_templates.fe_engine.rb +18 -0
- data/spec/dummy/db/migrate/20141203214021_add_max_lengths.fe_engine.rb +9 -0
- data/spec/dummy/db/migrate/20141203214022_create_join_table.fe_engine.rb +12 -0
- data/spec/dummy/db/migrate/20141203214023_remove_question_id_from_element.fe_engine.rb +10 -0
- data/spec/dummy/db/migrate/20141203214024_create_fe_people.fe_engine.rb +13 -0
- data/spec/dummy/db/migrate/20141203214025_create_fe_addresses.fe_engine.rb +21 -0
- data/spec/dummy/db/migrate/20141203214027_create_fe_users.fe_engine.rb +13 -0
- data/spec/dummy/db/migrate/20141203214028_add_conditional_type_to_elements.fe_engine.rb +6 -0
- data/spec/dummy/db/migrate/20141203214029_add_conditional_answer_to_elements.fe_engine.rb +6 -0
- data/spec/dummy/db/migrate/20141203214030_remove_short_value_column.fe_engine.rb +6 -0
- data/spec/dummy/db/migrate/20141203214031_move_conditional_ids_used_for_choice_field_to_their_own_column.fe_engine.rb +8 -0
- data/spec/dummy/db/migrate/20150123215803_create_users.rb +9 -0
- data/spec/dummy/db/migrate/20150504222619_add_all_element_ids_to_pages.fe_engine.rb +6 -0
- data/spec/dummy/db/migrate/20150925192557_add_share_to_elements.fe_engine.rb +6 -0
- data/spec/dummy/db/migrate/20150930190001_create_fe_phone_numbers.fe_engine.rb +20 -0
- data/spec/dummy/db/migrate/20150930190002_add_locale_columns.fe_engine.rb +10 -0
- data/spec/dummy/db/migrate/20150930190003_add_locale_to_answer_sheet.fe_engine.rb +6 -0
- data/spec/dummy/db/migrate/20150930190004_change_pages_all_element_ids_to_text.fe_engine.rb +6 -0
- data/spec/dummy/db/migrate/20150930191756_add_locale_to_reference_sheets.fe_engine.rb +6 -0
- data/spec/dummy/db/migrate/20151021190027_add_question_sheet_id_in_refs.fe_engine.rb +13 -0
- data/spec/dummy/db/migrate/20160204164612_switch_conditional_answer_separator_to_semicolon.fe_engine.rb +8 -0
- data/spec/dummy/db/migrate/20160204164613_add_visible_and_visibility_cache_key_to_reference_sheets.fe_engine.rb +7 -0
- data/spec/dummy/db/migrate/20181108201746_create_versions.rb +80 -0
- data/spec/dummy/db/schema.rb +91 -69
- data/spec/dummy/log/test.log +101278 -419
- data/spec/factories/answer_sheet_question_sheets.rb +1 -1
- data/spec/factories/answer_sheets.rb +2 -2
- data/spec/factories/answers.rb +1 -1
- data/spec/factories/applications.rb +3 -4
- data/spec/factories/dummy_applications.rb +6 -0
- data/spec/factories/dummy_people.rb +6 -0
- data/spec/factories/dummy_users.rb +6 -0
- data/spec/factories/elements.rb +35 -10
- data/spec/factories/email_templates.rb +5 -0
- data/spec/factories/fe_addresses.rb +10 -10
- data/spec/factories/fe_email_addresses.rb +3 -3
- data/spec/factories/fe_email_templates.rb +9 -0
- data/spec/factories/fe_people.rb +5 -7
- data/spec/factories/fe_phone_numbers.rb +3 -3
- data/spec/factories/fe_user.rb +6 -0
- data/spec/factories/page.rb +1 -1
- data/spec/factories/page_elements.rb +1 -1
- data/spec/factories/paragraphs.rb +1 -1
- data/spec/factories/question_sheet.rb +3 -3
- data/spec/factories/reference_questions.rb +1 -1
- data/spec/factories/reference_sheets.rb +9 -0
- data/spec/jobs/fe/update_reference_sheet_visibility_job_spec.rb +40 -0
- data/spec/mailers/fe/notifier_spec.rb +39 -0
- data/spec/models/fe/answer_sheet_question_sheet_spec.rb +1 -1
- data/spec/models/fe/answer_spec.rb +2 -2
- data/spec/models/fe/application_spec.rb +94 -1
- data/spec/models/fe/choice_field_spec.rb +66 -0
- data/spec/models/fe/condition_spec.rb +2 -2
- data/spec/models/fe/element_spec.rb +414 -37
- data/spec/models/fe/email_template_spec.rb +1 -1
- data/spec/models/fe/page_element_spec.rb +1 -1
- data/spec/models/fe/page_spec.rb +168 -11
- data/spec/models/fe/person_spec.rb +1 -1
- data/spec/models/fe/question_set_spec.rb +91 -0
- data/spec/models/fe/question_sheet_spec.rb +103 -1
- data/spec/models/fe/question_spec.rb +73 -6
- data/spec/models/fe/reference_question_spec.rb +20 -0
- data/spec/models/fe/reference_sheet_spec.rb +305 -2
- data/spec/models/fe/text_field_spec.rb +22 -0
- data/spec/rails_helper.rb +85 -54
- data/spec/support/choices.xml +6 -0
- metadata +310 -84
- data/app/assets/javascripts/fe/fe.common.js +0 -57
- data/app/assets/javascripts/fe/jquery.scrollTo-min.js +0 -7
- data/app/assets/javascripts/fe/rails.extra.js +0 -6
- data/app/controllers/fe/applications_controller.rb +0 -183
- data/app/controllers/fe/concerns/answer_pages_controller_concern.rb +0 -83
- data/app/controllers/fe/payments_controller.rb +0 -184
- data/app/models/fe/concerns/answer_sheet_concern.rb +0 -55
- data/app/models/fe/payment.rb +0 -77
- data/app/models/fe/payment_question.rb +0 -22
- data/app/views/fe/admin/panels/_prop_payment_question.html.erb +0 -1
- data/app/views/fe/application/_logout.html.erb +0 -1
- data/app/views/fe/payment_pages/_credit.html.erb +0 -47
- data/app/views/fe/payment_pages/_mail.html.erb +0 -27
- data/app/views/fe/payment_pages/_payment.html.erb +0 -6
- data/app/views/fe/payment_pages/_staff.html.erb +0 -25
- data/app/views/fe/payment_pages/_staff_results.html.erb +0 -17
- data/app/views/fe/payment_pages/edit.html.erb +0 -75
- data/app/views/fe/payment_pages/staff_search.js.erb +0 -2
- data/app/views/fe/payments/_credit.html.erb +0 -47
- data/app/views/fe/payments/_errors.html.erb +0 -1
- data/app/views/fe/payments/_payment.html.erb +0 -13
- data/app/views/fe/payments/_staff.html.erb +0 -21
- data/app/views/fe/payments/_staff_results.html.erb +0 -18
- data/app/views/fe/payments/approve.js.erb +0 -3
- data/app/views/fe/payments/create.js.erb +0 -19
- data/app/views/fe/payments/destroy.js.erb +0 -7
- data/app/views/fe/payments/edit.html.erb +0 -56
- data/app/views/fe/payments/error.js.erb +0 -3
- data/app/views/fe/payments/no_access.html.erb +0 -7
- data/app/views/fe/payments/staff_search.js.erb +0 -1
- data/app/views/fe/payments/update.html.erb +0 -24
- data/app/views/fe/questions/fe/_payment_question.html.erb +0 -70
- data/db/migrate/20140828045339_create_payments.rb +0 -13
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/factories/payments.rb +0 -7
- data/spec/models/fe/payment_question_spec.rb +0 -65
|
@@ -1,39 +1,56 @@
|
|
|
1
|
-
<% if element.kind == "Fe::QuestionGrid" -%>
|
|
1
|
+
<% if element.kind == "Fe::QuestionGrid" || element.kind == "Fe::QuestionGridWithTotal"-%>
|
|
2
2
|
<li>
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
3
|
+
<% unless element.hide_label? %>
|
|
4
|
+
<label class="desc"><%= raw element.label %></label>
|
|
5
|
+
<% end %>
|
|
6
|
+
<table class="grid">
|
|
7
|
+
<%- if element.cols -%>
|
|
8
|
+
<tr>
|
|
9
|
+
<%- element.cols.split(";").each do |header| -%>
|
|
10
|
+
<th><%= raw header || " " %></th>
|
|
11
|
+
<%- end -%>
|
|
12
|
+
</tr>
|
|
13
|
+
<%- end -%>
|
|
14
|
+
<tr>
|
|
15
|
+
<%- col_count = 0
|
|
16
|
+
element.elements.each do |grid_element| -%>
|
|
17
|
+
<td id="element_<%= element.id %>">
|
|
18
|
+
<% if %w(Fe::Paragraph).include?(grid_element.kind) -%>
|
|
19
|
+
<%= simple_format grid_element.content %>
|
|
20
|
+
<% else -%>
|
|
21
|
+
<%# el = elements.detect {|el| el.id == grid_element.id } -%>
|
|
22
|
+
<% if grid_element.question? -%>
|
|
23
|
+
<label class="desc"><%= raw grid_element.label %></label>
|
|
24
|
+
<%- if @collating -%>
|
|
25
|
+
<%- for answer_sheet in @collated_answer_sheets[@answer_sheet] -%>
|
|
26
|
+
<div class="answer collate">
|
|
27
|
+
<span class="reviewer_name"><%= answer_sheet.collat_title %>:</span>
|
|
28
|
+
<span class="reviewer_answer"><%= simple_format grid_element.display_response(answer_sheet) %></span>
|
|
29
|
+
</div>
|
|
30
|
+
<%- end -%>
|
|
31
|
+
<%- else -%>
|
|
32
|
+
<span class="answer"><%= simple_format grid_element.display_response(@answer_sheet) %></span>
|
|
33
|
+
<%- end -%>
|
|
34
|
+
<% elsif grid_element.is_a?(Fe::QuestionGrid) || grid_element.is_a?(Fe::QuestionGridWithTotal) %>
|
|
35
|
+
<ul>
|
|
36
|
+
<%= render partial: "fe/answer_sheets/element", object: grid_element %>
|
|
37
|
+
</ul>
|
|
38
|
+
<% else %>
|
|
39
|
+
<%= render partial: "fe/questions/" + element.ptemplate, object: element %>
|
|
40
|
+
<% end %>
|
|
41
|
+
<% end -%>
|
|
42
|
+
</td>
|
|
43
|
+
<%- col_count += 1
|
|
44
|
+
if col_count % element.num_cols == 0 then col_count = 0 -%></tr><tr><%- end -%>
|
|
45
|
+
<%- end -%>
|
|
46
|
+
<%- while col_count < element.num_cols do
|
|
47
|
+
col_count += 1-%>
|
|
48
|
+
<td> </td>
|
|
49
|
+
<%- end unless col_count == 0-%>
|
|
50
|
+
</tr>
|
|
51
|
+
</table>
|
|
35
52
|
</li>
|
|
36
|
-
<%
|
|
53
|
+
<% else %>
|
|
37
54
|
<li>
|
|
38
55
|
<% if element.question? -%>
|
|
39
56
|
<label class="desc"><%= raw element.label %></label>
|
|
@@ -48,7 +65,10 @@
|
|
|
48
65
|
<span class="answer"><%= simple_format element.display_response(@answer_sheet) %></span>
|
|
49
66
|
<%- end -%>
|
|
50
67
|
<% else -%>
|
|
51
|
-
<%= render :
|
|
68
|
+
<%= render partial: "fe/questions/" + element.ptemplate, object: element %>
|
|
52
69
|
<% end -%>
|
|
53
70
|
</li>
|
|
71
|
+
<% element.choice_field_children.each do |choice_field_child| %>
|
|
72
|
+
<%= render "fe/answer_sheets/element", element: choice_field_child %>
|
|
73
|
+
<% end %>
|
|
54
74
|
<% end -%>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div class="submission_errors">
|
|
2
|
-
<p
|
|
2
|
+
<p><%= _("You still need to answer questions on the following pages:") %></p>
|
|
3
3
|
<ul>
|
|
4
4
|
<% @answer_sheet.pages.each do |page| %>
|
|
5
5
|
<% unless page.complete?(@answer_sheet) %>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
<%
|
|
3
|
-
|
|
4
|
-
<%
|
|
5
|
-
|
|
6
|
-
<%=
|
|
7
|
-
|
|
1
|
+
<div class="application_section">
|
|
2
|
+
<% css_class = "" %>
|
|
3
|
+
<% if session[:attempted_submit] && page_link.page.has_questions? %>
|
|
4
|
+
<% css_class = page_link.page.complete?(@answer_sheet) ? "complete" : "incomplete" %>
|
|
5
|
+
<% end %>
|
|
6
|
+
<%= li_page_active_if(@presenter.active_page && page_link.page == @presenter.active_page, id: page_link.dom_id + "-li", class: css_class, style: ("display:none" if page_link.page.hidden?(@answer_sheet))) do %>
|
|
7
|
+
<%= link_to_function(page_link.label(session[:locale]), load_page_js(page_link), id: page_link.dom_id + "-link", "data-page-id" => page_link.dom_id, class: "page_link", href: page_link.load_path) %>
|
|
8
|
+
<% end -%>
|
|
9
|
+
</div>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<div id="panel-pages">
|
|
2
|
-
<h4
|
|
2
|
+
<h4><%= _("Application Sections") %></h4>
|
|
3
3
|
<div id="page_ajax_spinner" style="display:none;">
|
|
4
4
|
<div>
|
|
5
|
-
<%= image_tag
|
|
5
|
+
<%= image_tag "fe/ajax-loader.gif" %> <%= _("Loading...") %>
|
|
6
6
|
</div>
|
|
7
7
|
</div>
|
|
8
8
|
<ul id="list-pages" class="navigation-list">
|
|
9
|
-
<%= render :
|
|
9
|
+
<%= render partial: "fe/answer_sheets/page_link", collection: @presenter.page_links %>
|
|
10
10
|
</ul>
|
|
11
|
-
</div>
|
|
11
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= hidden_field_tag "submit_to", submit_fe_answer_sheet_path(@answer_sheet), id: "submit_to" %>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<h3 id=
|
|
1
|
+
<h3 id="sheet-name"><%= @presenter.sheet_title %></h3>
|
|
@@ -5,62 +5,62 @@
|
|
|
5
5
|
<% else %>
|
|
6
6
|
<div id="controls">
|
|
7
7
|
<div id="panel">
|
|
8
|
-
<%= render :
|
|
8
|
+
<%= render partial: "fe/answer_sheets/pages_list" %>
|
|
9
9
|
</div>
|
|
10
10
|
<div id="legend">
|
|
11
|
-
<%= image_tag(
|
|
12
|
-
<%= image_tag(
|
|
11
|
+
<%= image_tag("fe/icons/question-balloon.png") %> <%= _("Rolling over this symbol gives you help") %><br/>
|
|
12
|
+
<%= image_tag("fe/icons/star-small.png") %> <%= _("Marks a required field") %>
|
|
13
13
|
</div>
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
16
|
<div id="preview">
|
|
17
|
-
<%= render :
|
|
18
|
-
<%= render :
|
|
17
|
+
<%= render partial: "fe/answer_sheets/title" %>
|
|
18
|
+
<%= render partial: "fe/answer_pages/answer_page", locals: { show_first: true } %>
|
|
19
19
|
</div>
|
|
20
20
|
|
|
21
21
|
<script type="text/javascript">
|
|
22
22
|
$(function() {
|
|
23
|
-
page_handler =
|
|
24
|
-
page_handler.initialize(
|
|
25
|
-
// Event.observe(window,
|
|
26
|
-
|
|
27
|
-
// Validation.add(
|
|
23
|
+
page_handler = fe.pageHandler;
|
|
24
|
+
page_handler.initialize("<%= @presenter.active_page_link.try(:dom_id) %>");
|
|
25
|
+
// Event.observe(window, "unload", page_handler.savePage);
|
|
26
|
+
|
|
27
|
+
// Validation.add("validate-phone", "Please enter a valid phone number +1-800-555-1234 x102", {
|
|
28
28
|
// pattern: /((\(\d{3}\)?)|(\d{3}))((\s|-|\.|\/)?)(\d{3})((\s|-|\.|\/)?)(\d{4})\s*([xX]|[eE][xX][tT])?\.?\s*\d*$/
|
|
29
29
|
// });
|
|
30
|
-
// Validation.add(
|
|
30
|
+
// Validation.add("validate-rating", "Please select one of the above options.", function(v,elm) {
|
|
31
31
|
// var p = elm.parentNode.parentNode;
|
|
32
|
-
// var options = p.getElementsByTagName(
|
|
32
|
+
// var options = p.getElementsByTagName("INPUT");
|
|
33
33
|
// return $A(options).any(function(elm) {
|
|
34
34
|
// return $F(elm);
|
|
35
35
|
// });
|
|
36
36
|
// })
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
// global responders for all Ajax requests
|
|
39
39
|
$(function() {
|
|
40
|
-
$(
|
|
41
|
-
$(
|
|
40
|
+
$(document).ajaxStart(function() {
|
|
41
|
+
$("#page_ajax_spinner").show();
|
|
42
|
+
$("#page_ajax_spinner").css({top: $(window).scrollTop() + 200});
|
|
42
43
|
}).ajaxComplete(function() {
|
|
43
|
-
$(
|
|
44
|
+
$("#page_ajax_spinner").hide();
|
|
44
45
|
})
|
|
45
46
|
});
|
|
46
47
|
});
|
|
47
48
|
function updateTotals() {
|
|
48
49
|
// Set up js for all question grids with totals
|
|
49
50
|
<% if @page %>
|
|
50
|
-
<% @page.question_sheet.pages.collect(&:question_grid_with_totals).flatten.each do |question_grid_with_total|
|
|
51
|
-
question_grid_with_total.total_cols.split(
|
|
51
|
+
<% @page.question_sheet.pages.collect(&:question_grid_with_totals).flatten.each do |question_grid_with_total|
|
|
52
|
+
question_grid_with_total.total_cols.split(",").collect(&:to_i).each do |col| -%>
|
|
52
53
|
try {
|
|
53
|
-
updateTotal(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
updateTotal('<%= "#{question_grid_with_total.id}_#{col - 1}" %>')
|
|
57
|
-
});
|
|
54
|
+
updateTotal("<%= "#{question_grid_with_total.id}_#{col - 1}" %>");
|
|
55
|
+
$(".col_<%= "#{question_grid_with_total.id}_#{col - 1}" %>").change(function(e) {
|
|
56
|
+
updateTotal("<%= "#{question_grid_with_total.id}_#{col - 1}" %>");
|
|
58
57
|
});
|
|
59
58
|
} catch(e) {}
|
|
60
59
|
<% end
|
|
61
60
|
end %>
|
|
62
61
|
<% end %>
|
|
63
62
|
}
|
|
63
|
+
$(function() { $(document).trigger("fePageLoaded"); });
|
|
64
64
|
</script>
|
|
65
|
-
<%=
|
|
65
|
+
<%= render "fe/answer_sheets/submit_to" %>
|
|
66
66
|
<% end %>
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
$('#submit_message').
|
|
1
|
+
if ($('#submit_message, .submit_message').length == 0) {
|
|
2
|
+
$("ul#questions_list").filter(":visible").append("<li><div id=\"submit_message\"></div></li>");
|
|
3
|
+
}
|
|
4
|
+
$('#submit_message, .submit_message').html('<%= escape_javascript(render("incomplete")) %>')
|
|
2
5
|
<% @answer_sheet.pages.each do |page| %>
|
|
3
|
-
$
|
|
6
|
+
$page = $('<%= escape_javascript(render("fe/answer_sheets/page_link", page_link: @presenter.new_page_link(@answer_sheet, page))) %>');
|
|
7
|
+
<% id = "##{dom_id(@answer_sheet)}-#{dom_id(page)}-li" %>
|
|
8
|
+
$('<%= id %>').replaceWith($page.find('<%= id %>'));
|
|
4
9
|
<% end %>
|
|
5
|
-
$('#submit_message').show();
|
|
10
|
+
$('#submit_message, .submit_message').show();
|
|
11
|
+
$('#'+fe.pageHandler.current_page+'-li').addClass('active');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<h1>Questionnaires</h1>
|
|
2
2
|
|
|
3
|
-
<% form_tag
|
|
3
|
+
<% form_tag fe_answer_sheets_path do %>
|
|
4
4
|
<%= select_tag("question_sheet_id", options_for_select(@question_sheets)) %>
|
|
5
5
|
<%= submit_tag("Capture") %>
|
|
6
6
|
<% end -%>
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
<table cellspacing="0" class="list">
|
|
9
9
|
<% for answer_sheet in @answer_sheets %>
|
|
10
10
|
<tr>
|
|
11
|
-
<td><%= link_to answer_sheet.question_sheet.label,
|
|
12
|
-
<td><%= link_to
|
|
11
|
+
<td><%= link_to answer_sheet.question_sheet.label, edit_fe_answer_sheet_path(answer_sheet) %></td>
|
|
12
|
+
<td><%= link_to "Review", fe_answer_sheet_path(answer_sheet), method: :get %></td>
|
|
13
13
|
</tr>
|
|
14
14
|
<% end %>
|
|
15
15
|
</table>
|
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
<div id="preview" class="answer-page">
|
|
10
10
|
|
|
11
|
-
<%= render :
|
|
11
|
+
<%= render partial: "fe/answer_sheets/answer_sheet", locals: {answer_sheet: @answer_sheet, elements: @elements } %>
|
|
12
12
|
|
|
13
13
|
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<% if user_signed_in? %><%= link_to(_("Log Out"), destroy_user_session_path, { method: :delete, style: "color: #fff;", id: "link-log-out" }) %><% end %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Implement the applications show view in your app
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
<% css_class =
|
|
2
|
-
checked = acceptance.has_answer?(
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<% css_class = "checkbox " + acceptance.validation_class(@answer_sheet, @page)
|
|
2
|
+
checked = acceptance.has_answer?("1", @answer_sheet)
|
|
3
|
+
locked = acceptance.locked?(params, @answer_sheet, @presenter, current_person)
|
|
4
|
+
%>
|
|
5
|
+
<%= check_box_tag "answers[#{acceptance.id}]", "1",
|
|
5
6
|
checked,
|
|
6
|
-
:
|
|
7
|
-
:
|
|
8
|
-
:
|
|
9
|
-
:
|
|
7
|
+
id: dom_id(acceptance),
|
|
8
|
+
class: css_class,
|
|
9
|
+
disabled: locked,
|
|
10
|
+
readonly: locked %>
|
|
10
11
|
<label class="choice" for="<%= dom_id(acceptance) %>">
|
|
11
|
-
<%= raw acceptance.label %>
|
|
12
|
+
<%= raw acceptance.label(session[:locale]) %>
|
|
12
13
|
</label>
|
|
13
|
-
<%= hidden_field_tag "answers[#{acceptance.id}]",
|
|
14
|
+
<%= hidden_field_tag "answers[#{acceptance.id}]", "", id: "" %>
|
|
@@ -1,14 +1,26 @@
|
|
|
1
|
+
<% element_id = attachment_field.id; base_element = "#element_#{element_id}" %>
|
|
2
|
+
|
|
1
3
|
<% if @presenter %>
|
|
2
|
-
<%
|
|
3
|
-
|
|
4
|
+
<% answer = attachment_field.responses(@answer_sheet).first %>
|
|
5
|
+
<% if @answer_sheet&.frozen? && !@answer_sheet&.reference? %>
|
|
6
|
+
<% if answer %>
|
|
7
|
+
Current File: <%= link_to(answer.attachment.filename, url_for(answer.attachment)) %>
|
|
8
|
+
<%= link_to(image_tag("fe/icons/minus-button.png"),
|
|
9
|
+
delete_file_fe_answer_sheet_page_path(@presenter.active_answer_sheet, @page, question_id: element_id, answer_sheet_type: @answer_sheet.class.name),
|
|
10
|
+
method: :delete, remote: true) %>
|
|
11
|
+
<% end %>
|
|
4
12
|
<% else %>
|
|
13
|
+
<div class="legacy_uploader" style="display: none">
|
|
5
14
|
<div class="uploader">
|
|
6
|
-
<input id="<%= dom_id(attachment_field) %>_file_uploader" name="image_uploader" type="file" />
|
|
7
|
-
|
|
15
|
+
<input <% if Fe.bootstrap %>class="form-control"<% end %> id="<%= dom_id(attachment_field) %>_file_uploader" name="image_uploader" type="file" />
|
|
16
|
+
|
|
8
17
|
<span id="<%= dom_id(attachment_field) %>_filename">
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Current File: <%= link_to(answer.
|
|
18
|
+
<% answer = attachment_field.sheet_answers.where(answer_sheet: @answer_sheet).first # using responses method doesn't work because it filters out value nil, but on attachments value will be nil
|
|
19
|
+
if answer&.attachment&.attached? %>
|
|
20
|
+
Current File: <%= link_to(answer.attachment.filename, url_for(answer.attachment)) %>
|
|
21
|
+
<%= link_to(image_tag('fe/icons/minus-button.png'),
|
|
22
|
+
delete_file_fe_answer_sheet_page_path(@presenter.active_answer_sheet, @page, question_id: element_id, answer_sheet_type: @answer_sheet.class.name),
|
|
23
|
+
method: :delete, remote: true) %>
|
|
12
24
|
<% end %>
|
|
13
25
|
</span>
|
|
14
26
|
</div>
|
|
@@ -17,9 +29,9 @@
|
|
|
17
29
|
<% session_key_name = Rails.application.config.session_options[:key] %>
|
|
18
30
|
$('#<%= dom_id(attachment_field) %>_file_uploader').uploadify({
|
|
19
31
|
uploader : '<%= asset_path "fe/uploadify/uploadify.swf" %>',
|
|
20
|
-
script : '<%= save_file_fe_answer_sheet_page_path(@presenter.active_answer_sheet, @page, :
|
|
32
|
+
script : '<%= save_file_fe_answer_sheet_page_path(@presenter.active_answer_sheet, @page, question_id: element_id, answer_sheet_type: @answer_sheet.class.name) %>',
|
|
21
33
|
fileDesc : 'Pick a file',
|
|
22
|
-
fileExt : '*.*',
|
|
34
|
+
fileExt : '<%= attachment_field.content || "*.*" %>',
|
|
23
35
|
auto : true,
|
|
24
36
|
sizeLimit : <%= 100.megabytes %>,
|
|
25
37
|
width : 350,
|
|
@@ -34,9 +46,120 @@
|
|
|
34
46
|
'_http_accept': 'application/javascript',
|
|
35
47
|
'_method': 'post',
|
|
36
48
|
'<%= session_key_name %>' : encodeURIComponent('<%= u cookies[session_key_name] %>'),
|
|
37
|
-
'authenticity_token': encodeURIComponent('<%= u form_authenticity_token %>')
|
|
49
|
+
'authenticity_token': encodeURIComponent('<%= u form_authenticity_token %>'),
|
|
50
|
+
'answer_sheet_type': answer_sheet_type
|
|
38
51
|
}
|
|
39
52
|
});
|
|
40
53
|
</script>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<div class="new_uploader">
|
|
57
|
+
|
|
58
|
+
<% if answer&.attachment&.attached? %>
|
|
59
|
+
Current File: <%= link_to(answer.attachment.filename, url_for(answer.attachment)) %>
|
|
60
|
+
<%= link_to(image_tag("fe/icons/minus-button.png"),
|
|
61
|
+
delete_file_fe_answer_sheet_page_path(@presenter.active_answer_sheet, @page, question_id: element_id, answer_sheet_type: @answer_sheet.class.name),
|
|
62
|
+
method: :delete, remote: true, class: 'remove_current') %>
|
|
63
|
+
<script>
|
|
64
|
+
$('<%= base_element %> .remove_current').click(function() {
|
|
65
|
+
$.ajax({
|
|
66
|
+
type: 'DELETE',
|
|
67
|
+
url: '<%= delete_file_fe_answer_sheet_page_path(@presenter.active_answer_sheet, @page, question_id: element_id, answer_sheet_type: @answer_sheet.class.name) %>',
|
|
68
|
+
success: function(result) {
|
|
69
|
+
$.get("/fe/answer_sheets/<%= @answer_sheet.id %>/page/<%= @page.id %>/edit?answer_sheet_type=<%= @answer_sheet.class.name %>", function(data) {
|
|
70
|
+
$('<%= base_element %>').replaceWith($(data).find('<%= base_element %>'))
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return false;
|
|
75
|
+
});
|
|
76
|
+
</script>
|
|
77
|
+
<% else %>
|
|
78
|
+
|
|
79
|
+
<style>
|
|
80
|
+
.drop_area.file_hover {
|
|
81
|
+
background:red;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
</style>
|
|
85
|
+
|
|
86
|
+
<input type="file" class="upload_field" <% if attachment_field.content %>accept="<%= attachment_field.content %>"<% end %>/>
|
|
87
|
+
<div class="drop_area" style="margin:20px 0; width:300px; padding:20px; border:1px dashed black;">or drop a file here</div>
|
|
88
|
+
<div class="progress_report">
|
|
89
|
+
<div class="progress_report_name"></div>
|
|
90
|
+
<div class="progress_report_status" style="font-style: italic;"></div>
|
|
91
|
+
<div class="progress_report_bar_container" style="width: 90%; height: 5px;">
|
|
92
|
+
<div class="progress_report_bar" style="background-color: blue; width: 0; height: 100%;"></div>
|
|
93
|
+
</div>
|
|
94
|
+
<br/>
|
|
95
|
+
</div>
|
|
96
|
+
<script type="text/javascript">
|
|
97
|
+
$(function() {
|
|
98
|
+
|
|
99
|
+
var $input = $("<%= base_element %> .upload_field").html5_upload({
|
|
100
|
+
url: function(number) {
|
|
101
|
+
return "<%= save_file_fe_answer_sheet_page_path(@presenter.active_answer_sheet, @page, question_id: element_id, answer_sheet_type: @answer_sheet.class.name) %>";
|
|
102
|
+
},
|
|
103
|
+
sendBoundary: window.FormData || $.browser.mozilla,
|
|
104
|
+
onStart: function(event, total) {
|
|
105
|
+
return true;
|
|
106
|
+
return confirm("You are trying to upload " + total + " files. Are you sure?");
|
|
107
|
+
},
|
|
108
|
+
onProgress: function(event, progress, name, number, total) {
|
|
109
|
+
console.log(progress, number);
|
|
110
|
+
},
|
|
111
|
+
setName: function(text) {
|
|
112
|
+
$("#element_<%= attachment_field.id %> .progress_report_name").text(text);
|
|
113
|
+
},
|
|
114
|
+
setStatus: function(text) {
|
|
115
|
+
if (!$("<%= base_element %> .upload_field").data('error', true)) {
|
|
116
|
+
$("<%= base_element %> .progress_report_status").text(text);
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
setProgress: function(val) {
|
|
120
|
+
$("<%= base_element %> .progress_report_bar").css('width', Math.ceil(val*100)+"%");
|
|
121
|
+
},
|
|
122
|
+
onFinishOne: function(event, response, name, number, total) {
|
|
123
|
+
// Re-render the attachment file to show the current file; use the page view, which is not the
|
|
124
|
+
// most efficient way, but lets us avoid making an action just for this. And the amount of data
|
|
125
|
+
// on a page is not that much
|
|
126
|
+
$.get("/fe/answer_sheets/<%= @answer_sheet.id %>/page/<%= @page.id %>/edit?answer_sheet_type=<%= @answer_sheet.class.name %>", function(data) {
|
|
127
|
+
$('<%= base_element %>').replaceWith($(data).find('<%= base_element %>'))
|
|
128
|
+
});
|
|
129
|
+
},
|
|
130
|
+
onError: function(event, name, error) {
|
|
131
|
+
$("<%= base_element %> .upload_field").data('error', true)
|
|
132
|
+
$('<%= base_element %> .progress_report_status').text('Error while uploading file ' + name)
|
|
133
|
+
}, onBrowserIncompatible: function() {
|
|
134
|
+
$("<%= base_element %> .legacy_uploader").show();
|
|
135
|
+
$("<%= base_element %> .new_uploader").hide();
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// this is absolutely necessary -- see http://weblog.bocoup.com/using-datatransfer-with-jquery-events/
|
|
140
|
+
if ($.fn.jquery.substring(0, 2) == "3.") {
|
|
141
|
+
$.event.addProp('dataTransfer');
|
|
142
|
+
} else {
|
|
143
|
+
$.event.props.push('dataTransfer');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
var $drop = $('<%= base_element %> .drop_area');
|
|
147
|
+
$drop.on('dragover dragenter', function(e) {
|
|
148
|
+
$drop.addClass('file_hover');
|
|
149
|
+
return false;
|
|
150
|
+
}).on('dragleave dragexit', function(e) {
|
|
151
|
+
$drop.removeClass('file_hover');
|
|
152
|
+
return false;
|
|
153
|
+
}).on( 'drop', function(e) {
|
|
154
|
+
if(e.originalEvent.dataTransfer && e.originalEvent.dataTransfer.files.length) {
|
|
155
|
+
$input.trigger('html5_upload.startFromDrop', e );
|
|
156
|
+
}
|
|
157
|
+
return false;
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
});
|
|
161
|
+
</script>
|
|
162
|
+
</div>
|
|
163
|
+
<% end %>
|
|
41
164
|
<% end %>
|
|
42
165
|
<% end %>
|
|
@@ -1,48 +1,52 @@
|
|
|
1
|
-
<% if checkbox_field.hide_option_labels? && ![
|
|
1
|
+
<% if checkbox_field.hide_option_labels? && !["question_pages", "question_sheets", "elements"].include?(controller.controller_name) %>
|
|
2
2
|
<tr id="<%= dom_id(checkbox_field) %>">
|
|
3
3
|
<td>
|
|
4
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 -%>
|
|
5
|
+
<%= raw checkbox_field.label(session[:locale]) %>
|
|
6
|
+
<% if checkbox_field.required?(@answer_sheet, @page) -%><span class="required">required</span><% end -%>
|
|
7
7
|
<%= tip(checkbox_field.tooltip) if checkbox_field.tooltip.present? %>
|
|
8
8
|
</label>
|
|
9
9
|
</td>
|
|
10
|
-
<% checkbox_field.choices
|
|
10
|
+
<% choices = checkbox_field.choices(session[:locale]) %>
|
|
11
|
+
<% choices.each_with_index do |choice, num| -%>
|
|
11
12
|
<td>
|
|
12
|
-
<% css_class =
|
|
13
|
-
<% dom_id = dom_id(checkbox_field) + "_" + pretty_tag(choice[1])
|
|
14
|
-
last_choice = (num ==
|
|
15
|
-
css_class += checkbox_field.validation_class(@answer_sheet) if last_choice
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
<% css_class = checkbox_field.css_class.to_s + " checkbox " -%>
|
|
14
|
+
<% dom_id = dom_id(checkbox_field) + "_" + pretty_tag(choice[1])
|
|
15
|
+
last_choice = (num == choices.length - 1)
|
|
16
|
+
css_class += checkbox_field.validation_class(@answer_sheet, @page) if last_choice
|
|
17
|
+
locked = checkbox_field.locked?(params, @answer_sheet, @presenter, current_person)
|
|
18
|
+
%>
|
|
19
|
+
<%= hidden_field_tag "answers[#{checkbox_field.id}][#{num}]", "", id: "" %>
|
|
18
20
|
<div class="field field_check">
|
|
19
21
|
<%= check_box_tag "answers[#{checkbox_field.id}][#{num}]", choice[1],
|
|
20
|
-
checkbox_field.has_answer?(choice[1], @answer_sheet),
|
|
21
|
-
:
|
|
22
|
-
:
|
|
23
|
-
:
|
|
24
|
-
:
|
|
22
|
+
checkbox_field.has_answer?(choice[1], @answer_sheet),
|
|
23
|
+
id: dom_id,
|
|
24
|
+
class: css_class,
|
|
25
|
+
disabled: locked,
|
|
26
|
+
readonly: locked %>
|
|
25
27
|
</div>
|
|
26
28
|
</td>
|
|
27
29
|
<% end -%>
|
|
28
30
|
</tr>
|
|
29
31
|
<% else %>
|
|
30
32
|
<div id="<%= dom_id(checkbox_field) %>">
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<%
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
:
|
|
44
|
-
:
|
|
45
|
-
|
|
33
|
+
<% css_class = checkbox_field.css_class.to_s + " checkbox " -%>
|
|
34
|
+
<% choices = checkbox_field.choices(session[:locale]) %>
|
|
35
|
+
<% choices.each_with_index do |choice, num| -%>
|
|
36
|
+
<% dom_id = dom_id(checkbox_field) + "_" + pretty_tag(choice[1])
|
|
37
|
+
last_choice = (num == choices.length - 1)
|
|
38
|
+
css_class += checkbox_field.validation_class(@answer_sheet, @page) if last_choice
|
|
39
|
+
locked = checkbox_field.locked?(params, @answer_sheet, @presenter, current_person)
|
|
40
|
+
%>
|
|
41
|
+
<%= hidden_field_tag "answers[#{checkbox_field.id}][#{num}]", "", id: "" %>
|
|
42
|
+
<div class="field field_check">
|
|
43
|
+
<%= check_box_tag "answers[#{checkbox_field.id}][#{num}]", choice[1],
|
|
44
|
+
checkbox_field.has_answer?(choice[1], @answer_sheet),
|
|
45
|
+
id: dom_id,
|
|
46
|
+
class: css_class,
|
|
47
|
+
disabled: locked,
|
|
48
|
+
readonly: locked %>
|
|
49
|
+
<label class="choice" for="<%= dom_id %>"><%= choice[0] %></label>
|
|
46
50
|
</div>
|
|
47
51
|
<% end -%>
|
|
48
52
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<% locked = country.locked?(params, @answer_sheet, @presenter) %>
|
|
1
|
+
<% locked = country.locked?(params, @answer_sheet, @presenter, current_person) %>
|
|
2
2
|
<%= select_tag "answers[#{country.id}]",
|
|
3
|
-
options_for_select([
|
|
4
|
-
:
|
|
5
|
-
:
|
|
6
|
-
:
|
|
7
|
-
:
|
|
3
|
+
options_for_select([""] + Carmen.countries, country.response(@answer_sheet).to_s),
|
|
4
|
+
class: "#{"form-control" if Fe.bootstrap} select " + country.validation_class(@answer_sheet, @page),
|
|
5
|
+
id: dom_id(country),
|
|
6
|
+
disabled: locked,
|
|
7
|
+
readonly: locked %>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
<% locked = date_field.locked?(params, @answer_sheet, @presenter, current_person) %>
|
|
1
2
|
<%= calendar_date_select_tag "answers[#{date_field.id}]", date_field.format_date_response(@answer_sheet),
|
|
2
|
-
:
|
|
3
|
-
:
|
|
4
|
-
:
|
|
5
|
-
:
|
|
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>
|
|
3
|
+
class: "#{"form-control" if Fe.bootstrap} text " + date_field.validation_class(@answer_sheet, @page),
|
|
4
|
+
id: dom_id(date_field),
|
|
5
|
+
disabled: locked,
|
|
6
|
+
readonly: true %>
|
|
7
7
|
<div id="advice-required-<%= dom_id(date_field) %>" class="validation-advice" style="display: none;">This is a required field.</div>
|