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
@@ -1,20 +1,23 @@
|
|
1
1
|
# QuestionSheet represents a particular form
|
2
2
|
module Fe
|
3
|
-
class QuestionSheet <
|
3
|
+
class QuestionSheet < ApplicationRecord
|
4
4
|
self.table_name = self.table_name.sub('fe_', Fe.table_name_prefix)
|
5
5
|
|
6
|
+
attr_accessor :old_id
|
7
|
+
attr_accessor :element_id_mappings
|
8
|
+
|
6
9
|
has_many :pages, -> { order('number') },
|
7
|
-
:
|
10
|
+
dependent: :destroy
|
8
11
|
|
9
12
|
has_many :answer_sheet_question_sheets
|
10
13
|
|
11
14
|
has_many :answer_sheets,
|
12
|
-
:
|
15
|
+
through: :answer_sheet_question_sheets
|
13
16
|
has_many :question_sheets,
|
14
|
-
:
|
17
|
+
through: :answer_sheet_question_sheets
|
15
18
|
|
16
|
-
scope :active, -> { where(:
|
17
|
-
scope :archived, -> { where(:
|
19
|
+
scope :active, -> { where(archived: false) }
|
20
|
+
scope :archived, -> { where(archived: true) }
|
18
21
|
|
19
22
|
validates_presence_of :label
|
20
23
|
|
@@ -24,16 +27,11 @@ module Fe
|
|
24
27
|
|
25
28
|
# create a new form with a page already attached
|
26
29
|
def self.new_with_page
|
27
|
-
question_sheet = self.new(:
|
28
|
-
question_sheet.pages.build(:
|
30
|
+
question_sheet = self.new(label: next_label)
|
31
|
+
question_sheet.pages.build(label: 'Page 1', number: 1)
|
29
32
|
question_sheet
|
30
33
|
end
|
31
34
|
|
32
|
-
# count all questions including ones inside a grid
|
33
|
-
def questions_count
|
34
|
-
all_elements.questions.count
|
35
|
-
end
|
36
|
-
|
37
35
|
def questions
|
38
36
|
all_elements.questions
|
39
37
|
end
|
@@ -43,8 +41,8 @@ module Fe
|
|
43
41
|
end
|
44
42
|
|
45
43
|
def all_elements
|
46
|
-
element_ids = pages.pluck(:all_element_ids).compact.join(',').split(',')
|
47
|
-
element_ids.present? ? Element.where(id: element_ids).order(element_ids.collect{ |id| "id=#{id} DESC" }.join(', ')) : Element.where("1 = 0")
|
44
|
+
element_ids = pages.pluck(:all_element_ids).compact.join(',').split(',').find_all(&:present?)
|
45
|
+
element_ids.present? ? Element.where(id: element_ids).order(Arel.sql(element_ids.collect{ |id| "id=#{id} DESC" }.join(', '))) : Element.where("1 = 0")
|
48
46
|
end
|
49
47
|
|
50
48
|
# Pages get duplicated
|
@@ -53,13 +51,48 @@ module Fe
|
|
53
51
|
def duplicate
|
54
52
|
new_sheet = QuestionSheet.new(self.attributes.merge(id: nil))
|
55
53
|
new_sheet.label = self.label + ' - COPY'
|
56
|
-
new_sheet.save(:
|
54
|
+
new_sheet.save(validate: false)
|
57
55
|
self.pages.each do |page|
|
58
56
|
page.copy_to(new_sheet)
|
59
57
|
end
|
60
58
|
new_sheet
|
61
59
|
end
|
62
60
|
|
61
|
+
def export_to_yaml
|
62
|
+
atts = attributes.to_hash
|
63
|
+
atts[:pages] = pages.collect(&:export_hash)
|
64
|
+
atts.to_yaml
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.create_from_yaml(filename)
|
68
|
+
# NOTE: yaml will break if some classes aren't loaded before YAML::load, strange
|
69
|
+
Fe::Element.distinct.where.not(kind: 'Fe::Style').pluck(:kind).each(&:constantize)
|
70
|
+
|
71
|
+
sheet_data = YAML::load(File.read(filename))
|
72
|
+
sheet_data[:old_id] = sheet_data.delete("id")
|
73
|
+
pages = sheet_data.delete(:pages)
|
74
|
+
puts("Create import by data #{sheet_data}")
|
75
|
+
question_sheet = Fe::QuestionSheet.create!(sheet_data)
|
76
|
+
question_sheet.element_id_mappings = []
|
77
|
+
pages.each do |page_atts|
|
78
|
+
page = Page.create_from_import(page_atts, question_sheet)
|
79
|
+
question_sheet.pages << page
|
80
|
+
end
|
81
|
+
# set page conditional_id values to new ids based on old_id
|
82
|
+
question_sheet.all_elements.each do |el|
|
83
|
+
if el.conditional_type != "Fe::Page" && el.conditional_id.present?
|
84
|
+
# noop
|
85
|
+
end
|
86
|
+
|
87
|
+
# note that conditional elements are already translated to new ids in the element import so no need to do it here
|
88
|
+
if el.conditional_type == "Fe::Page" && el.conditional_id
|
89
|
+
el.update(conditional_id: question_sheet.pages.detect{ |el2| el2.old_id == el.conditional_id }&.id)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
question_sheet
|
94
|
+
end
|
95
|
+
|
63
96
|
private
|
64
97
|
|
65
98
|
# next unused label with "Untitled form" prefix
|
@@ -2,12 +2,15 @@
|
|
2
2
|
# - a question that provides a fields to specify a reference
|
3
3
|
module Fe
|
4
4
|
class ReferenceQuestion < Question
|
5
|
+
has_many :reference_sheets, foreign_key: :question_id
|
6
|
+
|
7
|
+
after_save :update_references_question_sheet_ids
|
5
8
|
|
6
9
|
def response(app=nil)
|
7
10
|
return unless app
|
8
11
|
# A reference is the same if the related_question_sheet corresponding to the question is the same
|
9
12
|
reference = Fe::ReferenceSheet.find_by_applicant_answer_sheet_id_and_question_id(app.id, id)
|
10
|
-
reference || Fe::ReferenceSheet.create(:
|
13
|
+
reference || Fe::ReferenceSheet.create(applicant_answer_sheet_id: app.id, question_id: id)
|
11
14
|
end
|
12
15
|
|
13
16
|
def has_response?(app = nil)
|
@@ -15,11 +18,11 @@ module Fe
|
|
15
18
|
reference = response(app)
|
16
19
|
reference && reference.valid?
|
17
20
|
else
|
18
|
-
Fe::ReferenceSheet.where(:
|
21
|
+
Fe::ReferenceSheet.where(question_id: id).count > 0
|
19
22
|
end
|
20
23
|
end
|
21
24
|
|
22
|
-
def display_response(app=nil)
|
25
|
+
def display_response(app = nil, humanize = false)
|
23
26
|
response(app).to_s
|
24
27
|
end
|
25
28
|
|
@@ -28,5 +31,8 @@ module Fe
|
|
28
31
|
"fe/reference_#{style}"
|
29
32
|
end
|
30
33
|
|
34
|
+
def update_references_question_sheet_ids
|
35
|
+
reference_sheets.where(status: :created).update_all(question_sheet_id: related_question_sheet_id, updated_at: Time.now)
|
36
|
+
end
|
31
37
|
end
|
32
38
|
end
|
@@ -1,40 +1,49 @@
|
|
1
1
|
require 'validates_email_format_of'
|
2
2
|
require 'aasm'
|
3
3
|
module Fe
|
4
|
-
class ReferenceSheet <
|
4
|
+
class ReferenceSheet < ApplicationRecord
|
5
5
|
include Fe::AnswerSheetConcern
|
6
6
|
include Rails.application.routes.url_helpers
|
7
7
|
include AASM
|
8
8
|
include AccessKeyGenerator
|
9
9
|
|
10
|
+
attr_accessor :allow_quiet_reference_email_changes
|
11
|
+
|
10
12
|
self.table_name = "#{Fe.table_name_prefix}references"
|
11
13
|
self.inheritance_column = 'fake'
|
12
14
|
|
15
|
+
scope :visible, -> { where(visible: true) }
|
16
|
+
|
13
17
|
belongs_to :question,
|
14
|
-
:
|
15
|
-
:
|
18
|
+
class_name: 'Fe::ReferenceQuestion',
|
19
|
+
foreign_key: 'question_id'
|
16
20
|
|
17
21
|
belongs_to :applicant_answer_sheet,
|
18
|
-
:
|
19
|
-
:
|
22
|
+
class_name: "::#{Fe.answer_sheet_class}",
|
23
|
+
foreign_key: "applicant_answer_sheet_id"
|
20
24
|
|
21
|
-
|
22
|
-
|
25
|
+
# using belongs_to :question_sheet doesn't work, it uses the Fe::AnswerSheetConcern#question_sheet implementation
|
26
|
+
belongs_to :question_sheet_ref, optional: true, class_name: 'Fe::QuestionSheet', foreign_key: :question_sheet_id
|
23
27
|
|
24
|
-
|
28
|
+
validates_presence_of :first_name, :last_name, :phone, :email, :relationship, on: :update, message: "can't be blank"
|
29
|
+
validates :email, email_format: { on: :update, message: "doesn't look right." }
|
25
30
|
|
26
|
-
|
31
|
+
delegate :style, to: :question
|
27
32
|
|
33
|
+
before_save :reset_reference, if: :new_reference_requested?
|
34
|
+
after_save :notify_old_reference_not_needed, if: :new_reference_requested?
|
35
|
+
before_create :set_question_sheet
|
28
36
|
after_destroy :notify_reference_of_deletion
|
37
|
+
after_create :update_visible
|
29
38
|
|
30
|
-
aasm :
|
39
|
+
aasm column: :status do
|
31
40
|
|
32
|
-
state :started, :
|
33
|
-
|
41
|
+
state :started, enter: Proc.new {
|
42
|
+
update(started_at: Time.now)
|
34
43
|
}
|
35
|
-
state :created
|
36
|
-
state :completed, :
|
37
|
-
|
44
|
+
state :created, initial: true
|
45
|
+
state :completed, enter: Proc.new {
|
46
|
+
update(submitted_at: Time.now)
|
38
47
|
# SpReferenceMailer.deliver_completed(ref)
|
39
48
|
=begin
|
40
49
|
Fe::Notifier.notification(ref.email, # RECIPIENTS
|
@@ -59,26 +68,46 @@ module Fe
|
|
59
68
|
'password' => person.user.password_plain}).deliver
|
60
69
|
=end
|
61
70
|
|
62
|
-
|
71
|
+
applicant_answer_sheet.complete(self)
|
63
72
|
}
|
64
73
|
|
65
74
|
event :start do
|
66
|
-
transitions :
|
75
|
+
transitions to: :started, from: :created
|
67
76
|
end
|
68
77
|
|
69
78
|
event :submit do
|
70
|
-
transitions :
|
71
|
-
transitions :
|
79
|
+
transitions to: :completed, from: :started
|
80
|
+
transitions to: :completed, from: :created
|
72
81
|
end
|
73
82
|
|
74
83
|
event :unsubmit do
|
75
|
-
transitions :
|
84
|
+
transitions to: :started, from: :completed
|
76
85
|
end
|
77
86
|
end
|
78
87
|
|
79
88
|
alias_method :application, :applicant_answer_sheet
|
80
89
|
delegate :applicant, to: :application
|
81
90
|
|
91
|
+
def computed_visibility_cache_key
|
92
|
+
return @computed_visibility_cache_key if @computed_visibility_cache_key
|
93
|
+
return nil unless question # keep from crashing for tests
|
94
|
+
answers = Fe::Answer.where(question_id: question.visibility_affecting_element_ids,
|
95
|
+
answer_sheet_id: applicant_answer_sheet)
|
96
|
+
answers.collect(&:cache_key_with_version).join('/')
|
97
|
+
end
|
98
|
+
|
99
|
+
def update_visible(page = nil)
|
100
|
+
if visibility_cache_key == computed_visibility_cache_key
|
101
|
+
visible
|
102
|
+
else
|
103
|
+
self.visible = question.visible?(applicant_answer_sheet, page)
|
104
|
+
self.visibility_cache_key = computed_visibility_cache_key
|
105
|
+
# save only these columns and don't check validations, but do record updated_at
|
106
|
+
# as it is significant enough of an event that we probably want that to set updated_at
|
107
|
+
Fe::ReferenceSheet.where(id: id).update_all(visibility_cache_key: self.computed_visibility_cache_key, visible: self.visible, updated_at: Time.now)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
82
111
|
def frozen?
|
83
112
|
!%w(started created).include?(self.status)
|
84
113
|
end
|
@@ -86,7 +115,7 @@ module Fe
|
|
86
115
|
def email_sent?() !self.email_sent_at.nil? end
|
87
116
|
|
88
117
|
# send email invite
|
89
|
-
def send_invite
|
118
|
+
def send_invite(host)
|
90
119
|
return if self.email.blank?
|
91
120
|
|
92
121
|
application = self.applicant_answer_sheet
|
@@ -98,7 +127,7 @@ module Fe
|
|
98
127
|
'applicant_full_name' => application.applicant.name,
|
99
128
|
'applicant_email' => application.applicant.email,
|
100
129
|
'applicant_home_phone' => application.applicant.phone,
|
101
|
-
'reference_url' => edit_fe_reference_sheet_url(self, :
|
130
|
+
'reference_url' => edit_fe_reference_sheet_url(self, a: self.access_key, host: host)}).deliver_now
|
102
131
|
# Send notification to applicant
|
103
132
|
Notifier.notification(applicant_answer_sheet.applicant.email, # RECIPIENTS
|
104
133
|
Fe.from_email, # FROM
|
@@ -106,10 +135,10 @@ module Fe
|
|
106
135
|
{'applicant_full_name' => applicant_answer_sheet.applicant.name,
|
107
136
|
'reference_full_name' => self.name,
|
108
137
|
'reference_email' => self.email,
|
109
|
-
'application_url' => edit_fe_answer_sheet_url(applicant_answer_sheet, :
|
138
|
+
'application_url' => edit_fe_answer_sheet_url(applicant_answer_sheet, host: host)}).deliver_now
|
110
139
|
|
111
140
|
self.email_sent_at = Time.now
|
112
|
-
self.save(:
|
141
|
+
self.save(validate: false)
|
113
142
|
|
114
143
|
true
|
115
144
|
end
|
@@ -126,52 +155,78 @@ module Fe
|
|
126
155
|
name
|
127
156
|
end
|
128
157
|
|
129
|
-
def required?
|
130
|
-
question.required?(applicant_answer_sheet)
|
131
|
-
end
|
132
|
-
|
133
158
|
def reference?
|
134
159
|
true
|
135
160
|
end
|
136
161
|
|
137
162
|
# Can't rely on answer_sheet's implementation for old reference's that might have id's that may match an application id
|
138
163
|
def question_sheet
|
139
|
-
|
164
|
+
question_sheet_ref
|
140
165
|
end
|
141
166
|
|
142
|
-
# Can't rely on answer_sheet's implementation for old reference's that might have id's that may match an application id
|
143
167
|
def question_sheets
|
144
|
-
[
|
168
|
+
[question_sheet_ref]
|
145
169
|
end
|
146
170
|
|
147
171
|
def question_sheet_ids
|
148
|
-
[
|
172
|
+
[question_sheet_id].compact
|
149
173
|
end
|
150
174
|
|
151
175
|
def display_type
|
152
176
|
question.label.split(/:| \(/).first
|
153
177
|
end
|
154
178
|
|
179
|
+
def optional?
|
180
|
+
question.try(:hidden?, applicant_answer_sheet)
|
181
|
+
end
|
182
|
+
|
183
|
+
def required?
|
184
|
+
question.required?(applicant_answer_sheet) && !optional?
|
185
|
+
end
|
186
|
+
|
187
|
+
def all_affecting_questions_answered
|
188
|
+
return false unless question
|
189
|
+
question.visibility_affecting_questions.all? { |q| q.has_response?(applicant_answer_sheet) }
|
190
|
+
end
|
191
|
+
|
155
192
|
protected
|
193
|
+
|
194
|
+
def set_question_sheet
|
195
|
+
self.question_sheet_id = question.try(:related_question_sheet_id)
|
196
|
+
end
|
197
|
+
|
156
198
|
# if the email address has changed, we have to trash the old reference answers
|
157
|
-
def
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
199
|
+
def reset_reference
|
200
|
+
answers.destroy_all
|
201
|
+
# Every time the email address changes, generate a new access_key
|
202
|
+
generate_access_key
|
203
|
+
self.email_sent_at = nil
|
204
|
+
self.status = 'created'
|
205
|
+
end
|
206
|
+
|
207
|
+
def notify_old_reference_not_needed
|
208
|
+
return unless email_sent_at_was.present? && email_was.present?
|
209
|
+
notify_reference_not_needed(self, email_was, first_name_was, last_name_was)
|
165
210
|
end
|
166
211
|
|
167
212
|
def notify_reference_of_deletion
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
213
|
+
return unless email_sent_at.present? && email.present?
|
214
|
+
notify_reference_not_needed(self, email, first_name, last_name)
|
215
|
+
end
|
216
|
+
|
217
|
+
def notify_reference_not_needed(ref, ref_email, ref_first_name, ref_last_name)
|
218
|
+
# inform referrer that they no longer need to fill out reference
|
219
|
+
Fe::Notifier.notification(
|
220
|
+
ref_email, # RECIPIENTS
|
221
|
+
Fe.from_email, # FROM
|
222
|
+
'Reference Deleted',
|
223
|
+
{ 'reference_full_name' => "#{ref_first_name} #{ref_last_name}",
|
224
|
+
'applicant_full_name' => applicant_answer_sheet.applicant.name }
|
225
|
+
).deliver_now
|
226
|
+
end
|
227
|
+
|
228
|
+
def new_reference_requested?
|
229
|
+
!allow_quiet_reference_email_changes && !new_record? && !completed? && email_changed?
|
175
230
|
end
|
176
231
|
end
|
177
232
|
end
|
data/app/models/fe/text_field.rb
CHANGED
@@ -14,9 +14,9 @@ module Fe
|
|
14
14
|
end
|
15
15
|
|
16
16
|
# css class names for javascript-based validation
|
17
|
-
def validation_class(answer_sheet)
|
17
|
+
def validation_class(answer_sheet, page = nil)
|
18
18
|
validation = ''
|
19
|
-
validation += ' required' if self.required?(answer_sheet)
|
19
|
+
validation += ' required' if self.required?(answer_sheet, page)
|
20
20
|
# validate-number, etc.
|
21
21
|
validate_style = ['number', 'currency-dollar', 'email', 'url', 'phone'].find {|v| v == self.style }
|
22
22
|
if validate_style
|
data/app/models/fe/user.rb
CHANGED
data/app/models/staff.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
class Staff <
|
1
|
+
class Staff < ApplicationRecord
|
2
2
|
self.table_name = "ministry_staff"
|
3
3
|
belongs_to :person
|
4
4
|
|
5
|
-
belongs_to :primary_address, :
|
6
|
-
belongs_to :secondary_address, :
|
5
|
+
belongs_to :primary_address, class_name: "StaffAddress", foreign_key: :fk_primaryAddress
|
6
|
+
belongs_to :secondary_address, class_name: "StaffAddress", foreign_key: :fk_secondaryAddress
|
7
7
|
|
8
8
|
alias_attribute :preferred_name, :preferredName
|
9
9
|
|
@@ -72,13 +72,13 @@ class Staff < ActiveRecord::Base
|
|
72
72
|
]
|
73
73
|
end
|
74
74
|
|
75
|
-
scope :specialty_roles, -> { where(:
|
76
|
-
where(:
|
75
|
+
scope :specialty_roles, -> { where(jobStatus: "Staff Full Time").where(ministry: "Campus Ministry").
|
76
|
+
where(removedFromPeopleSoft: "N").where("jobTitle NOT IN (?)", field_roles).order(:jobTitle).order(:lastName) }
|
77
77
|
|
78
78
|
def self.get_roles(region)
|
79
79
|
result = {}
|
80
80
|
Staff.strategy_order.each do |strategy|
|
81
|
-
result[strategy] = specialty_roles.where(:
|
81
|
+
result[strategy] = specialty_roles.where(strategy: strategy).where(region: region)
|
82
82
|
end
|
83
83
|
result
|
84
84
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<% if @page_element %>
|
2
2
|
$('#question_modal').dialog('close');
|
3
|
-
$('#page-preview').html('<%= escape_javascript(render(
|
3
|
+
$('#page-preview').html('<%= escape_javascript(render("fe/admin/question_pages/question_page")) %>');
|
4
4
|
$('#element_<%= dom_id(@element) %>').hide();
|
5
|
-
$('#element_form_<%= dom_id(@element) %>').html('<%= escape_javascript(render(
|
5
|
+
$('#element_form_<%= dom_id(@element) %>').html('<%= escape_javascript(render("fe/admin/panels/prop_element", element: @element)) %>');
|
6
6
|
$('#element_form_<%= dom_id(@element) %>').show();
|
7
7
|
selectElement("#element_<%= @element.id %>");
|
8
|
-
|
8
|
+
scrollTo("#element_<%= @element.id %>");
|
9
9
|
setUpSortables();
|
10
10
|
<% else %>
|
11
11
|
alert('That question already exists on this question sheet')
|
@@ -1,3 +1,3 @@
|
|
1
|
-
$('#page-preview').html('<%= escape_javascript(render(
|
1
|
+
$('#page-preview').html('<%= escape_javascript(render("fe/admin/question_pages/question_page", page: @page)) %>')
|
2
2
|
$('#list-pages li').removeClass('active')
|
3
3
|
setUpJsHelpers();
|
@@ -1,4 +1,4 @@
|
|
1
1
|
$('#element_<%= dom_id(@element) %>').hide()
|
2
|
-
$('#element_form_<%= dom_id(@element) %>').html('<%= escape_javascript(render(
|
2
|
+
$('#element_form_<%= dom_id(@element) %>').html('<%= escape_javascript(render("fe/admin/panels/prop_element", element: @element)) %>')
|
3
3
|
$('#element_form_<%= dom_id(@element) %>').show();
|
4
4
|
selectElement("#element_<%= @element.id %>")
|
@@ -1,4 +1,4 @@
|
|
1
|
-
$('#errors').html('<%= escape_javascript(render(
|
1
|
+
$('#errors').html('<%= escape_javascript(render("errors", element: @element)) %>')
|
2
2
|
<% @element.errors.each do |attr_name, message| %>
|
3
3
|
addError('element_<%= attr_name %>')
|
4
4
|
<% end %>
|
@@ -1,10 +1,17 @@
|
|
1
|
+
<% if @questions.any? %>
|
1
2
|
if ($('#question_modal')[0] == null) {
|
2
3
|
$('body').append('<div id="question_modal"></div>');
|
3
4
|
}
|
4
|
-
$('#question_modal').html('<%= link_to("Add \"#{params[:human_type]}\"", fe_admin_question_sheet_page_elements_path(:
|
5
|
-
:
|
6
|
-
:
|
7
|
-
:
|
8
|
-
:
|
9
|
-
|
5
|
+
$('#question_modal').html('<%= link_to("Add \"#{params[:human_type]}\"", fe_admin_question_sheet_page_elements_path(question_sheet_id: @page.question_sheet_id, page_id: @page.id,
|
6
|
+
element_type: params[:element_type], "element[style]" => @style, format: :js),
|
7
|
+
remote: true,
|
8
|
+
method: :post,
|
9
|
+
class: "add_type",
|
10
|
+
data: { disable_with: "Add \"#{params[:human_type]}\"" }) %><p>Or you can also copy an existing <%= params[:human_type] %> element. If you are unsure, just <strong>Add <%= params[:human_type] %>.</strong></p><div id="questions_div" title=""></div>');
|
11
|
+
$('#questions_div').html("<%= escape_javascript(render("fe/questions/fe/questions", questions: @questions)) %>")
|
10
12
|
$('#question_modal').dialog({width: 500, height: 400});
|
13
|
+
<% else %>
|
14
|
+
$.post('<%= fe_admin_question_sheet_page_elements_path(question_sheet_id: @page.question_sheet_id,
|
15
|
+
page_id: @page.id,
|
16
|
+
element_type: params[:element_type], "element[style]" => @style, format: :js) %>');
|
17
|
+
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
$('#element_form_<%= dom_id(@element) %>').hide();
|
2
|
-
$('#element_<%= dom_id(@element) %>').html('<%= escape_javascript(render(
|
2
|
+
$('#element_<%= dom_id(@element) %>').html('<%= escape_javascript(render("fe/admin/question_pages/element_show", element: @element)) %>')
|
3
3
|
$('#element_<%= dom_id(@element) %>').show()
|
4
4
|
clearCurrentElement()
|
5
5
|
$('#questions_list').sortable('refresh');
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<p><label for="email_template_name" class="desc">Template Name</label>
|
2
|
-
<%= f.text_field :name, :
|
2
|
+
<%= f.text_field :name, class: "text", size: 93 %></p>
|
3
3
|
|
4
4
|
<p><label for="email_template_subject" class="desc">Subject</label>
|
5
|
-
<%= f.text_field :subject, :
|
5
|
+
<%= f.text_field :subject, class: "text", size: 93 %></p>
|
6
6
|
|
7
7
|
<p><label for="email_template_content" class="desc">Content</label>
|
8
|
-
<%= f.text_area :content, :
|
8
|
+
<%= f.text_area :content, rows: 25, cols: 80, class: "text" %>
|
@@ -3,10 +3,10 @@
|
|
3
3
|
|
4
4
|
<%= error_messages_for :email_template %>
|
5
5
|
|
6
|
-
<%= form_for(:email_template, :
|
7
|
-
<%= render
|
6
|
+
<%= form_for(:email_template, url: fe_admin_email_template_path(@email_template), html: { method: :put } ) do |f| %>
|
7
|
+
<%= render "form", f: f %>
|
8
8
|
|
9
|
-
<p><%= submit_tag "Update" %> or <%= link_to "Cancel", fe_admin_email_templates_path, :
|
9
|
+
<p><%= submit_tag "Update" %> or <%= link_to "Cancel", fe_admin_email_templates_path, class: "cancel" %></p>
|
10
10
|
<% end %>
|
11
11
|
|
12
12
|
|
@@ -8,13 +8,13 @@
|
|
8
8
|
</tr>
|
9
9
|
<% for email_template in @email_templates %>
|
10
10
|
<tr class="<%= cycle("","alt") %>">
|
11
|
-
<td><%= link_to email_template.name, edit_fe_admin_email_template_path(email_template), :
|
12
|
-
<td class="actions"><%= link_to
|
11
|
+
<td><%= link_to email_template.name, edit_fe_admin_email_template_path(email_template), class: "email-template" %></td>
|
12
|
+
<td class="actions"><%= link_to "Destroy", fe_admin_email_template_path(email_template), data: {confirm: "Are you sure?"}, method: :delete, class: "destroy" %></td>
|
13
13
|
</tr>
|
14
14
|
<% end %>
|
15
15
|
</table>
|
16
16
|
|
17
17
|
<br />
|
18
18
|
|
19
|
-
<%= link_to
|
19
|
+
<%= link_to "New Template", new_fe_admin_email_template_path, method: :GET, class: "add-link" %>
|
20
20
|
</div>
|
@@ -3,9 +3,9 @@
|
|
3
3
|
|
4
4
|
<%= error_messages_for :email_template %>
|
5
5
|
|
6
|
-
<%= form_for(:email_template, :
|
7
|
-
<%= render :
|
6
|
+
<%= form_for(:email_template, url: fe_admin_email_templates_path) do |f| %>
|
7
|
+
<%= render partial: "form", locals: {f: f}%>
|
8
8
|
|
9
|
-
<p><%= submit_tag "Create" %> or <%= link_to "Cancel", fe_admin_email_templates_path, :
|
9
|
+
<p><%= submit_tag "Create" %> or <%= link_to "Cancel", fe_admin_email_templates_path, class: "cancel" %></p>
|
10
10
|
<% end %>
|
11
11
|
</div>
|