fe 0.0.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +16 -36
- data/app/assets/javascripts/fe/admin.js +0 -1
- data/app/assets/javascripts/fe/fe.admin.js +40 -16
- data/app/assets/javascripts/fe/fe.common.js +48 -14
- data/app/assets/javascripts/fe/fe.public.js +1 -414
- data/app/assets/javascripts/fe/fe.public.nojquery.js +450 -0
- data/app/assets/javascripts/fe/jquery.validate.pack.js +3 -15
- data/app/assets/stylesheets/360front.css +0 -0
- data/app/assets/stylesheets/fe/fe.screen.css.scss.erb +69 -10
- data/app/controllers/fe/admin/elements_controller.rb +64 -48
- data/app/controllers/fe/admin/email_templates_controller.rb +2 -2
- data/app/controllers/fe/admin/question_pages_controller.rb +1 -1
- data/app/controllers/fe/admin/question_sheets_controller.rb +2 -103
- data/app/controllers/fe/concerns/admin/question_sheets_controller_concern.rb +112 -0
- data/app/controllers/fe/concerns/answer_pages_controller_concern.rb +2 -1
- data/app/controllers/fe/concerns/answer_sheets_controller_concern.rb +1 -1
- data/app/controllers/fe/concerns/application_controller_concern.rb +13 -0
- data/app/controllers/fe/reference_sheets_controller.rb +2 -0
- data/app/controllers/fe/references_controller.rb +1 -0
- data/app/helpers/fe/application_helper.rb +5 -0
- data/app/mailers/fe/notifier.rb +11 -4
- data/app/models/answer_sheet.rb +2 -0
- data/app/models/fe/application.rb +2 -1
- data/app/models/fe/concerns/answer_pages_presenter_concern.rb +10 -1
- data/app/models/fe/concerns/answer_sheet_concern.rb +38 -8
- data/app/models/fe/concerns/choice_field_concern.rb +17 -10
- data/app/models/fe/date_field.rb +1 -1
- data/app/models/fe/element.rb +105 -31
- data/app/models/fe/page.rb +52 -20
- data/app/models/fe/page_element.rb +6 -1
- data/app/models/fe/page_link.rb +6 -3
- data/app/models/fe/person.rb +11 -8
- data/app/models/fe/question.rb +2 -6
- data/app/models/fe/question_grid.rb +1 -1
- data/app/models/fe/question_grid_with_total.rb +15 -0
- data/app/models/fe/question_set.rb +1 -1
- data/app/models/fe/question_sheet.rb +15 -13
- data/app/models/fe/reference_question.rb +0 -10
- data/app/models/fe/reference_sheet.rb +17 -13
- data/app/models/staff.rb +2 -0
- data/app/validators/email_validator.rb +11 -0
- data/app/views/fe/admin/elements/create.js.erb +1 -0
- data/app/views/fe/admin/elements/drop.js.erb +1 -0
- data/app/views/fe/admin/elements/duplicate.js.erb +1 -0
- data/app/views/fe/admin/panels/_advanced_options.html.erb +9 -3
- data/app/views/fe/admin/panels/_common_fields.html.erb +19 -5
- data/app/views/fe/admin/panels/_page.html.erb +1 -1
- data/app/views/fe/admin/panels/_prop_choice_field.html.erb +20 -11
- data/app/views/fe/admin/panels/_prop_element.html.erb +2 -9
- data/app/views/fe/admin/panels/_prop_page.html.erb +8 -3
- data/app/views/fe/admin/panels/_prop_paragraph.html.erb +38 -24
- data/app/views/fe/admin/panels/_prop_section.html.erb +8 -2
- data/app/views/fe/admin/panels/_prop_sheet.html.erb +4 -1
- data/app/views/fe/admin/question_pages/_element.html.erb +11 -1
- data/app/views/fe/answer_pages/_answer_page.html.erb +9 -8
- data/app/views/fe/answer_pages/_element.html.erb +6 -7
- data/app/views/fe/answer_pages/_page_name.html.erb +1 -0
- data/app/views/fe/answer_pages/update.js.erb +3 -3
- data/app/views/fe/answer_sheets/_answer_sheet.html.erb +3 -3
- data/app/views/fe/answer_sheets/_element.html.erb +52 -34
- data/app/views/fe/answer_sheets/_incomplete.html.erb +1 -1
- data/app/views/fe/answer_sheets/_page_link.html.erb +2 -2
- data/app/views/fe/answer_sheets/_pages_list.html.erb +3 -3
- data/app/views/fe/answer_sheets/_submit_to.html.erb +1 -0
- data/app/views/fe/answer_sheets/edit.html.erb +14 -14
- data/app/views/fe/answer_sheets/incomplete.js.erb +3 -0
- data/app/views/fe/answer_sheets/index.html.erb +3 -3
- data/app/views/fe/answer_sheets/show.html.erb +1 -1
- data/app/views/fe/applications/_logout.html.erb +1 -0
- data/app/views/fe/applications/show.html.erb +1 -0
- data/app/views/fe/questions/fe/_acceptance.html.erb +3 -3
- data/app/views/fe/questions/fe/_attachment_field.html.erb +7 -3
- data/app/views/fe/questions/fe/_checkbox_field.html.erb +26 -24
- data/app/views/fe/questions/fe/_date_field.html.erb +1 -2
- data/app/views/fe/questions/fe/_date_field_mmyy.html.erb +2 -2
- data/app/views/fe/questions/fe/_drop_down_field.html.erb +3 -2
- data/app/views/fe/questions/fe/_paragraph.html.erb +1 -1
- data/app/views/fe/questions/fe/_question_grid.html.erb +14 -9
- data/app/views/fe/questions/fe/_question_grid_with_total.html.erb +21 -14
- data/app/views/fe/questions/fe/_questions.html.erb +2 -2
- data/app/views/fe/questions/fe/_radio_button_field.html.erb +12 -11
- data/app/views/fe/questions/fe/_rating.html.erb +9 -8
- 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 +22 -15
- data/app/views/fe/questions/fe/_reference_roommate.html.erb +1 -1
- data/app/views/fe/questions/fe/_reference_spiritual.html.erb +1 -1
- data/app/views/fe/questions/fe/_reference_staff.html.erb +1 -1
- data/app/views/fe/questions/fe/_section.html.erb +1 -1
- data/app/views/fe/questions/fe/_text_area_field.html.erb +10 -3
- data/app/views/fe/questions/fe/_text_field.html.erb +1 -1
- data/app/views/fe/questions/fe/_yes_no_field.erb +3 -3
- data/app/views/fe/reference_pages/_reference.html.erb +11 -11
- data/app/views/fe/reference_pages/edit.html.erb +7 -7
- data/app/views/fe/reference_sheets/done.html.erb +2 -2
- data/app/views/fe/reference_sheets/not_found.html.erb +4 -4
- data/app/views/fe/references/edit.html.erb +6 -6
- data/app/views/fe/references/show.html.erb +7 -7
- data/app/views/fe/references/submit.js.erb +1 -1
- 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/layouts/fe/_error_messages_for.html.erb +7 -0
- data/app/views/layouts/fe/application.html.erb +1 -1
- data/config/routes.rb +0 -36
- data/db/migrate/20131003044250_create_reference_sheets.rb +1 -0
- 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 +16 -0
- data/db/migrate/20140625160545_create_fe_users.rb +1 -1
- data/db/migrate/20150504221439_add_all_element_ids_to_pages.rb +5 -0
- data/db/migrate/20150713022326_add_locale_columns.rb +9 -0
- data/db/migrate/20150714220730_add_locale_to_answer_sheet.rb +5 -0
- data/db/migrate/20150928085325_change_pages_all_element_ids_to_text.rb +5 -0
- data/db/migrate/20150930191538_add_locale_to_reference_sheets.rb +5 -0
- data/lib/access_key_generator.rb +12 -0
- data/lib/distinct_distinct_patch.rb +20 -0
- data/lib/fe.rb +4 -0
- data/lib/fe/engine.rb +16 -4
- data/lib/fe/version.rb +1 -1
- data/spec/controllers/fe/admin/elements_controller_spec.rb +201 -1
- data/spec/controllers/fe/admin/email_templates_controller_spec.rb +26 -1
- data/spec/controllers/fe/admin/question_pages_controller_spec.rb +8 -1
- data/spec/controllers/fe/admin/question_sheets_controller_spec.rb +48 -1
- data/spec/controllers/fe/answer_pages_controller_spec.rb +73 -1
- data/spec/controllers/fe/answer_sheets_controller_spec.rb +80 -1
- data/spec/controllers/fe/reference_pages_controller.rb +4 -0
- data/spec/controllers/fe/references_controller_spec.rb +4 -0
- data/spec/controllers/fe/submit_pages_controller_spec.rb +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +9 -0
- data/spec/dummy/app/models/application.rb +3 -0
- data/spec/dummy/app/models/person.rb +11 -0
- data/spec/dummy/app/models/user.rb +3 -0
- data/spec/dummy/config/application.rb +2 -1
- data/spec/dummy/config/database.yml +20 -17
- data/spec/dummy/config/environments/production.rb +1 -5
- data/spec/dummy/config/environments/test.rb +3 -1
- data/spec/dummy/config/initializers/fast_gettext.rb +5 -0
- data/spec/dummy/config/secrets.yml +2 -2
- data/spec/dummy/db/migrate/20141203214017_core.fe_engine.rb +92 -0
- data/spec/dummy/db/migrate/20141203214018_create_reference_sheets.fe_engine.rb +25 -0
- data/spec/dummy/db/migrate/20141203214019_add_element_and_answer_fields.fe_engine.rb +11 -0
- data/spec/dummy/db/migrate/20141203214020_create_email_templates.fe_engine.rb +18 -0
- data/spec/dummy/db/migrate/20141203214021_add_max_lengths.fe_engine.rb +9 -0
- data/spec/dummy/db/migrate/20141203214022_create_join_table.fe_engine.rb +12 -0
- data/spec/dummy/db/migrate/20141203214023_remove_question_id_from_element.fe_engine.rb +10 -0
- data/spec/dummy/db/migrate/20141203214024_create_fe_people.fe_engine.rb +13 -0
- data/spec/dummy/db/migrate/20141203214025_create_fe_addresses.fe_engine.rb +21 -0
- data/{db/migrate/20140624182216_create_create_fe_phone_numbers.rb → spec/dummy/db/migrate/20141203214026_create_create_fe_phone_numbers.fe_engine.rb} +1 -0
- data/spec/dummy/db/migrate/20141203214027_create_fe_users.fe_engine.rb +13 -0
- data/spec/dummy/db/migrate/20141203214028_add_conditional_type_to_elements.fe_engine.rb +6 -0
- data/spec/dummy/db/migrate/20141203214029_add_conditional_answer_to_elements.fe_engine.rb +6 -0
- data/spec/dummy/db/migrate/20141203214030_remove_short_value_column.fe_engine.rb +6 -0
- data/spec/dummy/db/migrate/20141203214031_move_conditional_ids_used_for_choice_field_to_their_own_column.fe_engine.rb +8 -0
- data/spec/dummy/db/migrate/20150123215803_create_users.rb +9 -0
- data/spec/dummy/db/migrate/20150504222619_add_all_element_ids_to_pages.fe_engine.rb +6 -0
- data/spec/dummy/db/migrate/20150930190001_create_fe_phone_numbers.fe_engine.rb +20 -0
- data/spec/dummy/db/migrate/20150930190002_add_locale_columns.fe_engine.rb +10 -0
- data/spec/dummy/db/migrate/20150930190003_add_locale_to_answer_sheet.fe_engine.rb +6 -0
- data/spec/dummy/db/migrate/20150930190004_change_pages_all_element_ids_to_text.fe_engine.rb +6 -0
- data/spec/dummy/db/migrate/20150930191756_add_locale_to_reference_sheets.fe_engine.rb +6 -0
- data/spec/dummy/db/schema.rb +50 -20
- data/spec/dummy/log/development.log +5 -0
- data/spec/factories/applications.rb +0 -1
- data/spec/factories/dummy_applications.rb +6 -0
- data/spec/factories/dummy_people.rb +6 -0
- data/spec/factories/dummy_users.rb +6 -0
- data/spec/factories/elements.rb +28 -3
- data/spec/factories/email_templates.rb +5 -0
- data/spec/factories/fe_email_templates.rb +9 -0
- data/spec/factories/fe_people.rb +0 -2
- data/spec/factories/fe_user.rb +6 -0
- data/spec/factories/question_sheet.rb +1 -1
- data/spec/factories/reference_sheets.rb +9 -0
- data/spec/mailers/fe/notifier_spec.rb +39 -0
- data/spec/models/fe/choice_field_spec.rb +20 -0
- data/spec/models/fe/element_spec.rb +185 -0
- data/spec/models/fe/page_spec.rb +112 -0
- data/spec/models/fe/question_sheet_spec.rb +106 -0
- data/spec/models/fe/reference_sheet_spec.rb +20 -0
- data/spec/rails_helper.rb +41 -13
- data/spec/support/choices.xml +6 -0
- metadata +136 -48
- data/app/assets/javascripts/fe/rails.extra.js +0 -6
- data/app/controllers/fe/applications_controller.rb +0 -183
- data/app/controllers/fe/payments_controller.rb +0 -184
- data/app/models/fe/payment.rb +0 -77
- data/app/models/fe/payment_question.rb +0 -22
- data/app/views/fe/admin/panels/_prop_payment_question.html.erb +0 -1
- data/app/views/fe/application/_logout.html.erb +0 -1
- data/app/views/fe/payment_pages/_credit.html.erb +0 -47
- data/app/views/fe/payment_pages/_mail.html.erb +0 -27
- data/app/views/fe/payment_pages/_payment.html.erb +0 -6
- data/app/views/fe/payment_pages/_staff.html.erb +0 -25
- data/app/views/fe/payment_pages/_staff_results.html.erb +0 -17
- data/app/views/fe/payment_pages/edit.html.erb +0 -75
- data/app/views/fe/payment_pages/staff_search.js.erb +0 -2
- data/app/views/fe/payments/_credit.html.erb +0 -47
- data/app/views/fe/payments/_errors.html.erb +0 -1
- data/app/views/fe/payments/_payment.html.erb +0 -13
- data/app/views/fe/payments/_staff.html.erb +0 -21
- data/app/views/fe/payments/_staff_results.html.erb +0 -18
- data/app/views/fe/payments/approve.js.erb +0 -3
- data/app/views/fe/payments/create.js.erb +0 -19
- data/app/views/fe/payments/destroy.js.erb +0 -7
- data/app/views/fe/payments/edit.html.erb +0 -56
- data/app/views/fe/payments/error.js.erb +0 -3
- data/app/views/fe/payments/no_access.html.erb +0 -7
- data/app/views/fe/payments/staff_search.js.erb +0 -1
- data/app/views/fe/payments/update.html.erb +0 -24
- data/app/views/fe/questions/fe/_payment_question.html.erb +0 -70
- data/db/migrate/20140828045339_create_payments.rb +0 -13
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/factories/payments.rb +0 -7
- data/spec/models/fe/payment_question_spec.rb +0 -65
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7be29ca99d6897702864247f44659b07068b917d
|
4
|
+
data.tar.gz: 3a4b5b1401e357ca9b4fdd5a9d65c49083fbda89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f480268cc6bac72b46ff5e19debbd5114997f39cba51f48e57972b84fae257e3ad7289c6af4c890f7a159dedb97f88d1c98c6828e1286f1e23a83f7d289668ac
|
7
|
+
data.tar.gz: ffa4819032a0495515a75d28e83bb2bc3e6d26615046b26fd4a6fd10bc90fb3e35c9984792d912e11c7e9a3a9e3e3639a86a9fa41f2686e1ee32d6b4a7d3694e
|
data/Rakefile
CHANGED
@@ -4,54 +4,34 @@ require 'thor'
|
|
4
4
|
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
5
5
|
load 'rails/tasks/engine.rake' if File.exists? 'spec/dummy/Rakefile'
|
6
6
|
|
7
|
-
|
8
7
|
Bundler::GemHelper.install_tasks
|
9
8
|
|
10
|
-
ENV['ENGINE'] = 'fe_engine'
|
11
|
-
|
12
9
|
require "rspec/core/rake_task"
|
13
10
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
14
|
-
unless File.directory?("spec/dummy")
|
15
|
-
Rake::Task['dummy:app'].invoke unless ENV['SKIP_DUMMY_APP']
|
16
|
-
end
|
17
11
|
spec.rspec_opts = "-I #{File.expand_path('../spec/', __FILE__)}"
|
18
12
|
spec.pattern = FileList[File.expand_path('../spec/**/*_spec.rb', __FILE__)]
|
19
13
|
end
|
20
14
|
task default: :spec
|
21
15
|
|
22
|
-
|
23
|
-
require 'rails/dummy/tasks'
|
24
|
-
|
25
|
-
# ENV['ENGINE']
|
26
|
-
# ENV['TEMPLATE']
|
27
|
-
|
28
|
-
task :setup_dummy_app do
|
29
|
-
# Nuke any previous testing envs (for local development purposes).
|
30
|
-
FileUtils.remove_dir("spec/dummy", force=true) if Dir.exists? "spec/dummy"
|
31
|
-
|
32
|
-
# Use system here (rather than Rake::Task['task'].invoke) so a new rails env
|
33
|
-
# is created, in which the dummy app's module name is no longer present.
|
34
|
-
# If we did, Rake::Task["task"].invoke, the dummy app would not be created
|
35
|
-
# because the "deleted" spec/dummy would still have it's "Dummy" rails app
|
36
|
-
# name in the Ruby VM environment.
|
37
|
-
#
|
38
|
-
system({"DISABLE_MIGRATE" => "true",
|
39
|
-
"DISABLE_CREATE" => "true"}, "rake dummy:app")
|
40
|
-
|
41
|
-
# Bring in the customized mysql/postgres testing database.yml.
|
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)
|
45
|
-
|
46
|
-
Rake::Task["install_engine"].invoke
|
47
|
-
end
|
48
|
-
|
49
|
-
task :install_engine do
|
16
|
+
task :setup_db do
|
50
17
|
# Use system so that we load the dummy app's Rake commands.
|
51
18
|
|
52
19
|
# 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')
|
20
|
+
system('cd spec/dummy && RAILS_ENV=test bundle exec rake db:drop >/dev/null 2>&1')
|
54
21
|
|
55
22
|
# Use system so that we funcitonally test the install generator.
|
56
|
-
system("cd spec/dummy && rake db:create &&
|
23
|
+
system("cd spec/dummy && RAILS_ENV=test bundle exec rake db:create && RAILS_ENV=test bundle exec rake db:migrate")
|
24
|
+
end
|
25
|
+
|
26
|
+
require 'rails/dummy/tasks'
|
27
|
+
|
28
|
+
task :skip_concerns do
|
29
|
+
ENV['SKIP_CONCERNS'] = 'true'
|
57
30
|
end
|
31
|
+
task :skip_decorators do
|
32
|
+
ENV['SKIP_DECORATORS'] = 'true'
|
33
|
+
end
|
34
|
+
|
35
|
+
task :spec => [ :skip_concerns, :skip_decorators ]
|
36
|
+
|
37
|
+
|
@@ -1,11 +1,29 @@
|
|
1
1
|
$(function() {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
setUpJsHelpers();
|
3
|
+
$(document).on('ajaxStart', function() {
|
4
|
+
$('#status').show();
|
5
|
+
}).on('ajaxComplete', function() {
|
6
|
+
$('#status').hide();
|
6
7
|
setUpJsHelpers();
|
7
8
|
});
|
8
|
-
|
9
|
+
|
10
|
+
$(document).on('click', '.link-show-xml', function() {
|
11
|
+
div = $(this).closest('.choices_section')
|
12
|
+
$('.xmlChoices', div).show();
|
13
|
+
$('.link-show-csv', div).show();
|
14
|
+
$('.link-show-xml', div).hide();
|
15
|
+
$('.csvChoices', div).hide();
|
16
|
+
});
|
17
|
+
|
18
|
+
$(document).on('click', '.link-show-csv', function() {
|
19
|
+
div = $(this).closest('.choices_section')
|
20
|
+
$('.csvChoices', div).show();
|
21
|
+
$('.link-show-xml', div).show();
|
22
|
+
$('.link-show-csv', div).hide();
|
23
|
+
$('.xmlChoices', div).hide();
|
24
|
+
});
|
25
|
+
|
26
|
+
|
9
27
|
$(document).on('click', '.lbOn', function() {
|
10
28
|
if ($('#dialog-help')[0] == null) {
|
11
29
|
$('body').append('<div id="dialog-help" style="display:none" title="Help!"><p><span id="dialog-help-message"></span></p></div>');
|
@@ -24,7 +42,7 @@ $(function() {
|
|
24
42
|
});
|
25
43
|
return false;
|
26
44
|
});
|
27
|
-
|
45
|
+
|
28
46
|
$(document).on('click', '.close_prop', function() {
|
29
47
|
$('#element_form_' + $(this).attr('data-dom_id')).hide();
|
30
48
|
$('#element_' + $(this).attr('data-dom_id')).show();
|
@@ -33,9 +51,12 @@ $(function() {
|
|
33
51
|
|
34
52
|
$(document).on('click', 'input[name=future_affect][type=radio]', function() {
|
35
53
|
if ($(this).val() == "yes") {
|
36
|
-
$(".future_answer, .future_target").show();
|
54
|
+
$(".future_answer, .future_target, .future_page").show();
|
37
55
|
} else if ($(this).val() == "no") {
|
38
|
-
$(".future_answer, .future_target").hide();
|
56
|
+
$(".future_answer, .future_target, .future_page").hide();
|
57
|
+
$('#element_conditional_id').val('');
|
58
|
+
$(".future_target input").removeAttr("checked");
|
59
|
+
$("#element_conditional_type_").attr("checked", "checked");
|
39
60
|
}
|
40
61
|
});
|
41
62
|
|
@@ -55,6 +76,9 @@ function switchTab(toTab) {
|
|
55
76
|
if(currentTab != null) $('#tab-' + currentTab).removeClass('active');
|
56
77
|
$('#tab-' + toTab).addClass('active');
|
57
78
|
currentTab = toTab;
|
79
|
+
if (toTab == 'pages_list') {
|
80
|
+
setUpSortables();
|
81
|
+
}
|
58
82
|
}
|
59
83
|
|
60
84
|
function selectPage() {
|
@@ -62,7 +86,7 @@ function selectPage() {
|
|
62
86
|
clearCurrentElement();
|
63
87
|
el.addClass('active');
|
64
88
|
switchTab('properties');
|
65
|
-
|
89
|
+
|
66
90
|
if($('#page_label').length > 0) $('#page_label').focus();
|
67
91
|
}
|
68
92
|
|
@@ -74,12 +98,12 @@ function selectElement(id) {
|
|
74
98
|
// snapElementProperties(el);
|
75
99
|
activeElement = id;
|
76
100
|
switchTab('properties');
|
77
|
-
|
101
|
+
|
78
102
|
// if( $('#element_label')) $('#element_label').focus();
|
79
103
|
}
|
80
104
|
|
81
105
|
function clearCurrentElement() {
|
82
|
-
if (activeElement != '' && $(activeElement)) {
|
106
|
+
if (activeElement != '' && $(activeElement)) {
|
83
107
|
$(activeElement).removeClass('active');
|
84
108
|
}
|
85
109
|
}
|
@@ -94,8 +118,8 @@ function snapElementProperties(el) {
|
|
94
118
|
$('#panel-properties-element').css({'margin-top': propsTop});
|
95
119
|
}
|
96
120
|
|
97
|
-
function scrollToElement(id) {
|
98
|
-
$(id).scrollTo();
|
121
|
+
function scrollToElement(id) {
|
122
|
+
$(id).scrollTo();
|
99
123
|
}
|
100
124
|
|
101
125
|
function addError(id) {
|
@@ -107,10 +131,10 @@ function updateSlug(source, dest) {
|
|
107
131
|
label = $F(source)
|
108
132
|
slug = $F(dest)
|
109
133
|
if( label == null || slug == null) return; // oh oh
|
110
|
-
|
134
|
+
|
111
135
|
label = label.strip();
|
112
136
|
slug = slug.strip();
|
113
|
-
|
137
|
+
|
114
138
|
if( label != '' && slug == '' ) { // if slug is empty lets copy label to it
|
115
139
|
slug = label.toLowerCase();
|
116
140
|
slug = slug.gsub(/[^a-z0-9]/, '_'); // only alpha-numeric
|
@@ -118,7 +142,7 @@ function updateSlug(source, dest) {
|
|
118
142
|
slug = slug.gsub(/_$/, ''); // remove trailing underscores
|
119
143
|
slug = slug.gsub(/^([0-9])/, '_\1') // can't begin with a digit, so preprend an underscore
|
120
144
|
if( slug.length > 36 ) slug = slug.slice(0, 36) // max length
|
121
|
-
|
145
|
+
|
122
146
|
$(dest).value = slug
|
123
147
|
$(dest).focus();
|
124
148
|
}
|
@@ -1,35 +1,69 @@
|
|
1
1
|
function setUpSortables() {
|
2
|
-
$('[data-sortable]').sortable({axis:'y',
|
3
|
-
|
2
|
+
$('[data-sortable]').sortable({axis:'y',
|
3
|
+
items: '> li.sortable',
|
4
|
+
dropOnEmpty:false,
|
4
5
|
update: function(event, ui) {
|
5
6
|
sortable = this;
|
6
7
|
$.ajax({data:$(this).sortable('serialize',{key:sortable.id + '[]'}),
|
7
|
-
complete: function(request) {$(sortable).effect('highlight')},
|
8
|
-
success:function(request){$('#errors').html(request)},
|
9
|
-
type:'POST',
|
8
|
+
complete: function(request) {$(sortable).effect('highlight')},
|
9
|
+
success:function(request){$('#errors').html(request)},
|
10
|
+
type:'POST',
|
10
11
|
url: $(sortable).attr('data-sortable-url')
|
11
12
|
})
|
12
|
-
}
|
13
|
+
},
|
14
|
+
stop: function(event, ui) {
|
15
|
+
before_dropper = $('li.before-container[data-element_id="'+ui.item.data('element_id'));
|
16
|
+
if (before_dropper.length > 0) {
|
17
|
+
before_dropper.detach();
|
18
|
+
before_dropper.insertBefore(ui.item);
|
19
|
+
}
|
20
|
+
after_dropper = $('li.after-container[data-element_id="'+ui.item.data('element_id'));
|
21
|
+
if (after_dropper.length > 0) {
|
22
|
+
after_dropper.detach();
|
23
|
+
after_dropper.insertAfter(ui.item);
|
24
|
+
}
|
25
|
+
}
|
13
26
|
});
|
14
27
|
$('[data-sortable][data-sortable-handle]').each(function() {
|
15
28
|
handle = $(this).attr('data-sortable-handle');
|
16
29
|
$(this).sortable("option", "handle", handle);
|
17
30
|
});
|
18
|
-
|
19
|
-
|
31
|
+
|
20
32
|
$('.droppable').droppable({
|
21
33
|
activeClass: 'droppable-active',
|
34
|
+
hoverClass: 'droppable-hover',
|
22
35
|
drop: function( event, ui ) {
|
23
36
|
$.post($(this).attr('data-url'), {draggable_element: ui.draggable.attr('id')}, function() {}, 'script')
|
24
|
-
}
|
37
|
+
},
|
38
|
+
activate: function( event, ui ) {
|
39
|
+
$draggable = ui.draggable;
|
40
|
+
$container = $draggable.parents("li.element.container")
|
41
|
+
if ($container.length == 1) {
|
42
|
+
$container.parent().find('li.around-container[data-element_id="'+$container.data('element_id')+'"]').addClass('droppable-active')
|
43
|
+
} else {
|
44
|
+
$('li.around-container').removeClass('droppable-active');
|
45
|
+
}
|
46
|
+
},
|
47
|
+
deactivate: function( event, ui ) {
|
48
|
+
$draggable = ui.draggable;
|
49
|
+
$container = $draggable.parents("li.element.container")
|
50
|
+
if ($container.length == 1) {
|
51
|
+
$container.parent().find('li.around-container[data-element_id="'+$container.data('element_id')+'"]').removeClass('droppable-active')
|
52
|
+
} else {
|
53
|
+
$('li.around-container').removeClass('droppable-active');
|
54
|
+
}
|
55
|
+
}
|
25
56
|
});
|
26
57
|
}
|
27
58
|
|
28
59
|
function setUpCalendars() {
|
29
60
|
now = new Date();
|
30
61
|
year = now.getFullYear() + 10;
|
31
|
-
$('[data-calendar]').datepicker({
|
32
|
-
|
62
|
+
$('[data-calendar]').datepicker({
|
63
|
+
changeYear:true,
|
64
|
+
yearRange: '1950:' + year,
|
65
|
+
dateFormat: 'yy-mm-dd'
|
66
|
+
})
|
33
67
|
}
|
34
68
|
|
35
69
|
function setUpJsHelpers() {
|
@@ -37,7 +71,7 @@ function setUpJsHelpers() {
|
|
37
71
|
// Sortable
|
38
72
|
setUpSortables();
|
39
73
|
// ==================
|
40
|
-
|
74
|
+
|
41
75
|
// ==================
|
42
76
|
// Calendar
|
43
77
|
setUpCalendars();
|
@@ -50,8 +84,8 @@ function fixGridColumnWidths() {
|
|
50
84
|
num_columns = $(grid).find("th").length;
|
51
85
|
if (num_columns > 0) {
|
52
86
|
width = (100 / num_columns) + "%";
|
53
|
-
$(grid).find("th").css("width", width);
|
54
|
-
$(grid).find("td").css("width", width);
|
87
|
+
$(grid).find("> tbody > tr > th").css("width", width);
|
88
|
+
$(grid).find("> tbody > tr > td").css("width", width);
|
55
89
|
}
|
56
90
|
});
|
57
91
|
};
|
@@ -1,419 +1,6 @@
|
|
1
1
|
//= require jquery
|
2
2
|
//= require jquery_ujs
|
3
3
|
//= require jquery-ui
|
4
|
-
//= require fe/fe.common.js
|
5
4
|
//= require fe/jquery.scrollTo-min.js
|
6
|
-
//= require fe/rails.extra.js
|
7
5
|
//= require fe/jquery.validate.pack.js
|
8
|
-
|
9
|
-
// used by answer sheets
|
10
|
-
|
11
|
-
(function($) {
|
12
|
-
//debugger;
|
13
|
-
$(function() {
|
14
|
-
|
15
|
-
$(document).on('click', '.save_button', function() {
|
16
|
-
$.fe.pageHandler.savePage($(this).closest('.answer-page'), true);
|
17
|
-
});
|
18
|
-
|
19
|
-
//debugger;
|
20
|
-
$(document).on('keydown', '#payment_staff_first, #payment_staff_last', function(e) {
|
21
|
-
//debugger;
|
22
|
-
if (e.which == 13) {
|
23
|
-
console.log('staff_search click');
|
24
|
-
$('#staff_search').trigger('click');
|
25
|
-
return false;
|
26
|
-
}
|
27
|
-
|
28
|
-
});
|
29
|
-
$(document).on('click', '.reference_send_invite', function() {
|
30
|
-
var el = this;
|
31
|
-
var data = $(el).closest('form').serializeArray();
|
32
|
-
|
33
|
-
data.push({name: 'answer_sheet_type', value: answer_sheet_type});
|
34
|
-
$.ajax({url: $(el).attr('href'), data: data, dataType: 'script', type: 'POST',
|
35
|
-
beforeSend: function (xhr) {
|
36
|
-
$('body').trigger('ajax:loading', xhr);
|
37
|
-
},
|
38
|
-
complete: function (xhr) {
|
39
|
-
$('body').trigger('ajax:complete', xhr);
|
40
|
-
},
|
41
|
-
error: function (xhr, status, error) {
|
42
|
-
$('body').trigger('ajax:failure', [xhr, status, error]);
|
43
|
-
}
|
44
|
-
});
|
45
|
-
return false;
|
46
|
-
});
|
47
|
-
$(document).on('focus', 'textarea[maxlength]', function() {
|
48
|
-
var max = parseInt($(this).attr('maxlength'));
|
49
|
-
$(this).parent().find('.charsRemaining').html('You have ' + (max - $(this).val().length) + ' characters remaining');
|
50
|
-
}).on('keyup', 'textarea[maxlength]', function(){
|
51
|
-
var max = parseInt($(this).attr('maxlength'));
|
52
|
-
if($(this).val().length > max){
|
53
|
-
$(this).val($(this).val().substr(0, $(this).attr('maxlength')));
|
54
|
-
}
|
55
|
-
$(this).parent().find('.charsRemaining').html('You have ' + (max - $(this).val().length) + ' characters remaining');
|
56
|
-
}).on('blur', 'textarea[maxlength]', function() {
|
57
|
-
$(this).parent().find('.charsRemaining').html('');
|
58
|
-
});
|
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
|
-
|
87
|
-
});
|
88
|
-
$.fe = {};
|
89
|
-
$.fe.pageHandler = {
|
90
|
-
initialize : function(page) {
|
91
|
-
this.auto_save_frequency = 30; // seconds
|
92
|
-
this.timer_id = null;
|
93
|
-
this.suspendLoad = false;
|
94
|
-
|
95
|
-
this.current_page = page;
|
96
|
-
$('#' + page).data('form_data', this.captureForm($('#' + page)));
|
97
|
-
this.registerAutoSave();
|
98
|
-
|
99
|
-
this.page_validation = {}; // validation objects for each page
|
100
|
-
this.enableValidation(page);
|
101
|
-
|
102
|
-
// this.background_load = false;
|
103
|
-
// this.final_submission = false;
|
104
|
-
},
|
105
|
-
|
106
|
-
// swap to a different page
|
107
|
-
showPage : function(page) {
|
108
|
-
// hide the old
|
109
|
-
$('#' + this.current_page + '-li').removeClass('active');
|
110
|
-
$('#' + this.current_page).hide();
|
111
|
-
|
112
|
-
// HACK: Need to clear the main error message when returning to the submit page
|
113
|
-
// It is very confusing to users to be there when they revisit the page
|
114
|
-
if ((page=='submit_page') && ($('#submit_message')[0] != null)) $('#submit_message').hide();
|
115
|
-
if ((page=='submit_page') && ($('#application_errors')[0] != null)) $('#application_errors').html('');
|
116
|
-
|
117
|
-
// show the new
|
118
|
-
// $('#' + page + '-li').removeClass('incomplete');
|
119
|
-
// $('#' + page + '-li').removeClass('valid');
|
120
|
-
$('#' + page + '-li').addClass('active');
|
121
|
-
$('#' + page).show();
|
122
|
-
this.current_page = page;
|
123
|
-
this.registerAutoSave(page);
|
124
|
-
this.suspendLoad = false;
|
125
|
-
fixGridColumnWidths();
|
126
|
-
},
|
127
|
-
|
128
|
-
// callback onSuccess
|
129
|
-
pageLoaded : function(response) {
|
130
|
-
// var response = new String(transport.responseText);
|
131
|
-
var match = response.match(/<div id=\"(.*?)\"/i); // what did I just load? parse out the first div id
|
132
|
-
if( match != null )
|
133
|
-
{
|
134
|
-
var page = match[1];
|
135
|
-
$('#preview').append(response);
|
136
|
-
// if(this.background_load) $('#' + page).hide(); else
|
137
|
-
$.fe.pageHandler.showPage(page); // show after load, unless loading in background
|
138
|
-
setUpJsHelpers();
|
139
|
-
$.fe.pageHandler.enableValidation(page);
|
140
|
-
// $.fe.pageHandler.validatePage('#' + page);
|
141
|
-
$('#' + page).data('form_data', $.fe.pageHandler.captureForm($('#' + page)));
|
142
|
-
}
|
143
|
-
$('#page_ajax_spinner').hide();
|
144
|
-
$('.reference_send_invite').button();
|
145
|
-
updateTotals();
|
146
|
-
},
|
147
|
-
|
148
|
-
loadPage : function(page, url) {
|
149
|
-
if (!this.suspendLoad) {
|
150
|
-
this.suspendLoad = true; // don't load a page if one is currently loading (prevent double-click behavior where two pages end up visible!)
|
151
|
-
|
152
|
-
this.unregisterAutoSave(); // don't auto-save while loading/saving
|
153
|
-
// will register auto-save on new page once loaded/shown
|
154
|
-
|
155
|
-
$.scrollTo('#main');
|
156
|
-
|
157
|
-
this.validatePage(this.current_page); // mark current page as valid (or not) as we're leaving
|
158
|
-
|
159
|
-
this.savePage();
|
160
|
-
|
161
|
-
if( $.fe.pageHandler.isPageLoaded(page) && page.match('no_cache') == null ) // if already loaded (element exists) excluding pages that need reloading
|
162
|
-
{
|
163
|
-
$.fe.pageHandler.showPage(page);
|
164
|
-
$('#page_ajax_spinner').hide();
|
165
|
-
}
|
166
|
-
else
|
167
|
-
{
|
168
|
-
$.ajax({
|
169
|
-
url: url,
|
170
|
-
type: 'GET',
|
171
|
-
data: {'answer_sheet_type':answer_sheet_type},
|
172
|
-
success: $.fe.pageHandler.pageLoaded,
|
173
|
-
error: function (xhr, status, error) {
|
174
|
-
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.");
|
175
|
-
document.location = document.location;
|
176
|
-
},
|
177
|
-
beforeSend: function (xhr) {
|
178
|
-
$('body').trigger('ajax:loading', xhr);
|
179
|
-
},
|
180
|
-
complete: function (xhr) {
|
181
|
-
$('body').trigger('ajax:complete', xhr);
|
182
|
-
}
|
183
|
-
});
|
184
|
-
// new Ajax.Request(url, {asynchronous:true, evalScripts:false, method:'get',
|
185
|
-
// onSuccess:this.pageLoaded.bind(this)});
|
186
|
-
}
|
187
|
-
}
|
188
|
-
},
|
189
|
-
|
190
|
-
// save form if any changes were made
|
191
|
-
savePage : function(page, force) {
|
192
|
-
if (page == null) page = $('#' + this.current_page);
|
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
|
-
},
|
219
|
-
|
220
|
-
savePages : function(force) {
|
221
|
-
$('.answer-page').each(function() {$.fe.pageHandler.savePage($(this), force)})
|
222
|
-
},
|
223
|
-
|
224
|
-
// setup a timer to auto-save (only one timer, for the page being viewed)
|
225
|
-
registerAutoSave: function(page) {
|
226
|
-
this.timer_id = setInterval(this.savePages, this.auto_save_frequency * 1000);
|
227
|
-
},
|
228
|
-
|
229
|
-
unregisterAutoSave: function() {
|
230
|
-
if( this.timer_id != null )
|
231
|
-
{
|
232
|
-
clearInterval(this.timer_id);
|
233
|
-
this.timer_id = null;
|
234
|
-
}
|
235
|
-
},
|
236
|
-
|
237
|
-
// serialize form data and extract url to post to
|
238
|
-
captureForm : function(page) {
|
239
|
-
form_el = $('#' + page.attr('id') + '-form');
|
240
|
-
if( form_el[0] == null ) return null;
|
241
|
-
return {url: form_el.attr('action'), data: form_el.serialize() + '&answer_sheet_type=' + answer_sheet_type};
|
242
|
-
},
|
243
|
-
|
244
|
-
|
245
|
-
// enable form validation (when form is loaded)
|
246
|
-
enableValidation : function(page) {
|
247
|
-
$('#' + page + '-form').validate({onsubmit:false, focusInvalid:true, onfocusout: function(element) { this.element(element);}});
|
248
|
-
// $('#' + page + '-form').valid();
|
249
|
-
},
|
250
|
-
|
251
|
-
validatePage : function(page) {
|
252
|
-
try {
|
253
|
-
var li = $('#' + page + '-li');
|
254
|
-
var form = $('#' + page + '-form');
|
255
|
-
|
256
|
-
valid = form.valid();
|
257
|
-
// Move radio button errors up
|
258
|
-
$('input[type=radio].error').closest('tr').addClass('error');
|
259
|
-
$('.choice_field input[type=radio].error').removeClass('error')
|
260
|
-
.closest('.choice_field')
|
261
|
-
.addClass('error');
|
262
|
-
$('div.yesno label.error').hide();
|
263
|
-
|
264
|
-
if(valid) {
|
265
|
-
el.removeClass('incomplete');
|
266
|
-
el.addClass('complete');
|
267
|
-
} else {
|
268
|
-
el.removeClass('complete');
|
269
|
-
el.addClass('incomplete');
|
270
|
-
}
|
271
|
-
return valid;
|
272
|
-
}
|
273
|
-
catch(err) {
|
274
|
-
|
275
|
-
// If the user clicks too quickly, sometimes the page element isn't properly defined yet.
|
276
|
-
// If we don't catch the error, js stops execution. If we catch it, the user just has to click again.
|
277
|
-
}
|
278
|
-
$('page_ajax_spinner').hide();
|
279
|
-
},
|
280
|
-
|
281
|
-
// callback when falls to 0 active Ajax requests
|
282
|
-
completeAll : function()
|
283
|
-
{
|
284
|
-
$('#submit_button').attr('disabled', true)
|
285
|
-
$('#submit_message').html('');
|
286
|
-
$('#submit_message').hide();
|
287
|
-
// validate all the pages
|
288
|
-
$('.page_link').each(function(index, page) {
|
289
|
-
$.fe.pageHandler.validatePage($(page).attr('data-page-id'));
|
290
|
-
});
|
291
|
-
var all_valid = ($('#list-pages li.incomplete').length == 0);
|
292
|
-
|
293
|
-
// Make sure any necessary payments are made
|
294
|
-
var payments_made = $('.payment_question.required').length <= $('.payment').length
|
295
|
-
|
296
|
-
|
297
|
-
if( payments_made)
|
298
|
-
{
|
299
|
-
this.savePage($('#' + $.fe.pageHandler.current_page)); // in case any input fields on submit_page
|
300
|
-
|
301
|
-
// submit the application
|
302
|
-
if($('#submit_to')[0] != null)
|
303
|
-
{
|
304
|
-
url = $('#submit_to').val();
|
305
|
-
// clear out pages array to force reload. This enables "frozen" apps
|
306
|
-
// immediately after submission - :onSuccess (for USCM which stays in the application vs. redirecting to the dashboard)
|
307
|
-
var curr = $.fe.pageHandler.current_page;
|
308
|
-
$.ajax({url: url, dataType:'script',
|
309
|
-
data: {answer_sheet_type: answer_sheet_type},
|
310
|
-
type:'post',
|
311
|
-
beforeSend: function(xhr) {
|
312
|
-
$('body').trigger('ajax:loading', xhr);
|
313
|
-
},
|
314
|
-
success: function(xhr) {
|
315
|
-
$('#list-pages a').each(function() {
|
316
|
-
if ($(this).attr('data-page-id') != curr) $('#' + $(this).attr('data-page-id')).remove();
|
317
|
-
})
|
318
|
-
},
|
319
|
-
complete: function(xhr) {
|
320
|
-
$('body').trigger('ajax:complete', xhr);
|
321
|
-
var btn = $('#submit_button');
|
322
|
-
if (btn) { btn.attr('disabled', false); }
|
323
|
-
}
|
324
|
-
});
|
325
|
-
}
|
326
|
-
}
|
327
|
-
else
|
328
|
-
{
|
329
|
-
// some pages aren't valid
|
330
|
-
$('#submit_message').html("Please make a payment");
|
331
|
-
$('#submit_message').show();
|
332
|
-
|
333
|
-
var btn = $('#submit_button'); if (btn) { btn.attr('disabled', false); }
|
334
|
-
}
|
335
|
-
},
|
336
|
-
|
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(); });
|
385
|
-
|
386
|
-
})(jQuery);
|
387
|
-
|
388
|
-
$(function() {
|
389
|
-
fixGridColumnWidths();
|
390
|
-
});
|
391
|
-
|
392
|
-
|
393
|
-
function updateTotal(id) {
|
394
|
-
try {
|
395
|
-
total = 0;
|
396
|
-
$(".col_" + id ).each(function(e) {
|
397
|
-
total += Number(e.val());
|
398
|
-
});
|
399
|
-
$('#total_' + id).val(total);
|
400
|
-
} catch(e) {}
|
401
|
-
}
|
402
|
-
|
403
|
-
function submitToFrame(id, url)
|
404
|
-
{
|
405
|
-
form = $('<form method="post" action="'+url+'.js" endtype="multipart/form-data"></form>')
|
406
|
-
var csrf_token = $('meta[name=csrf-token]').attr('content'),
|
407
|
-
csrf_param = $('meta[name=csrf-param]').attr('content'),
|
408
|
-
dom_id = '#attachment_field_' + id,
|
409
|
-
metadata_input = '<input name="'+csrf_param+'" value="'+csrf_token+'" type="hidden" />',
|
410
|
-
file_field = '<input type="file" name="answers['+ id + ']>';
|
411
|
-
if ($(dom_id).val() == '') return;
|
412
|
-
form.hide()
|
413
|
-
.append(metadata_input)
|
414
|
-
.append(file_field)
|
415
|
-
.appendTo('body');
|
416
|
-
$(dom_id + "-spinner").show();
|
417
|
-
form.submit();
|
418
|
-
return false
|
419
|
-
}
|
6
|
+
//= require fe/fe.public.nojquery.js
|