fe 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +36 -1
- data/Rakefile +22 -13
- data/app/assets/javascripts/application.js.erb +1 -0
- data/app/assets/javascripts/fe/admin.js +1 -4
- data/app/assets/javascripts/fe/{qe.admin.js → fe.admin.js} +15 -0
- data/app/assets/javascripts/fe/{qe.common.js → fe.common.js} +0 -0
- data/app/assets/javascripts/fe/{qe.public.js → fe.public.js} +115 -27
- data/app/assets/javascripts/fe/rails.extra.js +6 -0
- data/app/assets/stylesheets/fe/{qe.screen.css.scss.erb → fe.screen.css.scss.erb} +12 -18
- data/app/controllers/fe/admin/elements_controller.rb +4 -4
- data/app/controllers/fe/admin/email_templates_controller.rb +10 -4
- data/app/controllers/fe/admin/question_pages_controller.rb +3 -3
- data/app/controllers/fe/admin/question_sheets_controller.rb +6 -5
- data/app/controllers/fe/applications_controller.rb +183 -0
- data/app/controllers/fe/concerns/answer_pages_controller_concern.rb +5 -2
- data/app/controllers/fe/concerns/answer_sheets_controller_concern.rb +10 -6
- data/app/controllers/fe/concerns/application_controller_concern.rb +34 -0
- data/app/controllers/fe/payments_controller.rb +184 -0
- data/app/controllers/fe/reference_pages_controller.rb +41 -0
- data/app/controllers/fe/reference_sheets_controller.rb +1 -1
- data/app/controllers/fe/references_controller.rb +74 -0
- data/app/controllers/fe/submit_pages_controller.rb +22 -0
- data/app/helpers/fe/application_helper.rb +14 -5
- data/app/mailers/fe/notifier.rb +1 -1
- data/app/models/fe/address.rb +3 -0
- data/app/models/fe/answer_pages_presenter.rb +1 -1
- data/app/models/fe/answer_sheet.rb +6 -2
- data/app/models/fe/answer_sheet_question_sheet.rb +1 -1
- data/app/models/fe/application.rb +58 -0
- data/app/models/fe/choice_field.rb +1 -1
- data/app/models/fe/concerns/answer_concern.rb +10 -11
- data/app/models/fe/concerns/answer_pages_presenter_concern.rb +16 -7
- data/app/models/fe/concerns/answer_sheet_concern.rb +10 -16
- data/app/models/fe/concerns/choice_field_concern.rb +21 -10
- data/app/models/fe/condition.rb +1 -1
- data/app/models/fe/current_address.rb +12 -0
- data/app/models/fe/date_field.rb +3 -3
- data/app/models/fe/element.rb +66 -9
- data/app/models/fe/email_address.rb +7 -0
- data/app/models/fe/email_template.rb +1 -1
- data/app/models/fe/option.rb +1 -1
- data/app/models/fe/option_group.rb +1 -1
- data/app/models/fe/page.rb +13 -4
- data/app/models/fe/page_element.rb +13 -1
- data/app/models/fe/page_link.rb +1 -1
- data/app/models/fe/paragraph.rb +1 -1
- data/app/models/fe/payment.rb +32 -7
- data/app/models/fe/payment_question.rb +1 -1
- data/app/models/fe/person.rb +33 -0
- data/app/models/fe/phone_number.rb +5 -0
- data/app/models/fe/presenter.rb +3 -2
- data/app/models/fe/question.rb +7 -7
- data/app/models/fe/question_grid.rb +1 -2
- data/app/models/fe/question_set.rb +1 -1
- data/app/models/fe/question_sheet.rb +9 -3
- data/app/models/fe/reference_question.rb +2 -2
- data/app/models/fe/reference_sheet.rb +28 -4
- data/app/models/fe/section.rb +1 -1
- data/app/models/fe/state_chooser.rb +1 -1
- data/app/models/fe/text_field.rb +3 -3
- data/app/models/fe/user.rb +3 -0
- data/app/models/staff.rb +120 -0
- data/app/views/fe/admin/elements/_errors.html.erb +11 -1
- data/app/views/fe/admin/elements/create.js.erb +3 -3
- data/app/views/fe/admin/elements/destroy.js.erb +2 -2
- 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 +3 -3
- data/app/views/fe/admin/elements/update.js.erb +2 -2
- data/app/views/fe/admin/email_templates/edit.html.erb +9 -9
- data/app/views/fe/admin/email_templates/index.html.erb +3 -3
- data/app/views/fe/admin/email_templates/new.html.erb +2 -2
- data/app/views/fe/admin/panels/_advanced_options.html.erb +28 -1
- data/app/views/fe/admin/panels/_common_fields.html.erb +1 -1
- data/app/views/fe/admin/panels/_condition.html.erb +1 -1
- data/app/views/fe/admin/panels/_insert.html.erb +13 -13
- data/app/views/fe/admin/panels/_nav_controls.html.erb +4 -4
- data/app/views/fe/admin/panels/_page.html.erb +2 -2
- data/app/views/fe/admin/panels/_pages_list.html.erb +4 -4
- data/app/views/fe/admin/panels/_prop_attachment_field.html.erb +1 -1
- data/app/views/fe/admin/panels/_prop_choice_field.html.erb +10 -10
- data/app/views/fe/admin/panels/_prop_date_field.html.erb +1 -1
- data/app/views/fe/admin/panels/_prop_element.html.erb +7 -7
- data/app/views/fe/admin/panels/_prop_page.html.erb +2 -2
- data/app/views/fe/admin/panels/_prop_paragraph.html.erb +1 -1
- data/app/views/fe/admin/panels/_prop_payment_question.html.erb +1 -0
- data/app/views/fe/admin/panels/_prop_question_grid.html.erb +2 -2
- data/app/views/fe/admin/panels/_prop_question_grid_with_total.html.erb +1 -1
- data/app/views/fe/admin/panels/_prop_reference_question.html.erb +2 -2
- data/app/views/fe/admin/panels/_prop_section.html.erb +1 -1
- data/app/views/fe/admin/panels/_prop_sheet.html.erb +9 -9
- data/app/views/fe/admin/panels/_prop_text_field.html.erb +10 -10
- data/app/views/fe/admin/question_pages/_element.html.erb +5 -5
- data/app/views/fe/admin/question_pages/_element_show.html.erb +1 -1
- data/app/views/fe/admin/question_pages/_errors.html.erb +10 -1
- data/app/views/fe/admin/question_pages/_question_page.html.erb +3 -3
- 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/show.js.erb +3 -2
- data/app/views/fe/admin/question_pages/show_panel.js.erb +1 -1
- data/app/views/fe/admin/question_sheets/_errors.html.erb +11 -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 +1 -1
- data/app/views/fe/admin/question_sheets/show.html.erb +18 -18
- data/app/views/fe/admin/question_sheets/update.js.erb +1 -1
- data/app/views/fe/answer_pages/_answer_page.html.erb +27 -30
- data/app/views/fe/answer_pages/_element.html.erb +5 -1
- data/app/views/fe/answer_pages/update.js.erb +1 -1
- data/app/views/fe/answer_sheets/_answer_sheet.html.erb +16 -14
- data/app/views/fe/answer_sheets/_element.html.erb +1 -1
- data/app/views/fe/answer_sheets/_incomplete.html.erb +8 -8
- data/app/views/fe/answer_sheets/_page_link.html.erb +2 -2
- data/app/views/fe/answer_sheets/_pages_list.html.erb +4 -4
- data/app/views/fe/answer_sheets/_title.html.erb +1 -1
- data/app/views/fe/answer_sheets/edit.html.erb +59 -53
- data/app/views/fe/answer_sheets/incomplete.js.erb +2 -2
- data/app/views/fe/answer_sheets/send_reference_invite.js.erb +1 -1
- data/app/views/fe/application/_logout.html.erb +1 -0
- data/app/views/fe/payment_pages/_credit.html.erb +47 -0
- data/app/views/fe/payment_pages/_mail.html.erb +27 -0
- data/app/views/fe/payment_pages/_payment.html.erb +6 -0
- data/app/views/fe/payment_pages/_staff.html.erb +25 -0
- data/app/views/fe/payment_pages/_staff_results.html.erb +17 -0
- data/app/views/fe/payment_pages/edit.html.erb +75 -0
- data/app/views/fe/payment_pages/staff_search.js.erb +2 -0
- data/app/views/fe/payments/_credit.html.erb +47 -0
- data/app/views/fe/payments/_errors.html.erb +1 -0
- data/app/views/fe/payments/_payment.html.erb +13 -0
- data/app/views/fe/payments/_staff.html.erb +21 -0
- data/app/views/fe/payments/_staff_results.html.erb +18 -0
- data/app/views/fe/payments/approve.js.erb +3 -0
- data/app/views/fe/payments/create.js.erb +19 -0
- data/app/views/fe/payments/destroy.js.erb +7 -0
- data/app/views/fe/payments/edit.html.erb +56 -0
- data/app/views/fe/payments/error.js.erb +3 -0
- data/app/views/fe/payments/no_access.html.erb +7 -0
- data/app/views/fe/payments/staff_search.js.erb +1 -0
- data/app/views/fe/payments/update.html.erb +24 -0
- data/app/views/fe/questions/{_acceptance.html.erb → fe/_acceptance.html.erb} +0 -0
- data/app/views/fe/questions/{_attachment_field.html.erb → fe/_attachment_field.html.erb} +2 -2
- data/app/views/fe/questions/{_checkbox_field.html.erb → fe/_checkbox_field.html.erb} +1 -1
- data/app/views/fe/questions/{_country.html.erb → fe/_country.html.erb} +1 -1
- data/app/views/fe/questions/{_date_field.html.erb → fe/_date_field.html.erb} +0 -0
- data/app/views/fe/questions/{_date_field_mmyy.html.erb → fe/_date_field_mmyy.html.erb} +0 -0
- data/app/views/fe/questions/{_drop_down_field.html.erb → fe/_drop_down_field.html.erb} +1 -1
- data/app/views/fe/questions/fe/_paragraph.html.erb +1 -0
- data/app/views/fe/questions/fe/_payment_question.html.erb +70 -0
- data/app/views/fe/questions/{_question_grid.html.erb → fe/_question_grid.html.erb} +7 -7
- data/app/views/fe/questions/{_question_grid_with_total.html.erb → fe/_question_grid_with_total.html.erb} +1 -1
- data/app/views/fe/questions/{_questions.html.erb → fe/_questions.html.erb} +2 -2
- data/app/views/fe/questions/{_radio_button_field.html.erb → fe/_radio_button_field.html.erb} +13 -11
- data/app/views/fe/questions/{_rating.html.erb → fe/_rating.html.erb} +0 -0
- data/app/views/fe/questions/fe/_reference_discipler.html.erb +1 -0
- data/app/views/fe/questions/fe/_reference_friend.html.erb +1 -0
- data/app/views/fe/questions/fe/_reference_parent.html.erb +1 -0
- data/app/views/fe/questions/fe/_reference_peer.html.erb +1 -0
- data/app/views/fe/questions/fe/_reference_question.html.erb +38 -0
- data/app/views/fe/questions/fe/_reference_roommate.html.erb +1 -0
- data/app/views/fe/questions/fe/_reference_spiritual.html.erb +1 -0
- data/app/views/fe/questions/fe/_reference_staff.html.erb +1 -0
- data/app/views/fe/questions/fe/_section.html.erb +1 -0
- data/app/views/fe/questions/{_state_chooser.html.erb → fe/_state_chooser.html.erb} +0 -0
- data/app/views/fe/questions/{_text_area_field.html.erb → fe/_text_area_field.html.erb} +0 -0
- data/app/views/fe/questions/{_text_field.html.erb → fe/_text_field.html.erb} +0 -0
- data/app/views/fe/questions/{_yes_no.html.erb → fe/_yes_no.html.erb} +6 -6
- data/app/views/fe/questions/{_yes_no_field.erb → fe/_yes_no_field.erb} +1 -1
- data/app/views/fe/reference_pages/_reference.html.erb +31 -0
- data/app/views/fe/reference_pages/edit.html.erb +24 -0
- data/app/views/fe/reference_sheets/done.html.erb +2 -0
- data/app/views/fe/reference_sheets/submitted.js.erb +1 -0
- data/app/views/fe/references/edit.html.erb +8 -0
- data/app/views/fe/references/send_invite.js.erb +7 -0
- data/app/views/fe/references/show.html.erb +18 -0
- data/app/views/fe/references/submit.js.erb +3 -0
- data/app/views/fe/submit_pages/_errors.html.erb +1 -0
- data/app/views/fe/submit_pages/_thankyou.html.erb +2 -0
- data/app/views/fe/submit_pages/edit.html.erb +36 -0
- data/app/views/fe/submit_pages/error.js.erb +1 -0
- data/app/views/fe/submit_pages/submit.js.erb +3 -0
- data/app/views/layouts/fe/application.html.erb +30 -13
- data/app/views/layouts/fe/{qe.admin.html.erb → fe.admin.html.erb} +1 -1
- data/config/locales/en.yml +37 -0
- data/config/routes.rb +69 -27
- data/db/migrate/20131003041856_core.rb +4 -4
- data/db/migrate/20131003044518_create_email_templates.rb +1 -1
- data/db/migrate/20140623153424_create_fe_people.rb +12 -0
- data/db/migrate/20140624180246_create_fe_addresses.rb +20 -0
- data/db/migrate/20140624182216_create_create_fe_phone_numbers.rb +16 -0
- data/db/migrate/20140625160545_create_fe_users.rb +12 -0
- data/db/migrate/20140808202507_add_conditional_type_to_elements.rb +5 -0
- data/db/migrate/20140808203609_add_conditional_answer_to_elements.rb +5 -0
- data/db/migrate/20140828045339_create_payments.rb +13 -0
- data/db/migrate/20141103204704_remove_short_value_column.rb +5 -0
- data/db/migrate/20141109154522_move_conditional_ids_used_for_choice_field_to_their_own_column.rb +7 -0
- data/db/seeds.rb +7 -0
- data/lib/fe.rb +1 -1
- data/lib/fe/engine.rb +46 -1
- data/lib/fe/version.rb +1 -1
- data/lib/tasks/fe_tasks.rake +14 -0
- data/spec/controllers/fe/admin/elements_controller_spec.rb +1 -1
- data/spec/controllers/fe/admin/email_templates_controller_spec.rb +1 -1
- data/spec/controllers/fe/admin/question_pages_controller_spec.rb +1 -1
- data/spec/controllers/fe/admin/question_sheets_controller_spec.rb +1 -1
- data/spec/controllers/fe/answer_pages_controller_spec.rb +1 -1
- data/spec/controllers/fe/answer_sheets_controller_spec.rb +1 -1
- data/spec/controllers/fe/reference_sheets_controller_spec.rb +1 -1
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +29 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +82 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/assets.rb +8 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +56 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/db/schema.rb +203 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +440 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/answer_sheet_question_sheets.rb +4 -0
- data/spec/factories/answer_sheets.rb +1 -1
- data/spec/factories/applications.rb +7 -0
- data/spec/factories/elements.rb +19 -0
- data/spec/factories/fe_addresses.rb +14 -0
- data/spec/factories/fe_email_addresses.rb +7 -0
- data/spec/factories/fe_people.rb +10 -0
- data/spec/factories/fe_phone_numbers.rb +7 -0
- data/spec/factories/page.rb +9 -0
- data/spec/factories/page_elements.rb +5 -0
- data/spec/factories/payments.rb +7 -0
- data/spec/factories/question_sheet.rb +10 -0
- data/spec/models/fe/answer_sheet_question_sheet_spec.rb +3 -3
- data/spec/models/fe/answer_spec.rb +5 -5
- data/spec/models/fe/application_spec.rb +8 -0
- data/spec/models/fe/attachment_field_spec.rb +1 -1
- data/spec/models/fe/choice_field_spec.rb +29 -2
- data/spec/models/fe/condition_spec.rb +5 -5
- data/spec/models/fe/date_field_spec.rb +9 -9
- data/spec/models/fe/element_spec.rb +139 -9
- data/spec/models/fe/email_template_spec.rb +2 -2
- data/spec/models/fe/option_group_spec.rb +1 -1
- data/spec/models/fe/option_spec.rb +1 -1
- data/spec/models/fe/page_element_spec.rb +3 -3
- data/spec/models/fe/page_link_spec.rb +1 -1
- data/spec/models/fe/page_spec.rb +43 -11
- data/spec/models/fe/paragraph_spec.rb +4 -4
- data/spec/models/fe/payment_question_spec.rb +65 -0
- data/spec/models/fe/person_spec.rb +4 -0
- data/spec/models/fe/question_grid_spec.rb +1 -1
- data/spec/models/fe/question_grid_with_total_spec.rb +1 -1
- data/spec/models/fe/question_set_spec.rb +1 -1
- data/spec/models/fe/question_sheet_spec.rb +5 -5
- data/spec/models/fe/question_spec.rb +13 -12
- data/spec/models/fe/reference_question_spec.rb +4 -4
- data/spec/models/fe/reference_sheet_spec.rb +8 -8
- data/spec/models/fe/section_spec.rb +1 -1
- data/spec/models/fe/state_chooser_spec.rb +1 -1
- data/spec/models/fe/text_field_spec.rb +3 -3
- data/spec/{spec_helper.rb → rails_helper.rb} +3 -3
- data/spec/support/database.txt +3 -3
- metadata +261 -75
- data/app/views/fe/questions/_paragraph.html.erb +0 -1
- data/app/views/fe/questions/_reference_discipler.html.erb +0 -1
- data/app/views/fe/questions/_reference_friend.html.erb +0 -1
- data/app/views/fe/questions/_reference_parent.html.erb +0 -1
- data/app/views/fe/questions/_reference_peer.html.erb +0 -1
- data/app/views/fe/questions/_reference_question.html.erb +0 -38
- data/app/views/fe/questions/_reference_roommate.html.erb +0 -1
- data/app/views/fe/questions/_reference_spiritual.html.erb +0 -1
- data/app/views/fe/questions/_reference_staff.html.erb +0 -1
- data/app/views/fe/questions/_section.html.erb +0 -1
- data/lib/generators/fe/install_generator.rb +0 -132
- data/lib/tasks/qe_tasks.rake +0 -4
- data/spec/models/fe/answer_sheet_spec.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab8bef6577ff95fc7c33695a64217ca1436844ae
|
4
|
+
data.tar.gz: bf3d6f5eac700ce6c9d2185aa0a655f3825f100a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd8180a211513f1651368c173d330fd22a8a25b5837a6ccf56e302db02c48416adb962eed75af11c9b728cd4f26259352fc32d124581cf7f0e519e74fe884d6c
|
7
|
+
data.tar.gz: 113bd04128aa3e34002305267127fab5e43b3741a4686c49228d560f73535cf9117390faaaa90ed9b1756ea494eee3357900730fa2980058bffe18bdf0a0ae53
|
data/README.md
CHANGED
@@ -7,6 +7,7 @@ This project rocks and uses MIT-LICENSE.
|
|
7
7
|
### Development
|
8
8
|
|
9
9
|
### Testing
|
10
|
+
|
10
11
|
Setup a testing environment that mimics the Travis CI setup:
|
11
12
|
|
12
13
|
rake setup_dummy_app
|
@@ -15,6 +16,40 @@ Run specs:
|
|
15
16
|
|
16
17
|
rake spec
|
17
18
|
|
18
|
-
|
19
|
+
Run a specific spec:
|
20
|
+
|
21
|
+
ruby -I$GEM_HOME/gems/rspec-core-3.0.2/lib:$GEM_HOME/gems/rspec-support-3.0.2/lib -S -I fe/spec rspec spec/models/fe/element_spec.rb
|
22
|
+
|
23
|
+
### Example enclosing app
|
24
|
+
|
25
|
+
rails new
|
26
|
+
|
27
|
+
## install devise
|
28
|
+
|
29
|
+
# add to gemfile
|
30
|
+
|
31
|
+
gem 'devise'
|
32
|
+
|
33
|
+
# run
|
34
|
+
|
35
|
+
bundle install
|
36
|
+
rails generate devise:install
|
37
|
+
rails generate devise User
|
38
|
+
|
39
|
+
# add to gemfile
|
40
|
+
|
41
|
+
github: 'CruGlobal/qe', branch: 'fe'
|
42
|
+
|
43
|
+
# run
|
44
|
+
|
45
|
+
bundle exec rake fe_engine:install:migrations
|
46
|
+
|
47
|
+
# add example user
|
48
|
+
|
49
|
+
bundle exec rails console
|
50
|
+
|
51
|
+
User.new({ :email => 'user@example.com', :password => 'password', :password_confirmation => 'password'}).save
|
19
52
|
|
53
|
+
# start server
|
20
54
|
|
55
|
+
bundle exec rails server
|
data/Rakefile
CHANGED
@@ -1,27 +1,32 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
rescue LoadError
|
4
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
-
end
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'thor'
|
6
3
|
|
7
4
|
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
8
5
|
load 'rails/tasks/engine.rake' if File.exists? 'spec/dummy/Rakefile'
|
9
6
|
|
7
|
+
|
10
8
|
Bundler::GemHelper.install_tasks
|
11
9
|
|
10
|
+
ENV['ENGINE'] = 'fe_engine'
|
11
|
+
|
12
12
|
require "rspec/core/rake_task"
|
13
13
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
14
|
-
|
14
|
+
unless File.directory?("spec/dummy")
|
15
|
+
Rake::Task['dummy:app'].invoke unless ENV['SKIP_DUMMY_APP']
|
16
|
+
end
|
17
|
+
spec.rspec_opts = "-I #{File.expand_path('../spec/', __FILE__)}"
|
18
|
+
spec.pattern = FileList[File.expand_path('../spec/**/*_spec.rb', __FILE__)]
|
15
19
|
end
|
16
20
|
task default: :spec
|
17
21
|
|
18
|
-
|
22
|
+
|
23
|
+
require 'rails/dummy/tasks'
|
24
|
+
|
19
25
|
# ENV['ENGINE']
|
20
26
|
# ENV['TEMPLATE']
|
21
27
|
|
22
28
|
task :setup_dummy_app do
|
23
29
|
# Nuke any previous testing envs (for local development purposes).
|
24
|
-
Rake::Task["app:db:drop"].invoke if Dir.exists? "spec/dummy"
|
25
30
|
FileUtils.remove_dir("spec/dummy", force=true) if Dir.exists? "spec/dummy"
|
26
31
|
|
27
32
|
# Use system here (rather than Rake::Task['task'].invoke) so a new rails env
|
@@ -30,19 +35,23 @@ task :setup_dummy_app do
|
|
30
35
|
# because the "deleted" spec/dummy would still have it's "Dummy" rails app
|
31
36
|
# name in the Ruby VM environment.
|
32
37
|
#
|
33
|
-
system({"DISABLE_MIGRATE" => "true",
|
38
|
+
system({"DISABLE_MIGRATE" => "true",
|
39
|
+
"DISABLE_CREATE" => "true"}, "rake dummy:app")
|
34
40
|
|
35
41
|
# Bring in the customized mysql/postgres testing database.yml.
|
36
|
-
|
37
|
-
|
42
|
+
database_path = "spec/dummy/config/database.yml"
|
43
|
+
File.delete(database_path) if File.exists?(database_path)
|
44
|
+
FileUtils.cp("spec/support/database.txt", database_path)
|
38
45
|
|
39
46
|
Rake::Task["install_engine"].invoke
|
40
47
|
end
|
41
48
|
|
42
49
|
task :install_engine do
|
43
50
|
# Use system so that we load the dummy app's Rake commands.
|
44
|
-
|
51
|
+
|
52
|
+
# Drop any existing db so that it is recreated; Hide output so there's no stack trace if the db doesn't exist
|
53
|
+
system('cd spec/dummy && rake db:drop >/dev/null 2>&1')
|
45
54
|
|
46
55
|
# Use system so that we funcitonally test the install generator.
|
47
|
-
system("cd spec/dummy &&
|
56
|
+
system("cd spec/dummy && rake db:create && rake db:migrate && rake db:test:prepare")
|
48
57
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require fe.public.js
|
@@ -31,6 +31,21 @@ $(function() {
|
|
31
31
|
return false;
|
32
32
|
});
|
33
33
|
|
34
|
+
$(document).on('click', 'input[name=future_affect][type=radio]', function() {
|
35
|
+
if ($(this).val() == "yes") {
|
36
|
+
$(".future_answer, .future_target").show();
|
37
|
+
} else if ($(this).val() == "no") {
|
38
|
+
$(".future_answer, .future_target").hide();
|
39
|
+
}
|
40
|
+
});
|
41
|
+
|
42
|
+
$(document).on('click', "input[name='element[conditional_type]'][type=radio]", function() {
|
43
|
+
if ($(this).val() == "Fe::Page") {
|
44
|
+
$(".future_page").show();
|
45
|
+
} else if ($(this).val() == "Fe::Element") {
|
46
|
+
$(".future_page").hide();
|
47
|
+
}
|
48
|
+
});
|
34
49
|
});
|
35
50
|
// used by form designer
|
36
51
|
|
File without changes
|
@@ -1,13 +1,26 @@
|
|
1
|
+
//= require jquery
|
2
|
+
//= require jquery_ujs
|
3
|
+
//= require jquery-ui
|
4
|
+
//= require fe/fe.common.js
|
5
|
+
//= require fe/jquery.scrollTo-min.js
|
6
|
+
//= require fe/rails.extra.js
|
7
|
+
//= require fe/jquery.validate.pack.js
|
8
|
+
|
1
9
|
// used by answer sheets
|
10
|
+
|
2
11
|
(function($) {
|
12
|
+
//debugger;
|
3
13
|
$(function() {
|
4
14
|
|
5
15
|
$(document).on('click', '.save_button', function() {
|
6
16
|
$.fe.pageHandler.savePage($(this).closest('.answer-page'), true);
|
7
17
|
});
|
8
18
|
|
19
|
+
//debugger;
|
9
20
|
$(document).on('keydown', '#payment_staff_first, #payment_staff_last', function(e) {
|
21
|
+
//debugger;
|
10
22
|
if (e.which == 13) {
|
23
|
+
console.log('staff_search click');
|
11
24
|
$('#staff_search').trigger('click');
|
12
25
|
return false;
|
13
26
|
}
|
@@ -44,6 +57,33 @@
|
|
44
57
|
$(this).parent().find('.charsRemaining').html('');
|
45
58
|
});
|
46
59
|
|
60
|
+
// Payment submission
|
61
|
+
$(document).on('click', '.submit_payment', function() {
|
62
|
+
var form = $(this).closest('form');
|
63
|
+
$this = $(this);
|
64
|
+
$.ajax({url: $(this).attr('data-url'), data: form.serializeArray(), type: 'POST', dataType:'script',
|
65
|
+
beforeSend: function (xhr) {
|
66
|
+
$('body').trigger('ajax:loading', xhr);
|
67
|
+
if ($this.data('disable-with') !== null) {
|
68
|
+
$this.attr('disabled','disabled');
|
69
|
+
$this.data('enabled-text', $(this).html());
|
70
|
+
$this.attr('value', $this.data('disable-with'));
|
71
|
+
}
|
72
|
+
},
|
73
|
+
complete: function (xhr) {
|
74
|
+
$('body').trigger('ajax:complete', xhr);
|
75
|
+
$this.removeAttr('disabled');
|
76
|
+
$this.attr('value', $this.data('enabled-text'));
|
77
|
+
},
|
78
|
+
error: function (xhr, status, error) {
|
79
|
+
$('body').trigger('ajax:failure', [xhr, status, error]);
|
80
|
+
$this.removeAttribute('disabled');
|
81
|
+
$this.attr('value', $this.data('enabled-text'));
|
82
|
+
}
|
83
|
+
});
|
84
|
+
return false;
|
85
|
+
});
|
86
|
+
|
47
87
|
});
|
48
88
|
$.fe = {};
|
49
89
|
$.fe.pageHandler = {
|
@@ -150,25 +190,32 @@
|
|
150
190
|
// save form if any changes were made
|
151
191
|
savePage : function(page, force) {
|
152
192
|
if (page == null) page = $('#' + this.current_page);
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
193
|
+
// don't save more than once per second
|
194
|
+
timeNow = new Date();
|
195
|
+
if (typeof(lastSave) != "undefined" && lastSave && !force && (timeNow - lastSave < 1000)) {
|
196
|
+
return true;
|
197
|
+
}
|
198
|
+
lastSave = timeNow;
|
199
|
+
form_data = this.captureForm(page);
|
200
|
+
if( form_data ) {
|
201
|
+
if( page.data('form_data') == null || page.data('form_data').data !== form_data.data || force === true) { // if any changes
|
202
|
+
page.data('form_data', form_data);
|
203
|
+
$.ajax({url: form_data.url, type: 'put', data: form_data.data,
|
204
|
+
beforeSend: function (xhr) {
|
205
|
+
$('#spinner_' + page.attr('id')).show();
|
206
|
+
},
|
207
|
+
complete: function (xhr) {
|
208
|
+
$('#spinner_' + page.attr('id')).hide();
|
209
|
+
},
|
210
|
+
error: function() {
|
211
|
+
page.data('form_data', null); // on error, force save for next call to save
|
212
|
+
// WARNING: race conditions with load & show?
|
213
|
+
// sort of a mess if save fails while another page is already loading!!
|
214
|
+
}});
|
215
|
+
}
|
216
|
+
}
|
217
|
+
// Update last saved stamp
|
218
|
+
},
|
172
219
|
|
173
220
|
savePages : function(force) {
|
174
221
|
$('.answer-page').each(function() {$.fe.pageHandler.savePage($(this), force)})
|
@@ -244,7 +291,7 @@
|
|
244
291
|
var all_valid = ($('#list-pages li.incomplete').length == 0);
|
245
292
|
|
246
293
|
// Make sure any necessary payments are made
|
247
|
-
var payments_made = $('.payment_question.required').length
|
294
|
+
var payments_made = $('.payment_question.required').length <= $('.payment').length
|
248
295
|
|
249
296
|
|
250
297
|
if( payments_made)
|
@@ -287,13 +334,54 @@
|
|
287
334
|
}
|
288
335
|
},
|
289
336
|
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
337
|
+
// is page loaded? (useful for toggling enabled state of questions)
|
338
|
+
isPageLoaded : function(page)
|
339
|
+
{
|
340
|
+
return $('#' + page)[0] != null
|
341
|
+
},
|
342
|
+
|
343
|
+
checkConditional : function($element_li) {
|
344
|
+
matchable_answers = String($element_li.data('conditional_answer')).split(',').map(function(s) { return s.trim(); })
|
345
|
+
if ($element_li.hasClass('fe::choicefield') && $element_li.hasClass('yes-no')) {
|
346
|
+
if ($(matchable_answers).filter([1, '1', true, 'true', 'yes']).length > 0) {
|
347
|
+
matchable_answers = [1, '1', true, 'true', 'yes'];
|
348
|
+
}
|
349
|
+
vals = $([$element_li.find("input[type=radio]:checked").val()]);
|
350
|
+
} else if ($element_li.hasClass('fe::choicefield') && $element_li.hasClass('checkbox')) {
|
351
|
+
vals = $element_li.find("input[type=checkbox]:checked").map(function(i, el) { return $(el).val(); });
|
352
|
+
} else {
|
353
|
+
vals = $([$element_li.find("input:visible, select:visible").val()]);
|
354
|
+
}
|
355
|
+
match = $(matchable_answers).filter(vals).length > 0;
|
356
|
+
|
357
|
+
console.log('checkConditional match: ' + match);
|
358
|
+
|
359
|
+
switch ($element_li.data('conditional_type')) {
|
360
|
+
case 'Fe::Element':
|
361
|
+
if (match) {
|
362
|
+
$("#element_" + $element_li.data('conditional_id')).show();
|
363
|
+
} else {
|
364
|
+
$("#element_" + $element_li.data('conditional_id')).hide();
|
365
|
+
}
|
366
|
+
case 'Fe::Page':
|
367
|
+
li_id = "li#fe_application_" + $element_li.data('application_id') + '-fe_page_' + $element_li.data('conditional_id') + '-li';
|
368
|
+
if (match) {
|
369
|
+
$(li_id).show();
|
370
|
+
} else {
|
371
|
+
$(li_id).hide();
|
372
|
+
}
|
373
|
+
}
|
374
|
+
}
|
375
|
+
|
376
|
+
};
|
377
|
+
|
378
|
+
$(document).on('click', "li.conditional input, li.conditional select", function() {
|
379
|
+
console.log('click');
|
380
|
+
$.fe.pageHandler.checkConditional($(this).closest('li'));
|
381
|
+
});
|
382
|
+
$(document).on('keyup', "li.conditional input, li.conditional select", function() { $(this).click(); });
|
383
|
+
$(document).on('blug', "li.conditional input, li.conditional select", function() { $(this).click(); });
|
384
|
+
$(document).on('change', "li.conditional select", function() { $(this).click(); });
|
297
385
|
|
298
386
|
})(jQuery);
|
299
387
|
|
@@ -2,6 +2,10 @@
|
|
2
2
|
/* Summer Project Form Engines */
|
3
3
|
/* *********************************************************** */
|
4
4
|
|
5
|
+
/*
|
6
|
+
*= require jquery-ui
|
7
|
+
*/
|
8
|
+
|
5
9
|
/* RESET */
|
6
10
|
ul, li, body, p {
|
7
11
|
list-style: none;
|
@@ -90,24 +94,15 @@ ul#list-pages {
|
|
90
94
|
margin: 20px 0 0 0;
|
91
95
|
}
|
92
96
|
|
93
|
-
#list-pages li
|
94
|
-
|
95
|
-
padding: 8px 0 8px 24px;
|
96
|
-
border-bottom: 1px dotted #999;
|
97
|
-
display: block;
|
98
|
-
margin-right: 8px;
|
97
|
+
#list-pages li {
|
98
|
+
padding: 3px 0;
|
99
99
|
}
|
100
100
|
|
101
|
-
#list-pages li
|
102
|
-
|
101
|
+
#list-pages li a {
|
102
|
+
padding: 2px 0;
|
103
103
|
}
|
104
104
|
|
105
|
-
#list-pages li.active a {
|
106
|
-
margin-right: 0;
|
107
|
-
border: 1px solid #F7931E;
|
108
|
-
border-right: none;
|
109
|
-
margin-top: -1px;
|
110
|
-
}
|
105
|
+
#list-pages li.active a {}
|
111
106
|
|
112
107
|
#link-page-add {
|
113
108
|
background: #f0f0f0 url("<%= asset_path('fe/icons/add.png') %>") no-repeat 4px 50%;
|
@@ -193,7 +188,6 @@ ul#nav-controls li a:hover {
|
|
193
188
|
#preview {
|
194
189
|
width: 689px;
|
195
190
|
float: right;
|
196
|
-
border: 1px solid #F7931E;
|
197
191
|
padding: 10px;
|
198
192
|
}
|
199
193
|
|
@@ -546,7 +540,7 @@ td.actions a {padding: 2px 10px 2px 20px;}
|
|
546
540
|
padding: 5px;
|
547
541
|
|
548
542
|
ul {
|
549
|
-
|
550
|
-
|
543
|
+
color:red;
|
544
|
+
font-weight: bold;
|
551
545
|
}
|
552
|
-
}
|
546
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Fe::Admin::ElementsController < ApplicationController
|
2
2
|
before_filter :check_valid_user
|
3
|
-
layout 'fe.admin'
|
3
|
+
layout 'fe/fe.admin'
|
4
4
|
|
5
5
|
before_filter :get_page
|
6
6
|
|
@@ -157,9 +157,9 @@ class Fe::Admin::ElementsController < ApplicationController
|
|
157
157
|
if element.question_grid_id
|
158
158
|
element.set_position(element.question_grid.position(@page), @page)
|
159
159
|
element.question_grid_id = nil
|
160
|
-
elsif element.
|
160
|
+
elsif element.choice_field_id
|
161
161
|
element.set_position(element.choice_field.position(@page), @page)
|
162
|
-
element.
|
162
|
+
element.choice_field_id = nil
|
163
163
|
end
|
164
164
|
element.save!
|
165
165
|
render :action => :drop
|
@@ -179,7 +179,7 @@ class Fe::Admin::ElementsController < ApplicationController
|
|
179
179
|
end
|
180
180
|
|
181
181
|
def element_params
|
182
|
-
params.fetch(:element, {}).permit(:style, :label, :tooltip, :position, :source, :value_xpath, :text_xpath, :question_grid_id, :cols, :total_cols, :css_id, :css_class, :related_question_sheet_id, :conditional_id, :hide_option_labels, :slug, :required, :is_confidential, :hide_label, :object_name, :attribute_name, :max_length)
|
182
|
+
params.fetch(:element, {}).permit(:style, :label, :tooltip, :position, :source, :value_xpath, :text_xpath, :question_grid_id, :cols, :total_cols, :css_id, :css_class, :related_question_sheet_id, :conditional_id, :hide_option_labels, :slug, :required, :is_confidential, :hide_label, :object_name, :attribute_name, :max_length, :content, :conditional_type, :conditional_id, :conditional_answer)
|
183
183
|
end
|
184
184
|
|
185
185
|
end
|