fe 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +4 -4
- 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 -1
- data/app/assets/javascripts/fe/fe.admin.js +2 -6
- data/app/assets/javascripts/fe/{fe.common.js → fe.common.js.erb} +14 -7
- data/app/assets/javascripts/fe/fe.public.js +1 -2
- data/app/assets/javascripts/fe/{fe.public.nojquery.js → fe.public.nojquery.js.erb} +152 -76
- data/app/assets/javascripts/fe/jquery.html5_upload.js +258 -0
- data/app/assets/stylesheets/fe/fe.screen.css.scss.erb +22 -1
- data/app/assets/stylesheets/fe/validation.css +5 -1
- data/app/controllers/{fe/concerns → concerns/fe}/admin/question_sheets_controller_concern.rb +15 -16
- data/app/controllers/concerns/fe/answer_pages_controller_concern.rb +131 -0
- data/app/controllers/{fe/concerns → concerns/fe}/answer_sheets_controller_concern.rb +14 -6
- data/app/controllers/{fe/concerns → concerns/fe}/application_controller_concern.rb +3 -3
- data/app/controllers/fe/admin/elements_controller.rb +46 -24
- data/app/controllers/fe/admin/email_templates_controller.rb +5 -5
- data/app/controllers/fe/admin/question_pages_controller.rb +8 -8
- data/app/controllers/fe/reference_pages_controller.rb +11 -11
- data/app/controllers/fe/reference_sheets_controller.rb +4 -4
- data/app/controllers/fe/references_controller.rb +19 -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 +3 -3
- data/app/jobs/fe/update_reference_sheet_visibility_job.rb +11 -0
- data/app/mailers/fe/notifier.rb +4 -4
- data/app/models/answer_sheet.rb +1 -1
- 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 +6 -5
- data/app/models/concerns/fe/answer_sheet_concern.rb +125 -0
- data/app/models/{fe/concerns → concerns/fe}/choice_field_concern.rb +41 -23
- 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 +14 -10
- data/app/models/fe/condition.rb +4 -4
- data/app/models/fe/date_field.rb +1 -1
- data/app/models/fe/element.rb +126 -44
- data/app/models/fe/email_address.rb +2 -2
- data/app/models/fe/email_template.rb +1 -1
- data/app/models/fe/page.rb +94 -19
- data/app/models/fe/page_element.rb +2 -2
- data/app/models/fe/paragraph.rb +1 -1
- data/app/models/fe/person.rb +5 -5
- data/app/models/fe/phone_number.rb +1 -1
- data/app/models/fe/question.rb +62 -38
- data/app/models/fe/question_grid.rb +15 -3
- data/app/models/fe/question_set.rb +53 -13
- data/app/models/fe/question_sheet.rb +49 -16
- data/app/models/fe/reference_question.rb +9 -3
- data/app/models/fe/reference_sheet.rb +102 -47
- 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 +6 -6
- data/app/views/fe/admin/elements/create.js.erb +3 -3
- data/app/views/fe/admin/elements/destroy.js.erb +1 -1
- data/app/views/fe/admin/elements/drop.js.erb +1 -1
- data/app/views/fe/admin/elements/duplicate.js.erb +1 -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 +8 -8
- 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 +2 -17
- 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 +1 -1
- 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 +36 -17
- data/app/views/fe/admin/panels/_prop_date_field.html.erb +1 -1
- data/app/views/fe/admin/panels/_prop_element.html.erb +5 -5
- data/app/views/fe/admin/panels/_prop_page.html.erb +3 -3
- data/app/views/fe/admin/panels/_prop_paragraph.html.erb +8 -8
- 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 +1 -1
- data/app/views/fe/admin/panels/_prop_sheet.html.erb +3 -3
- data/app/views/fe/admin/panels/_prop_text_field.html.erb +12 -12
- data/app/views/fe/admin/question_pages/_element.html.erb +7 -7
- 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 +13 -14
- data/app/views/fe/answer_pages/_element.html.erb +22 -2
- data/app/views/fe/answer_pages/_page_name.html.erb +1 -1
- data/app/views/fe/answer_pages/show.html.erb +39 -0
- data/app/views/fe/answer_pages/update.js.erb +10 -2
- data/app/views/fe/answer_sheets/_answer_sheet.html.erb +4 -4
- data/app/views/fe/answer_sheets/_element.html.erb +9 -7
- 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 +3 -3
- data/app/views/fe/answer_sheets/_submit_to.html.erb +1 -1
- data/app/views/fe/answer_sheets/_title.html.erb +1 -1
- data/app/views/fe/answer_sheets/edit.html.erb +18 -18
- data/app/views/fe/answer_sheets/incomplete.js.erb +7 -4
- data/app/views/fe/answer_sheets/index.html.erb +1 -1
- data/app/views/fe/answer_sheets/show.html.erb +1 -1
- data/app/views/fe/applications/_logout.html.erb +1 -1
- data/app/views/fe/questions/fe/_acceptance.html.erb +10 -9
- data/app/views/fe/questions/fe/_attachment_field.html.erb +129 -10
- data/app/views/fe/questions/fe/_checkbox_field.html.erb +18 -16
- data/app/views/fe/questions/fe/_country.html.erb +6 -6
- data/app/views/fe/questions/fe/_date_field.html.erb +5 -4
- data/app/views/fe/questions/fe/_date_field_mmyy.html.erb +8 -8
- data/app/views/fe/questions/fe/_drop_down_field.html.erb +5 -5
- data/app/views/fe/questions/fe/_question_grid.html.erb +10 -10
- data/app/views/fe/questions/fe/_question_grid_with_total.html.erb +8 -8
- data/app/views/fe/questions/fe/_questions.html.erb +11 -5
- data/app/views/fe/questions/fe/_radio_button_field.html.erb +35 -19
- data/app/views/fe/questions/fe/_rating.html.erb +56 -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 +40 -24
- 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/_state_chooser.html.erb +6 -6
- data/app/views/fe/questions/fe/_text_area_field.html.erb +14 -10
- 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 +11 -8
- data/app/views/fe/reference_pages/_reference.html.erb +12 -12
- data/app/views/fe/reference_pages/edit.html.erb +4 -4
- data/app/views/fe/reference_sheets/done.html.erb +2 -2
- data/app/views/fe/reference_sheets/not_found.html.erb +3 -3
- data/app/views/fe/references/edit.html.erb +5 -5
- data/app/views/fe/references/show.html.erb +3 -3
- 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 +9 -9
- 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 +1 -1
- data/app/views/layouts/fe/application.html.erb +3 -4
- 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/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 -1
- data/db/migrate/20131003041856_core.rb +23 -23
- data/db/migrate/20131003044250_create_reference_sheets.rb +1 -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 +1 -1
- data/db/migrate/20140624180246_create_fe_addresses.rb +1 -1
- data/db/migrate/20140624182216_create_fe_phone_numbers.rb +1 -1
- data/db/migrate/20140625160545_create_fe_users.rb +1 -1
- 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 +1 -1
- data/db/migrate/20150713022326_add_locale_columns.rb +1 -1
- data/db/migrate/20150714220730_add_locale_to_answer_sheet.rb +1 -1
- data/db/migrate/20150925181652_add_share_to_elements.rb +5 -0
- data/db/migrate/20150928085325_change_pages_all_element_ids_to_text.rb +1 -1
- data/db/migrate/20150930191538_add_locale_to_reference_sheets.rb +1 -1
- 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/fe/engine.rb +10 -10
- data/lib/fe/version.rb +1 -1
- data/lib/fe.rb +7 -1
- data/spec/controllers/fe/admin/elements_controller_spec.rb +30 -20
- data/spec/controllers/fe/admin/email_templates_controller_spec.rb +2 -2
- data/spec/controllers/fe/admin/question_pages_controller_spec.rb +1 -1
- data/spec/controllers/fe/admin/question_sheets_controller_spec.rb +4 -4
- data/spec/controllers/fe/answer_pages_controller_spec.rb +86 -30
- data/spec/controllers/fe/answer_sheets_controller_spec.rb +65 -9
- data/spec/dummy/app/assets/config/manifest.js +0 -0
- data/spec/dummy/app/models/user.rb +1 -1
- data/spec/dummy/app/views/layouts/application.html.erb +2 -2
- data/spec/dummy/config/application.rb +1 -0
- data/spec/dummy/config/environments/test.rb +3 -3
- data/spec/dummy/config/initializers/assets.rb +5 -2
- data/spec/dummy/config/initializers/fast_gettext.rb +1 -1
- 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/db/migrate/20141203214017_core.fe_engine.rb +23 -23
- data/spec/dummy/db/migrate/20141203214018_create_reference_sheets.fe_engine.rb +1 -1
- data/spec/dummy/db/migrate/20141203214019_add_element_and_answer_fields.fe_engine.rb +3 -3
- data/spec/dummy/db/migrate/20141203214020_create_email_templates.fe_engine.rb +2 -2
- data/spec/dummy/db/migrate/20141203214021_add_max_lengths.fe_engine.rb +1 -1
- data/spec/dummy/db/migrate/20141203214022_create_join_table.fe_engine.rb +1 -1
- data/spec/dummy/db/migrate/20141203214023_remove_question_id_from_element.fe_engine.rb +1 -1
- data/spec/dummy/db/migrate/20141203214024_create_fe_people.fe_engine.rb +1 -1
- data/spec/dummy/db/migrate/20141203214025_create_fe_addresses.fe_engine.rb +1 -1
- data/spec/dummy/db/migrate/20141203214027_create_fe_users.fe_engine.rb +1 -1
- data/spec/dummy/db/migrate/20141203214028_add_conditional_type_to_elements.fe_engine.rb +1 -1
- data/spec/dummy/db/migrate/20141203214029_add_conditional_answer_to_elements.fe_engine.rb +1 -1
- data/spec/dummy/db/migrate/20141203214030_remove_short_value_column.fe_engine.rb +1 -1
- data/spec/dummy/db/migrate/20141203214031_move_conditional_ids_used_for_choice_field_to_their_own_column.fe_engine.rb +1 -1
- data/spec/dummy/db/migrate/20150123215803_create_users.rb +1 -1
- data/spec/dummy/db/migrate/20150504222619_add_all_element_ids_to_pages.fe_engine.rb +1 -1
- 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 +1 -1
- data/spec/dummy/db/migrate/20150930190002_add_locale_columns.fe_engine.rb +1 -1
- data/spec/dummy/db/migrate/20150930190003_add_locale_to_answer_sheet.fe_engine.rb +1 -1
- data/spec/dummy/db/migrate/20150930190004_change_pages_all_element_ids_to_text.fe_engine.rb +1 -1
- data/spec/dummy/db/migrate/20150930191756_add_locale_to_reference_sheets.fe_engine.rb +1 -1
- 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 +71 -79
- 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 -3
- data/spec/factories/dummy_applications.rb +3 -3
- data/spec/factories/dummy_people.rb +3 -3
- data/spec/factories/dummy_users.rb +3 -3
- data/spec/factories/elements.rb +21 -21
- data/spec/factories/email_templates.rb +3 -3
- data/spec/factories/fe_addresses.rb +10 -10
- data/spec/factories/fe_email_addresses.rb +3 -3
- data/spec/factories/fe_email_templates.rb +4 -4
- data/spec/factories/fe_people.rb +5 -5
- data/spec/factories/fe_phone_numbers.rb +3 -3
- data/spec/factories/fe_user.rb +3 -3
- 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 +2 -2
- data/spec/factories/reference_questions.rb +1 -1
- data/spec/factories/reference_sheets.rb +1 -1
- data/spec/jobs/fe/update_reference_sheet_visibility_job_spec.rb +40 -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 +47 -1
- data/spec/models/fe/condition_spec.rb +2 -2
- data/spec/models/fe/element_spec.rb +252 -60
- 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 +57 -12
- 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 +11 -15
- 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 +287 -4
- data/spec/models/fe/text_field_spec.rb +22 -0
- data/spec/rails_helper.rb +79 -76
- metadata +195 -57
- data/app/assets/javascripts/fe/jquery.scrollTo-min.js +0 -7
- data/app/controllers/fe/concerns/answer_pages_controller_concern.rb +0 -84
- data/app/models/fe/concerns/answer_sheet_concern.rb +0 -85
- data/spec/dummy/db/migrate/20141203214026_create_create_fe_phone_numbers.fe_engine.rb +0 -17
- data/spec/dummy/log/development.log +0 -5
- /data/app/{assets/stylesheets/360front.css → views.current/fe/admin/elements/reorder.js.erb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ceba5cafab0cf4095c3db104e3a8ace2d7ff8630b2bd725ebb8c719f4a172136
|
4
|
+
data.tar.gz: 476961619c8eeda0570e596345f4383c2a21a22d54a819459969bf170c83c9a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 345b88e2ab3d74555c19adbf7256c1aa6f40bcfe76e9b99b64a02467e9633dbaceac84956193207336ed7cfce71cd67eeb3fb0f544be35841d2c221af3d49a62
|
7
|
+
data.tar.gz: 68e3f1a303ae918bdb3a82b4825f4231cab11a514e4db48b6c3b747485ba943fbcbee26ceb25bfe7771f5ce696fea50854b9b0f3b1c4101598ceb7d89dfc5906
|
data/README.md
CHANGED
@@ -8,17 +8,17 @@ This project rocks and uses MIT-LICENSE.
|
|
8
8
|
|
9
9
|
### Testing
|
10
10
|
|
11
|
-
Setup
|
11
|
+
Setup the testing db
|
12
12
|
|
13
|
-
rake
|
13
|
+
bundle exec rake setup_db
|
14
14
|
|
15
15
|
Run specs:
|
16
16
|
|
17
|
-
rake spec
|
17
|
+
bundle exec rake spec
|
18
18
|
|
19
19
|
Run a specific spec:
|
20
20
|
|
21
|
-
|
21
|
+
bundle exec rspec spec/models/fe/element_spec.rb
|
22
22
|
|
23
23
|
### Example enclosing app
|
24
24
|
|
@@ -1 +1 @@
|
|
1
|
-
//= require fe.public.js
|
1
|
+
//= require fe/fe.public.js
|
@@ -118,18 +118,14 @@ function snapElementProperties(el) {
|
|
118
118
|
$('#panel-properties-element').css({'margin-top': propsTop});
|
119
119
|
}
|
120
120
|
|
121
|
-
function scrollToElement(id) {
|
122
|
-
$(id).scrollTo();
|
123
|
-
}
|
124
|
-
|
125
121
|
function addError(id) {
|
126
122
|
$('#' + id).addClassName('fieldWithErrors');
|
127
123
|
}
|
128
124
|
|
129
125
|
// convert label to slug
|
130
126
|
function updateSlug(source, dest) {
|
131
|
-
label = $
|
132
|
-
slug = $
|
127
|
+
label = $(source).val();
|
128
|
+
slug = $(dest).val();
|
133
129
|
if( label == null || slug == null) return; // oh oh
|
134
130
|
|
135
131
|
label = label.strip();
|
@@ -57,12 +57,12 @@ function setUpSortables() {
|
|
57
57
|
}
|
58
58
|
|
59
59
|
function setUpCalendars() {
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
now = new Date();
|
61
|
+
year = now.getFullYear() + 10;
|
62
|
+
$('[data-calendar]').datepicker({
|
63
63
|
changeYear:true,
|
64
|
-
|
65
|
-
dateFormat: '
|
64
|
+
yearRange: '1950:' + year,
|
65
|
+
dateFormat: '<%= Fe.date_format %>'
|
66
66
|
})
|
67
67
|
}
|
68
68
|
|
@@ -75,8 +75,8 @@ function setUpJsHelpers() {
|
|
75
75
|
// ==================
|
76
76
|
// Calendar
|
77
77
|
setUpCalendars();
|
78
|
-
|
79
|
-
|
78
|
+
// ==================
|
79
|
+
<% unless Fe.bootstrap %>$(".tip[title], a[title]").tooltip()<% end %>
|
80
80
|
}
|
81
81
|
|
82
82
|
function fixGridColumnWidths() {
|
@@ -89,3 +89,10 @@ function fixGridColumnWidths() {
|
|
89
89
|
}
|
90
90
|
});
|
91
91
|
};
|
92
|
+
|
93
|
+
function scrollTo(el) {
|
94
|
+
if ($(el).length == 0) { return; }
|
95
|
+
$('html, body').animate({
|
96
|
+
scrollTop: $(el).offset().top
|
97
|
+
}, 1000);
|
98
|
+
}
|
@@ -3,47 +3,66 @@
|
|
3
3
|
// used by answer sheets
|
4
4
|
|
5
5
|
(function($) {
|
6
|
-
|
7
|
-
|
6
|
+
<% if Fe.bootstrap %>
|
7
|
+
// http://stackoverflow.com/questions/18754020/bootstrap-3-with-jquery-validation-plugin
|
8
|
+
$.validator.setDefaults({
|
9
|
+
errorElement: "span",
|
10
|
+
errorClass: "help-block",
|
11
|
+
highlight: function (element, errorClass, validClass) {
|
12
|
+
$(element).closest('.form-group').addClass('has-error');
|
13
|
+
},
|
14
|
+
unhighlight: function (element, errorClass, validClass) {
|
15
|
+
$(element).closest('.form-group').removeClass('has-error');
|
16
|
+
},
|
17
|
+
errorPlacement: function (error, element) {
|
18
|
+
if (element.parent('.input-group').length || element.prop('type') === 'checkbox' || element.prop('type') === 'radio') {
|
19
|
+
error.appendTo(element.closest('div:not(.field'));
|
20
|
+
} else {
|
21
|
+
error.insertAfter(element);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
});
|
25
|
+
<% end %>
|
8
26
|
|
9
|
-
|
10
|
-
|
11
|
-
|
27
|
+
$(document).on('click', '.save_button', function() {
|
28
|
+
fe.pageHandler.savePage($(this).closest('.answer-page'), true);
|
29
|
+
});
|
12
30
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
return false;
|
30
|
-
});
|
31
|
-
$(document).on('focus', 'textarea[maxlength]', function() {
|
32
|
-
var max = parseInt($(this).attr('maxlength'));
|
33
|
-
$(this).parent().find('.charsRemaining').html('You have ' + (max - $(this).val().length) + ' characters remaining');
|
34
|
-
}).on('keyup', 'textarea[maxlength]', function(){
|
35
|
-
var max = parseInt($(this).attr('maxlength'));
|
36
|
-
if($(this).val().length > max){
|
37
|
-
$(this).val($(this).val().substr(0, $(this).attr('maxlength')));
|
38
|
-
}
|
39
|
-
$(this).parent().find('.charsRemaining').html('You have ' + (max - $(this).val().length) + ' characters remaining');
|
40
|
-
}).on('blur', 'textarea[maxlength]', function() {
|
41
|
-
$(this).parent().find('.charsRemaining').html('');
|
31
|
+
$(document).on('click', '.reference_send_invite', function() {
|
32
|
+
var el = this;
|
33
|
+
var form_elements = $(el).closest('form').find('input:not(.dont_submit), textarea:not(.dont_submit), select:not(.dont_submit)');
|
34
|
+
var data = form_elements.serializeArray();
|
35
|
+
|
36
|
+
data.push({name: 'answer_sheet_type', value: answer_sheet_type});
|
37
|
+
$.ajax({url: $(el).attr('href'), data: data, dataType: 'script', type: 'POST',
|
38
|
+
beforeSend: function (xhr) {
|
39
|
+
$('body').trigger('ajax:loading', xhr);
|
40
|
+
},
|
41
|
+
complete: function (xhr) {
|
42
|
+
$('body').trigger('ajax:complete', xhr);
|
43
|
+
},
|
44
|
+
error: function (xhr, status, error) {
|
45
|
+
$('body').trigger('ajax:failure', [xhr, status, error]);
|
46
|
+
}
|
42
47
|
});
|
48
|
+
return false;
|
49
|
+
});
|
50
|
+
$(document).on('focus', 'textarea[maxlength]', function() {
|
51
|
+
var max = parseInt($(this).attr('maxlength'));
|
52
|
+
$(this).parent().find('.charsRemaining').html('You have ' + (max - $(this).val().length) + ' characters remaining');
|
53
|
+
}).on('keyup', 'textarea[maxlength]', function(){
|
54
|
+
var max = parseInt($(this).attr('maxlength'));
|
55
|
+
if($(this).val().length > max){
|
56
|
+
$(this).val($(this).val().substr(0, $(this).attr('maxlength')));
|
57
|
+
}
|
58
|
+
$(this).parent().find('.charsRemaining').html('You have ' + (max - $(this).val().length) + ' characters remaining');
|
59
|
+
}).on('blur', 'textarea[maxlength]', function() {
|
60
|
+
$(this).parent().find('.charsRemaining').html('');
|
43
61
|
});
|
44
62
|
|
45
|
-
|
46
|
-
|
63
|
+
window.fe = {};
|
64
|
+
fe.pageHandler = {
|
65
|
+
|
47
66
|
initialize : function(page) {
|
48
67
|
this.auto_save_frequency = 30; // seconds
|
49
68
|
this.timer_id = null;
|
@@ -69,8 +88,8 @@
|
|
69
88
|
|
70
89
|
// HACK: Need to clear the main error message when returning to the submit page
|
71
90
|
// It is very confusing to users to be there when they revisit the page
|
72
|
-
|
73
|
-
|
91
|
+
$('#submit_message, .submit_message').hide();
|
92
|
+
$('#application_errors, .application_errors').html('');
|
74
93
|
|
75
94
|
// show the new
|
76
95
|
// $('#' + page + '-li').removeClass('incomplete');
|
@@ -86,7 +105,7 @@
|
|
86
105
|
// callback onSuccess
|
87
106
|
pageLoadedBackground : function(response, textStatus, jqXHR) {
|
88
107
|
//this.pageLoaded(response, textStatus, jqXHR, true)
|
89
|
-
|
108
|
+
fe.pageHandler.pageLoaded(response, textStatus, jqXHR, true)
|
90
109
|
},
|
91
110
|
|
92
111
|
// callback onSuccess
|
@@ -98,17 +117,20 @@
|
|
98
117
|
if( match != null )
|
99
118
|
{
|
100
119
|
var page = match[1];
|
101
|
-
if (
|
120
|
+
if (response.match(/<html/)) {
|
121
|
+
alert("There was a problem loading that page. To work on other pages, please refresh the website.");
|
122
|
+
document.location = document.location;
|
123
|
+
} else if ($('#'+page).length > 0) {
|
102
124
|
$('#'+page).replaceWith(response);
|
103
125
|
} else {
|
104
126
|
$('#preview').append(response);
|
105
127
|
}
|
106
128
|
|
107
|
-
if (!background_load) {
|
129
|
+
if (!background_load) { fe.pageHandler.showPage(page); } // show after load, unless loading in background
|
108
130
|
setUpJsHelpers();
|
109
|
-
|
110
|
-
if (background_load) {
|
111
|
-
$('#' + page).data('form_data',
|
131
|
+
fe.pageHandler.enableValidation(page);
|
132
|
+
if (background_load) { fe.pageHandler.validatePage(page, true); }
|
133
|
+
$('#' + page).data('form_data', fe.pageHandler.captureForm($('#' + page)));
|
112
134
|
}
|
113
135
|
$('#page_ajax_spinner').hide();
|
114
136
|
$('.reference_send_invite').button();
|
@@ -116,33 +138,51 @@
|
|
116
138
|
$(document).trigger('fePageLoaded'); // allow other code to handle page load event by using $(document).on('fePageLoaded', function() { ... });
|
117
139
|
},
|
118
140
|
|
119
|
-
loadPage : function(page, url, background_load) {
|
141
|
+
loadPage : function(page, url, background_load, validate_current_page) {
|
120
142
|
background_load = typeof background_load !== 'undefined' ? background_load : false;
|
143
|
+
validate_current_page = typeof validate_current_page !== 'undefined' ? validate_current_page : true;
|
144
|
+
|
145
|
+
if (validate_current_page) {
|
146
|
+
isValid = this.validatePage(this.current_page); // mark current page as valid (or not) as we're leaving
|
147
|
+
} else {
|
148
|
+
isValid = true
|
149
|
+
}
|
150
|
+
|
151
|
+
// Provide a way for enclosing apps to not go to the next page until the current page is valid
|
152
|
+
// They can do that with this:
|
153
|
+
//
|
154
|
+
// $(document).on 'fePageLoaded', (evt, page) ->
|
155
|
+
// $(".page > form").addClass('enforce-valid-before-next');
|
156
|
+
//
|
157
|
+
if (!isValid && $('#' + this.current_page + "-form").hasClass('enforce-valid-before-next')) {
|
158
|
+
// scroll up to where the error is
|
159
|
+
scrollTo($(".help-block:visible")[0].closest("li"));
|
160
|
+
return;
|
161
|
+
}
|
121
162
|
|
122
163
|
this.unregisterAutoSave(); // don't auto-save while loading/saving
|
123
164
|
// will register auto-save on new page once loaded/shown
|
124
165
|
|
125
|
-
this.validatePage(this.current_page); // mark current page as valid (or not) as we're leaving
|
126
166
|
this.savePage();
|
127
167
|
|
128
168
|
if (!background_load) {
|
129
169
|
if ($('a[name="main"]').length == 1) {
|
130
|
-
|
170
|
+
scrollTo('a[name="main"]');
|
131
171
|
} else {
|
132
|
-
|
172
|
+
scrollTo('#main');
|
133
173
|
}
|
134
174
|
}
|
135
175
|
|
136
|
-
if (
|
176
|
+
if (fe.pageHandler.isPageLoaded(page) && page.match('no_cache') == null) {
|
137
177
|
// if already loaded (element exists) excluding pages that need reloading
|
138
|
-
if (!background_load) {
|
178
|
+
if (!background_load) { fe.pageHandler.showPage(page); }
|
139
179
|
$('#page_ajax_spinner').hide();
|
140
180
|
} else {
|
141
181
|
$.ajax({
|
142
182
|
url: url,
|
143
183
|
type: 'GET',
|
144
184
|
data: {'answer_sheet_type':answer_sheet_type},
|
145
|
-
success: background_load ?
|
185
|
+
success: background_load ? fe.pageHandler.pageLoadedBackground : fe.pageHandler.pageLoaded,
|
146
186
|
error: function (xhr, status, error) {
|
147
187
|
alert("There was a problem loading that page. We've been notified and will fix it as soon as possible. To work on other pages, please refresh the website.");
|
148
188
|
document.location = document.location;
|
@@ -158,8 +198,11 @@
|
|
158
198
|
},
|
159
199
|
|
160
200
|
// save form if any changes were made
|
161
|
-
savePage : function(page, force) {
|
201
|
+
savePage : function(page, force, blocking) {
|
202
|
+
|
162
203
|
if (page == null) page = $('#' + this.current_page);
|
204
|
+
if (typeof blocking == "undefined") blocking = false;
|
205
|
+
|
163
206
|
// don't save more than once per second
|
164
207
|
timeNow = new Date();
|
165
208
|
if (typeof(lastSave) != "undefined" && lastSave && !force && (timeNow - lastSave < 1000)) {
|
@@ -180,6 +223,7 @@
|
|
180
223
|
success: function (xhr) {
|
181
224
|
page.data('save_fails', 0)
|
182
225
|
},
|
226
|
+
async: !blocking,
|
183
227
|
error: function() {
|
184
228
|
save_fails = page.data('save_fails') == null ? 0 : page.data('save_fails');
|
185
229
|
save_fails += 1;
|
@@ -201,7 +245,7 @@
|
|
201
245
|
},
|
202
246
|
|
203
247
|
savePages : function(force) {
|
204
|
-
$('.answer-page').each(function() {
|
248
|
+
$('.answer-page').each(function() {fe.pageHandler.savePage(null, force)})
|
205
249
|
},
|
206
250
|
|
207
251
|
// setup a timer to auto-save (only one timer, for the page being viewed)
|
@@ -221,21 +265,36 @@
|
|
221
265
|
captureForm : function(page) {
|
222
266
|
form_el = $('#' + page.attr('id') + '-form');
|
223
267
|
if( form_el[0] == null ) return null;
|
224
|
-
|
268
|
+
form_all_el = form_el.find("input:not(.dont_submit), textarea:not(.dont_submit), select:not(.dont_submit)");
|
269
|
+
return {url: form_el.attr('action'), data: form_all_el.serialize() + '&answer_sheet_type=' + answer_sheet_type};
|
225
270
|
},
|
226
271
|
|
227
272
|
|
228
273
|
// enable form validation (when form is loaded)
|
229
274
|
enableValidation : function(page) {
|
230
|
-
|
231
|
-
|
232
|
-
|
275
|
+
// Provide a way for enclosing apps to not have validation continually as people fill things out
|
276
|
+
// They can do that with this:
|
277
|
+
//
|
278
|
+
// $(document).on 'fePageLoaded', (evt, page) ->
|
279
|
+
// $(".page > form").addClass('no-ongoing-validation');
|
280
|
+
//
|
281
|
+
$('#' + page + '-form:not(.no-ongoing-validation)').validate({onsubmit:false, focusInvalid:true, onfocusout: function(element) { this.element(element);}});
|
282
|
+
$('#' + page + '-form:not(.no-ongoing-validation):input').change(function() {
|
283
|
+
fe.pageHandler.validatePage(page, true);
|
233
284
|
});
|
234
285
|
},
|
235
286
|
|
236
287
|
validatePage : function(page, page_classes_only) {
|
237
288
|
page_classes_only = typeof page_classes_only !== 'undefined' ? page_classes_only : false;
|
238
289
|
|
290
|
+
// Provide a way for enclosing apps to never validate a form
|
291
|
+
// They can do that with this:
|
292
|
+
//
|
293
|
+
// $(document).on 'fePageLoaded', (evt, page) ->
|
294
|
+
// $(".page > form").addClass('no-validation');
|
295
|
+
//
|
296
|
+
if ($('#' + this.current_page + "-form").hasClass('no-validation')) { return; }
|
297
|
+
|
239
298
|
try {
|
240
299
|
var li = $('#' + page + '-li');
|
241
300
|
var form = $('#' + page + '-form');
|
@@ -273,12 +332,12 @@
|
|
273
332
|
// callback when falls to 0 active Ajax requests
|
274
333
|
completeAll : function()
|
275
334
|
{
|
276
|
-
$('#submit_button').attr('disabled', true)
|
277
|
-
$('#submit_message').html('');
|
278
|
-
$('#submit_message').hide();
|
335
|
+
$('.page:visible #submit_button').attr('disabled', true)
|
336
|
+
$('#submit_message, .submit_message').html('');
|
337
|
+
$('#submit_message, .submit_message').hide();
|
279
338
|
// validate all the pages
|
280
339
|
$('.page_link').each(function(index, page) {
|
281
|
-
|
340
|
+
fe.pageHandler.validatePage($(page).attr('data-page-id'));
|
282
341
|
});
|
283
342
|
var all_valid = ($('#list-pages li.incomplete').length == 0);
|
284
343
|
|
@@ -288,7 +347,8 @@
|
|
288
347
|
|
289
348
|
if( payments_made)
|
290
349
|
{
|
291
|
-
|
350
|
+
// force an async save (so it finishes before submitting) in case any input fields on submit_page
|
351
|
+
this.savePage(null, true, true);
|
292
352
|
|
293
353
|
// submit the application
|
294
354
|
if($('#submit_to')[0] != null)
|
@@ -296,7 +356,7 @@
|
|
296
356
|
url = $('#submit_to').val();
|
297
357
|
// clear out pages array to force reload. This enables "frozen" apps
|
298
358
|
// immediately after submission - :onSuccess (for USCM which stays in the application vs. redirecting to the dashboard)
|
299
|
-
var curr =
|
359
|
+
var curr = fe.pageHandler.current_page;
|
300
360
|
$.ajax({url: url, dataType:'script',
|
301
361
|
data: {answer_sheet_type: answer_sheet_type, a: $('input[type=hidden][name=a]').val()},
|
302
362
|
type:'post',
|
@@ -319,8 +379,8 @@
|
|
319
379
|
else
|
320
380
|
{
|
321
381
|
// some pages aren't valid
|
322
|
-
$('#submit_message').html("Please make a payment");
|
323
|
-
$('#submit_message').show();
|
382
|
+
$('#submit_message, .submit_message').html("Please make a payment");
|
383
|
+
$('#submit_message, .submit_message').show();
|
324
384
|
|
325
385
|
var btn = $('#submit_button'); if (btn) { btn.attr('disabled', false); }
|
326
386
|
}
|
@@ -333,8 +393,8 @@
|
|
333
393
|
},
|
334
394
|
|
335
395
|
checkConditional : function($element) {
|
336
|
-
matchable_answers = String($element.data('conditional_answer')).split('
|
337
|
-
if ($element.hasClass('fe_choicefield') && $element.hasClass('style_yes-no')) {
|
396
|
+
matchable_answers = String($element.data('conditional_answer')).split(';').map(function(s) { return s.trim(); })
|
397
|
+
if ($element.hasClass('fe_choicefield') && ($element.hasClass('style_yes-no') || $element.hasClass('yes-no'))) {
|
338
398
|
if ($(matchable_answers).filter([1, '1', true, 'true', 'yes', 'Yes']).length > 0) {
|
339
399
|
matchable_answers = [1, '1', true, 'true', 'yes', 'Yes'];
|
340
400
|
}
|
@@ -344,6 +404,8 @@
|
|
344
404
|
vals = $([$element.find("input[type=radio]:checked").val()]);
|
345
405
|
} else if ($element.hasClass('fe_choicefield') && $element.hasClass('checkbox')) {
|
346
406
|
vals = $element.find("input[type=checkbox]:checked").map(function(i, el) { return $(el).val(); });
|
407
|
+
} else if ($element.hasClass('fe_choicefield') && $element.hasClass('radio')) {
|
408
|
+
vals = $([$element.find("input[type=radio]:checked").val()]);
|
347
409
|
} else {
|
348
410
|
vals = $([$element.find("input:visible, select:visible").val()]);
|
349
411
|
}
|
@@ -361,6 +423,7 @@
|
|
361
423
|
prefix = $element.data('answer_sheet_id_prefix');
|
362
424
|
pg = prefix + '_' + $element.data('application_id') + '-fe_page_' + $element.data('conditional_id');
|
363
425
|
li_id = 'li#'+pg+'-li';
|
426
|
+
li_id += ', li#'+pg+'-no_cache-li';
|
364
427
|
|
365
428
|
if (match) {
|
366
429
|
$(li_id).show();
|
@@ -373,9 +436,11 @@
|
|
373
436
|
}
|
374
437
|
},
|
375
438
|
|
376
|
-
next : function() {
|
377
|
-
|
378
|
-
|
439
|
+
next : function(validate_current_page) {
|
440
|
+
validate_current_page = typeof validate_current_page !== 'undefined' ? validate_current_page : false;
|
441
|
+
|
442
|
+
curr_page_link = $('#'+fe.pageHandler.current_page+"-link");
|
443
|
+
//fe.pageHandler.loadPage('application_22544-fe_page_165-no_cache','/fe/answer_sheets/22544/page/165/edit'); return false;
|
379
444
|
page_link = curr_page_link
|
380
445
|
.parents('.application_section')
|
381
446
|
.nextAll()
|
@@ -383,12 +448,12 @@
|
|
383
448
|
.first()
|
384
449
|
.find('a.page_link');
|
385
450
|
$(".answer-page:visible div.buttons button").prop("disabled", true)
|
386
|
-
|
451
|
+
fe.pageHandler.loadPage(page_link.data('page-id'), page_link.attr('href'), false, validate_current_page);
|
387
452
|
},
|
388
453
|
|
389
454
|
prev : function() {
|
390
|
-
curr_page_link = $('#'
|
391
|
-
|
455
|
+
curr_page_link = $('#'+fe.pageHandler.current_page+"-link");
|
456
|
+
//fe.pageHandler.loadPage('application_22544-fe_page_165-no_cache','/fe/answer_sheets/22544/page/165/edit'); return false;
|
392
457
|
page_link = curr_page_link
|
393
458
|
.parents('.application_section')
|
394
459
|
.prevAll()
|
@@ -396,13 +461,13 @@
|
|
396
461
|
.first()
|
397
462
|
.find('a.page_link');
|
398
463
|
$(".answer-page:visible div.buttons button").prop("disabled", true)
|
399
|
-
|
464
|
+
fe.pageHandler.loadPage(page_link.data('page-id'), page_link.attr('href'));
|
400
465
|
}
|
401
466
|
|
402
467
|
};
|
403
468
|
|
404
469
|
$(document).on('click', ".conditional input, .conditional select", function() {
|
405
|
-
|
470
|
+
fe.pageHandler.checkConditional($(this).closest('.conditional'));
|
406
471
|
});
|
407
472
|
$(document).on('keyup', ".conditional input, .conditional select", function() { $(this).click(); });
|
408
473
|
$(document).on('blug', ".conditional input, .conditional select", function() { $(this).click(); });
|
@@ -413,6 +478,10 @@
|
|
413
478
|
remaining = maxlength - $(this).val().length;
|
414
479
|
$('#'+$(this).attr('id')+'_count').val(remaining);
|
415
480
|
});
|
481
|
+
|
482
|
+
$(document).on('click', 'a[disabled]', function(event) {
|
483
|
+
event.preventDefault();
|
484
|
+
});
|
416
485
|
})(jQuery);
|
417
486
|
|
418
487
|
$(function() {
|
@@ -425,7 +494,7 @@ function updateTotal(id) {
|
|
425
494
|
try {
|
426
495
|
total = 0;
|
427
496
|
$(".col_" + id).each(function(index, el) {
|
428
|
-
total += Number($(el).val());
|
497
|
+
total += Number($(el).val().replace(',',''));
|
429
498
|
});
|
430
499
|
$('#total_' + id).val(total).trigger('totalChanged');
|
431
500
|
} catch(e) {
|
@@ -448,3 +517,10 @@ function submitToFrame(id, url) {
|
|
448
517
|
form.submit();
|
449
518
|
return false
|
450
519
|
}
|
520
|
+
|
521
|
+
function scrollTo(el) {
|
522
|
+
if ($(el).length == 0) { return; }
|
523
|
+
$('html, body').animate({
|
524
|
+
scrollTop: $(el).offset().top
|
525
|
+
}, 1000);
|
526
|
+
}
|