artfully_ose 1.2.0.beta.1 → 1.2.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +9 -9
- data/app/assets/fonts/FontAwesome.otf +0 -0
- data/app/assets/fonts/fontawesome-webfont.eot +0 -0
- data/app/assets/fonts/fontawesome-webfont.svg +252 -472
- data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/app/assets/fonts/fontawesome-webfont.woff +0 -0
- data/app/assets/images/person-default-avatar.psd +0 -0
- data/app/assets/javascripts/application.js +10 -163
- data/app/assets/javascripts/box-office.js +262 -0
- data/app/assets/javascripts/custom/inline-people-search.js +40 -40
- data/app/assets/javascripts/custom/people.js +5 -68
- data/app/assets/javascripts/custom/prices.js +0 -1
- data/app/assets/javascripts/custom/show.js +8 -18
- data/app/assets/javascripts/jquery-lib/jquery.mask-money.js +0 -1
- data/app/assets/javascripts/locationselector.js +1 -1
- data/app/assets/javascripts/store/jquery.validate.additional-methods.js +159 -476
- data/app/assets/javascripts/store/jquery.validate.js +406 -449
- data/app/assets/javascripts/store/store.js +5 -29
- data/app/assets/stylesheets/application.sass +60 -223
- data/app/assets/stylesheets/bootstrap-overrides.css +3 -13
- data/app/assets/stylesheets/bootstrap.css +0 -1
- data/app/assets/stylesheets/font-awesome.sass +759 -0
- data/app/assets/stylesheets/sass/_event_list.sass +1 -12
- data/app/assets/stylesheets/sass/_tags.sass +2 -13
- data/app/assets/stylesheets/sass/box-office.sass +1 -2
- data/app/assets/stylesheets/sass/cart.sass +6 -0
- data/app/assets/stylesheets/sass/store.sass +68 -123
- data/app/assets/stylesheets/storefront.css +1 -2
- data/app/concerns/itemable.rb +1 -1
- data/app/controllers/artfully_ose_controller.rb +7 -29
- data/app/controllers/discounts_controller.rb +1 -8
- data/app/controllers/events_controller.rb +33 -41
- data/app/controllers/exchanges_controller.rb +2 -8
- data/app/controllers/export_controller.rb +0 -6
- data/app/controllers/imports_controller.rb +0 -19
- data/app/controllers/members/index_controller.rb +1 -1
- data/app/controllers/members/members_controller.rb +1 -6
- data/app/controllers/membership_awards_controller.rb +58 -0
- data/app/controllers/membership_types_controller.rb +3 -40
- data/app/controllers/memberships_controller.rb +4 -6
- data/app/controllers/orders_controller.rb +2 -86
- data/app/controllers/organizations_controller.rb +3 -4
- data/app/controllers/people_controller.rb +23 -54
- data/app/controllers/refunds_controller.rb +7 -7
- data/app/controllers/sales_controller.rb +28 -67
- data/app/controllers/searches_controller.rb +9 -15
- data/app/controllers/sections_controller.rb +2 -2
- data/app/controllers/segments_controller.rb +4 -4
- data/app/controllers/shows_controller.rb +49 -79
- data/app/controllers/slices_controller.rb +2 -3
- data/app/controllers/statements_controller.rb +1 -1
- data/app/controllers/store/checkouts_controller.rb +3 -8
- data/app/controllers/store/donations_controller.rb +1 -19
- data/app/controllers/store/events_controller.rb +1 -14
- data/app/controllers/store/memberships_controller.rb +1 -12
- data/app/controllers/store/orders_controller.rb +17 -36
- data/app/controllers/store/passes_controller.rb +0 -9
- data/app/controllers/store/store_controller.rb +2 -7
- data/app/controllers/tickets_controller.rb +2 -2
- data/app/helpers/artfully_ose_helper.rb +21 -79
- data/app/helpers/link_helper.rb +2 -12
- data/app/mailers/order_mailer.rb +1 -28
- data/app/mailers/reports_mailer.rb +4 -5
- data/app/models/ability.rb +0 -1
- data/app/models/action.rb +1 -1
- data/app/models/actions/go_action.rb +2 -3
- data/app/{concerns → models/actions}/immutable_action.rb +0 -0
- data/app/models/address.rb +11 -32
- data/app/models/{cart.rb → carts/cart.rb} +37 -46
- data/app/models/carts/cart_finder.rb +33 -0
- data/app/models/checkout.rb +41 -85
- data/app/models/comp.rb +17 -24
- data/app/models/company.rb +1 -1
- data/app/models/contribution.rb +0 -1
- data/app/models/database_views/item_view.rb +28 -169
- data/app/models/database_views/order_view.rb +34 -0
- data/app/models/donation.rb +0 -4
- data/app/models/door_list.rb +3 -6
- data/app/models/event.rb +10 -60
- data/app/models/exchange.rb +5 -7
- data/app/models/{ext.rb → ext/ext.rb} +1 -14
- data/app/models/ext/integrations.rb +21 -39
- data/app/models/fee_strategy.rb +1 -47
- data/app/models/import.rb +2 -22
- data/app/models/imports/donations_import.rb +19 -1
- data/app/models/imports/events_import.rb +51 -43
- data/app/models/individual.rb +1 -3
- data/app/models/item.rb +11 -28
- data/app/models/job/daily_email_report_job.rb +6 -20
- data/app/models/job/mailchimp_sync_job.rb +3 -1
- data/app/models/job/order_processor.rb +12 -78
- data/app/models/job/show_creator.rb +3 -8
- data/app/models/kit.rb +4 -2
- data/app/models/kits/mailchimp_kit.rb +10 -18
- data/app/models/kits/regular_donation_kit.rb +8 -38
- data/app/models/member.rb +17 -152
- data/app/models/membership.rb +23 -59
- data/app/models/membership_award.rb +23 -0
- data/app/models/membership_type.rb +2 -44
- data/app/models/note.rb +1 -1
- data/app/models/order_handler.rb +39 -100
- data/app/models/orders/comp_order.rb +0 -4
- data/app/models/orders/imported_order.rb +0 -4
- data/app/models/{order.rb → orders/order.rb} +18 -113
- data/app/models/orders/refund_order.rb +0 -4
- data/app/{concerns → models/orders}/unrefundable.rb +0 -0
- data/app/models/organization.rb +15 -55
- data/app/models/organization_ability.rb +0 -1
- data/app/models/parsed_row.rb +3 -58
- data/app/models/payments/cash_payment.rb +1 -3
- data/app/models/payments/comp_payment.rb +1 -3
- data/app/models/payments/credit_card_payment.rb +23 -44
- data/app/models/{payment.rb → payments/payment.rb} +1 -29
- data/app/models/person.rb +36 -140
- data/app/models/phone.rb +8 -0
- data/app/models/refund.rb +2 -5
- data/app/models/sale.rb +10 -14
- data/app/models/sale_search.rb +21 -3
- data/app/models/search.rb +67 -320
- data/app/models/section.rb +2 -18
- data/app/models/show.rb +20 -67
- data/app/models/slices.rb +8 -25
- data/app/models/statement.rb +5 -32
- data/app/models/ticket.rb +15 -50
- data/app/models/ticket/locker.rb +1 -2
- data/app/models/ticket/pricing.rb +1 -11
- data/app/models/ticket/reports.rb +0 -16
- data/app/models/ticket/sale_transitions.rb +0 -4
- data/app/models/ticket/template.rb +0 -1
- data/app/models/ticket/transfers.rb +2 -12
- data/app/models/ticket_summary.rb +1 -7
- data/app/models/ticket_type.rb +7 -59
- data/app/models/user.rb +5 -18
- data/app/models/user_membership.rb +3 -21
- data/app/models/valuation/lifetime_ticket_value.rb +1 -1
- data/app/models/venue.rb +7 -21
- data/app/presenters/event_presenter.rb +1 -1
- data/app/views/actions/_form.html.haml +6 -6
- data/app/views/actions/get/_show.html.haml +13 -2
- data/app/views/actions/give/_show.html.haml +1 -1
- data/app/views/actions/shared/_show.html.haml +1 -1
- data/app/views/addresses/_address.html.haml +6 -7
- data/app/views/contributions/_form.html.haml +1 -1
- data/app/views/contributions/index.html.haml +2 -2
- data/app/views/discounts/_discount_section_fields.html.haml +1 -1
- data/app/views/discounts/_form.html.haml +1 -1
- data/app/views/discounts/index.html.haml +1 -1
- data/app/views/events/_day_date_show.html.haml +2 -2
- data/app/views/events/_discount_section_fields.html.haml +1 -1
- data/app/views/events/_header.html.haml +0 -1
- data/app/views/events/_list.html.haml +5 -10
- data/app/views/events/_menu.html.haml +15 -6
- data/app/views/events/_section_fields.html.haml +1 -1
- data/app/views/events/_share_and_sell.haml +2 -3
- data/app/views/events/_ticket_type_fields.html.haml +4 -43
- data/app/views/events/edit.html.haml +1 -6
- data/app/views/events/image.html.haml +1 -2
- data/app/views/events/index.html.haml +3 -20
- data/app/views/events/show.html.haml +1 -3
- data/app/views/events/temp_discount_form.html.haml +1 -1
- data/app/views/events/temp_discounts_index.html.haml +1 -1
- data/app/views/exchanges/new.html.haml +28 -51
- data/app/views/imports/donations/_pending.html.haml +1 -1
- data/app/views/imports/events/_pending.html.haml +1 -1
- data/app/views/imports/index.html.haml +3 -6
- data/app/views/imports/people/_imported.html.haml +2 -2
- data/app/views/imports/people/_new.html.haml +8 -20
- data/app/views/imports/people/_pending.html.haml +2 -2
- data/app/views/imports/people/_recalled.html.haml +1 -1
- data/app/views/imports/shared/_sidebar.html.haml +1 -1
- data/app/views/index/dashboard.html.haml +4 -4
- data/app/views/layouts/_flash.html.haml +3 -3
- data/app/views/layouts/_google_analytics.html.haml +2 -5
- data/app/views/layouts/_menu.html.haml +5 -9
- data/app/views/layouts/application.html.haml +2 -2
- data/app/views/layouts/devise_layout.html.haml +2 -2
- data/app/views/layouts/members.html.haml +1 -1
- data/app/views/layouts/storefront.html.haml +15 -27
- data/app/views/members/index/index.html.haml +13 -7
- data/app/views/membership_awards/confirm.html.haml +59 -0
- data/app/views/membership_awards/create.html.haml +1 -0
- data/app/views/membership_awards/new.html.haml +74 -0
- data/app/views/membership_types/_form.html.haml +19 -67
- data/app/views/membership_types/index.html.haml +14 -15
- data/app/views/memberships/index.html.haml +50 -116
- data/app/views/merges/find_person.html.haml +1 -1
- data/app/views/notes/_note.html.haml +4 -4
- data/app/views/order_mailer/confirmation_for.html.haml +21 -33
- data/app/views/order_mailer/confirmation_for.text.haml +3 -6
- data/app/views/orders/_item_table.haml +8 -25
- data/app/views/orders/_order_sidebar.html.haml +4 -2
- data/app/views/orders/sales.html.haml +3 -3
- data/app/views/organizations/_connection_form.html.haml +1 -1
- data/app/views/organizations/_form.html.haml +20 -25
- data/app/views/organizations/edit.html.haml +2 -2
- data/app/views/organizations/show.html.haml +16 -22
- data/app/views/people/_edit_modal.html.haml +28 -48
- data/app/views/people/_header.html.haml +9 -18
- data/app/views/people/_phone_fields.html.haml +1 -1
- data/app/views/people/index.html.haml +6 -18
- data/app/views/people/new.html.haml +1 -1
- data/app/views/people/show.html.haml +24 -71
- data/app/views/refunds/new.html.haml +27 -45
- data/app/views/reports_mailer/daily.html.haml +21 -86
- data/app/views/sales/new.html.haml +125 -33
- data/app/views/searches/_form.html.haml +50 -115
- data/app/views/searches/_person.html.haml +2 -5
- data/app/views/searches/new.html.haml +1 -1
- data/app/views/searches/show.html.haml +6 -17
- data/app/views/segments/show.html.haml +4 -7
- data/app/views/shared/_error_messages.html.haml +1 -1
- data/app/views/shared/_tags.html.haml +2 -2
- data/app/views/shows/_controls.html.haml +20 -4
- data/app/views/shows/_glance.html.haml +5 -1
- data/app/views/shows/_sections_table.html.haml +6 -8
- data/app/views/shows/_ticket_table.html.haml +3 -3
- data/app/views/shows/_work_with.html.haml +5 -5
- data/app/views/shows/door_list.html.haml +2 -2
- data/app/views/shows/index.html.haml +19 -88
- data/app/views/shows/new.html.haml +11 -10
- data/app/views/shows/show.html.haml +2 -2
- data/app/views/slices/index.html.haml +1 -2
- data/app/views/statements/_discounts_table.html.haml +1 -1
- data/app/views/statements/_order_location_table.html.haml +1 -1
- data/app/views/statements/_payment_method_table.haml +1 -1
- data/app/views/statements/_ticket_type_table.haml +2 -5
- data/app/views/statements/show.html.haml +2 -5
- data/app/views/store/checkouts/thanks.html.haml +16 -38
- data/app/views/store/donations/index.html.haml +2 -19
- data/app/views/store/events/_calendar.html.haml +4 -1
- data/app/views/store/events/index.html.haml +4 -11
- data/app/views/store/events/show.html.haml +19 -10
- data/app/views/store/memberships/index.html.haml +17 -17
- data/app/views/store/orders/show.html.haml +22 -33
- data/app/views/store/shared/_donate_form.html.haml +12 -31
- data/app/views/store/shows/_show.html.haml +29 -37
- data/app/views/user_memberships/_list.html.haml +29 -28
- data/app/views/users/invitations/edit.html.haml +9 -19
- data/app/views/users/mailer/invitation_instructions.html.erb +8 -0
- data/app/views/users/passwords/edit.html.haml +2 -2
- data/app/views/users/registrations/edit.html.erb +3 -3
- data/app/views/users/sessions/new.html.haml +2 -2
- data/app/views/venues/edit.html.haml +1 -3
- data/config/initializers/devise.rb +5 -2
- data/config/locales/devise.en.yml +1 -1
- data/config/locales/devise_invitable.en.yml +1 -1
- data/config/locales/en.yml +3 -18
- data/config/routes.rb +12 -101
- data/lib/artfully_ose.rb +4 -6
- data/lib/artfully_ose/common_abilities.rb +2 -8
- data/lib/artfully_ose/engine.rb +10 -34
- data/lib/artfully_ose/version.rb +1 -1
- metadata +45 -349
- data/README.md +0 -28
- data/app/assets/images/household-default-avatar.png +0 -0
- data/app/assets/javascripts/angular-resource.js +0 -546
- data/app/assets/javascripts/angular.js +0 -20311
- data/app/assets/javascripts/bootstrap-wysihtml5.js +0 -511
- data/app/assets/javascripts/boxoffice.js +0 -558
- data/app/assets/javascripts/change-membership.js +0 -152
- data/app/assets/javascripts/custom/kits-config.js +0 -33
- data/app/assets/javascripts/households.js +0 -59
- data/app/assets/javascripts/jquery-migrate-1.2.1.min.js +0 -2
- data/app/assets/javascripts/relationships.js +0 -63
- data/app/assets/javascripts/sales-console.js +0 -158
- data/app/assets/javascripts/wysihtml5-0.3.0.min.js +0 -261
- data/app/assets/stylesheets/bootstrap-wysihtml5.css +0 -102
- data/app/assets/stylesheets/boxoffice.css.scss +0 -258
- data/app/assets/stylesheets/font-awesome.css.scss +0 -1566
- data/app/assets/stylesheets/pages/bootstrap-responsive.css +0 -1109
- data/app/assets/stylesheets/wysiwyg-color.css +0 -67
- data/app/concerns/cart_finder.rb +0 -50
- data/app/concerns/pdf_generation.rb +0 -64
- data/app/concerns/search_by_dates.rb +0 -20
- data/app/controllers/console_sales_controller.rb +0 -182
- data/app/controllers/events_pass_types_controller.rb +0 -87
- data/app/controllers/households_controller.rb +0 -71
- data/app/controllers/member_cards_controller.rb +0 -44
- data/app/controllers/members/invitations_controller.rb +0 -7
- data/app/controllers/members/passwords_controller.rb +0 -10
- data/app/controllers/members/people_controller.rb +0 -17
- data/app/controllers/members/sessions_controller.rb +0 -14
- data/app/controllers/membership_cancellations_controller.rb +0 -46
- data/app/controllers/membership_changes_controller.rb +0 -39
- data/app/controllers/membership_comps_controller.rb +0 -102
- data/app/controllers/membership_kits_controller.rb +0 -25
- data/app/controllers/mobile/dashboard_controller.rb +0 -17
- data/app/controllers/mobile/events_controller.rb +0 -16
- data/app/controllers/mobile/orders_controller.rb +0 -61
- data/app/controllers/mobile/shows_controller.rb +0 -39
- data/app/controllers/mobile/tickets_controller.rb +0 -114
- data/app/controllers/mobile/users_controller.rb +0 -30
- data/app/controllers/pass_types_controller.rb +0 -53
- data/app/controllers/passes_controller.rb +0 -52
- data/app/controllers/passes_kits_controller.rb +0 -25
- data/app/controllers/passes_reports_controller.rb +0 -25
- data/app/controllers/regular_donation_kits_controller.rb +0 -32
- data/app/controllers/relationships_controller.rb +0 -15
- data/app/controllers/store/retrievals_controller.rb +0 -29
- data/app/controllers/users/sessions_controller.rb +0 -3
- data/app/helpers/households_helper.rb +0 -7
- data/app/helpers/membership_types_helper.rb +0 -22
- data/app/helpers/relationships_helper.rb +0 -26
- data/app/helpers/sales_helper.rb +0 -29
- data/app/helpers/searches_helper.rb +0 -13
- data/app/helpers/suggested_households_helper.rb +0 -5
- data/app/mailers/pass_mailer.rb +0 -17
- data/app/models/actions/change_action.rb +0 -13
- data/app/models/actions/comp_action.rb +0 -15
- data/app/models/console_sale.rb +0 -30
- data/app/models/daily_membership_report.rb +0 -50
- data/app/models/daily_pass_report.rb +0 -48
- data/app/models/events_pass_type.rb +0 -18
- data/app/models/ext/preprocessor.rb +0 -7
- data/app/models/extendable.rb +0 -6
- data/app/models/household.rb +0 -61
- data/app/models/household_suggester.rb +0 -58
- data/app/models/imports/memberships_import.rb +0 -43
- data/app/models/job/checkout_processor.rb +0 -46
- data/app/models/job/cleanup_suggested_households_job.rb +0 -17
- data/app/models/job/destroy_show_job.rb +0 -10
- data/app/models/job/geocode_address_job.rb +0 -11
- data/app/models/job/order_mailer_job.rb +0 -8
- data/app/models/job/refund_order_processor.rb +0 -16
- data/app/models/kits/membership_kit.rb +0 -62
- data/app/models/kits/passes_kit.rb +0 -62
- data/app/models/kits/scannable_tickets_kit.rb +0 -23
- data/app/models/member_card_generator.rb +0 -63
- data/app/models/member_walkup.rb +0 -150
- data/app/models/membership_cancellation.rb +0 -80
- data/app/models/membership_change.rb +0 -187
- data/app/models/membership_comp.rb +0 -105
- data/app/models/membership_comp_job.rb +0 -32
- data/app/models/membership_sale_search.rb +0 -18
- data/app/models/pass.rb +0 -197
- data/app/models/pass_sale_search.rb +0 -18
- data/app/models/pass_summary.rb +0 -18
- data/app/models/pass_type.rb +0 -46
- data/app/models/passes_report.rb +0 -117
- data/app/models/payments/check_payment.rb +0 -33
- data/app/models/relation.rb +0 -27
- data/app/models/relation_builder.rb +0 -32
- data/app/models/relationship.rb +0 -55
- data/app/models/relationship_builder.rb +0 -12
- data/app/models/relationship_validator.rb +0 -46
- data/app/models/relationships_kit.rb +0 -31
- data/app/models/rolling_membership_type.rb +0 -11
- data/app/models/seasonal_membership_type.rb +0 -3
- data/app/models/suggested_household.rb +0 -24
- data/app/models/ticket/qr_code.rb +0 -21
- data/app/models/valuation/lifetime_memberships.rb +0 -24
- data/app/serializers/show_serializer.rb +0 -15
- data/app/views/console_sales/_aloha.html.haml +0 -26
- data/app/views/console_sales/_cart.html.haml +0 -60
- data/app/views/console_sales/_payment.html.haml +0 -111
- data/app/views/console_sales/_shows.html.haml +0 -24
- data/app/views/console_sales/new.html.haml +0 -143
- data/app/views/events_pass_types/_form.html.haml +0 -42
- data/app/views/events_pass_types/edit.html.haml +0 -22
- data/app/views/events_pass_types/index.html.haml +0 -47
- data/app/views/events_pass_types/new.html.haml +0 -22
- data/app/views/households/_action.html.haml +0 -24
- data/app/views/households/_edit_modal.html.haml +0 -143
- data/app/views/households/_form.html.haml +0 -26
- data/app/views/households/_header.html.haml +0 -25
- data/app/views/households/_individual_fields.html.haml +0 -8
- data/app/views/households/_list.html.haml +0 -10
- data/app/views/households/_note.html.haml +0 -33
- data/app/views/households/edit.html.haml +0 -1
- data/app/views/households/index.html.haml +0 -13
- data/app/views/households/new.html.haml +0 -14
- data/app/views/households/show.html.haml +0 -72
- data/app/views/households/suggested.html.haml +0 -38
- data/app/views/imports/_export_links.html.haml +0 -3
- data/app/views/kits/_list.html.haml +0 -9
- data/app/views/members/invitations/edit.html.haml +0 -17
- data/app/views/members/invitations/new.html.erb +0 -14
- data/app/views/members/mailer/_invitation_body.html.haml +0 -18
- data/app/views/members/mailer/invitation_instructions.html.haml +0 -6
- data/app/views/members/mailer/reset_password_instructions.html.erb +0 -8
- data/app/views/members/passwords/edit.html.haml +0 -18
- data/app/views/members/sessions/new.html.haml +0 -19
- data/app/views/membership_cancellations/_form.html.haml +0 -39
- data/app/views/membership_cancellations/_modal.html.haml +0 -2
- data/app/views/membership_cancellations/_processing.html.haml +0 -12
- data/app/views/membership_cancellations/create.js.erb +0 -3
- data/app/views/membership_cancellations/new.js.erb +0 -3
- data/app/views/membership_comps/confirm.html.haml +0 -86
- data/app/views/membership_comps/create.html.haml +0 -20
- data/app/views/membership_comps/new.html.haml +0 -95
- data/app/views/membership_kits/edit.html.haml +0 -52
- data/app/views/membership_mailer/cancellation_confirmation.html.haml +0 -9
- data/app/views/membership_mailer/cancellation_confirmation.text.haml +0 -6
- data/app/views/membership_mailer/refund_problem.html.haml +0 -18
- data/app/views/membership_mailer/refund_problem.text.haml +0 -14
- data/app/views/membership_types/_membership_type_fees.html.haml +0 -0
- data/app/views/membership_types/_rolling_membership_type_form.html.haml +0 -5
- data/app/views/membership_types/_seasonal_membership_type_form.html.haml +0 -8
- data/app/views/membership_types/type.html.haml +0 -19
- data/app/views/memberships/_membership_scripts.js.erb +0 -15
- data/app/views/order_mailer/confirmation_for_exchange.html.haml +0 -34
- data/app/views/order_mailer/confirmation_for_exchange.text.haml +0 -26
- data/app/views/order_mailer/confirmation_for_refund.html.haml +0 -36
- data/app/views/order_mailer/confirmation_for_refund.text.haml +0 -22
- data/app/views/orders/membership.html.haml +0 -100
- data/app/views/orders/passes.html.haml +0 -97
- data/app/views/pass_mailer/pass_info_for.html.haml +0 -21
- data/app/views/pass_types/_form.html.haml +0 -76
- data/app/views/pass_types/_pass_type_fees.html.haml +0 -0
- data/app/views/pass_types/edit.html.haml +0 -4
- data/app/views/pass_types/index.html.haml +0 -34
- data/app/views/pass_types/new.html.haml +0 -4
- data/app/views/passes/index.html.haml +0 -108
- data/app/views/passes_kits/edit.html.haml +0 -30
- data/app/views/passes_reports/index.html.haml +0 -80
- data/app/views/pdfs/member.html.haml +0 -66
- data/app/views/pdfs/member_card_generator/blanks_usa_idc6.html.haml +0 -109
- data/app/views/pdfs/order.html.haml +0 -84
- data/app/views/people/_household_fields.html.haml +0 -5
- data/app/views/people/_relationship_fields.html.haml +0 -14
- data/app/views/people/_work_with_menu.html.haml +0 -39
- data/app/views/producer_mailer/donation_kit_notification.html.haml +0 -8
- data/app/views/producer_mailer/donation_kit_notification.text.erb +0 -8
- data/app/views/producer_mailer/mailchimp_kit_initial_sync_notification.html.haml +0 -21
- data/app/views/producer_mailer/ticket_offer_accepted.html.haml +0 -7
- data/app/views/producer_mailer/ticket_offer_accepted.text.erb +0 -7
- data/app/views/producer_mailer/ticket_offer_rejected.html.haml +0 -11
- data/app/views/producer_mailer/ticket_offer_rejected.text.erb +0 -13
- data/app/views/regular_donation_kits/edit.html.haml +0 -140
- data/app/views/relationships/index.html.haml +0 -32
- data/app/views/sales/_boxoffice.html.haml +0 -141
- data/app/views/sales/_doorlist.html.haml +0 -79
- data/app/views/searches/_household.html.haml +0 -7
- data/app/views/shared/_show_time_and_calendar.html.haml +0 -21
- data/app/views/shows/door_list.pdf.haml +0 -29
- data/app/views/statements/_passes_table.html.haml +0 -22
- data/app/views/store/checkouts/_membership_info.html.haml +0 -12
- data/app/views/store/events/_venue.html.haml +0 -9
- data/app/views/store/events/calendar.html.haml +0 -50
- data/app/views/store/events/single_show.html.haml +0 -45
- data/app/views/store/passes/index.html.haml +0 -33
- data/app/views/store/retrievals/index.html.haml +0 -11
- data/app/views/store/shared/_small_donate_form.html.haml +0 -21
- data/app/views/users/mailer/invitation_instructions.html.haml +0 -14
- data/config/initializers/paperclip.rb +0 -69
- data/db/migrate/20130411162346_add_country_zip_state_phone_number_discipline_to_organizations.rb +0 -9
- data/db/migrate/20130412184415_add_first_name_and_last_name_to_users.rb +0 -6
- data/db/migrate/20130722153731_add_autentication_token_to_users.rb +0 -5
- data/db/migrate/20130723212712_add_qr_code_to_tickets.rb +0 -9
- data/db/migrate/20130820011240_add_uuid_to_tickets.rb +0 -13
- data/db/migrate/20130820025134_make_ticket_uuid_not_null.rb +0 -11
- data/db/migrate/20130823191625_add_pdf_to_orders.rb +0 -5
- data/db/migrate/20130916194547_add_relationships.rb +0 -21
- data/db/migrate/20131002191646_create_show_stats_view.rb +0 -16
- data/db/migrate/20131003134821_add_relationships_to_search.rb +0 -7
- data/db/migrate/20131003200508_add_starred_to_relationships.rb +0 -5
- data/db/migrate/20131007141421_add_counters_to_member.rb +0 -7
- data/db/migrate/20131007144456_remove_expires_at_from_membership.rb +0 -6
- data/db/migrate/20131011154027_add_purchased_to_searches.rb +0 -5
- data/db/migrate/20131013144010_add_type_to_membership_type.rb +0 -5
- data/db/migrate/20131013150230_add_duration_to_membership_type.rb +0 -6
- data/db/migrate/20131013192807_change_number_of_shows_to_tickets.rb +0 -5
- data/db/migrate/20131015151550_add_households.rb +0 -18
- data/db/migrate/20131022183913_add_search_output_options.rb +0 -24
- data/db/migrate/20131023200559_add_admin_to_user_memberships.rb +0 -14
- data/db/migrate/20131025162155_default_search_filter_values.rb +0 -10
- data/db/migrate/20131025180139_unique_household_names.rb +0 -8
- data/db/migrate/20131029173612_add_sales_start_to_membership_typ.rb +0 -6
- data/db/migrate/20131106191847_add_suggested_households.rb +0 -13
- data/db/migrate/20131127162818_add_buyer_id_index_to_tickets.rb +0 -5
- data/db/migrate/20131127164000_member_tickets.rb +0 -9
- data/db/migrate/20131204162642_add_shared_address.rb +0 -9
- data/db/migrate/20131206153323_add_membership_kit.rb +0 -5
- data/db/migrate/20131206175325_add_marketing_to_membership_type.rb +0 -6
- data/db/migrate/20131210212342_add_show_fee_to_memberhsip_type.rb +0 -5
- data/db/migrate/20131210222814_add_renewal_price_to_membership_type.rb +0 -6
- data/db/migrate/20131212164553_add_copy_to_individuals_option.rb +0 -5
- data/db/migrate/20131223215615_goodbye_order_view.rb +0 -6
- data/db/migrate/20140114011856_add_welcome_message_to_memberships.rb +0 -5
- data/db/migrate/20140114212127_add_send_email_to_memberships.rb +0 -5
- data/db/migrate/20140125183606_index_memberships_and_types.rb +0 -6
- data/db/migrate/20140128213101_add_pdf_to_members.rb +0 -5
- data/db/migrate/20140128223140_add_uuid_to_member.rb +0 -6
- data/db/migrate/20140128223948_add_qr_code_to_member.rb +0 -9
- data/db/migrate/20140207135731_update_items_view.rb +0 -38
- data/db/migrate/20140210154723_add_cached_stats.rb +0 -5
- data/db/migrate/20140218202726_cache_stats.rb +0 -7
- data/db/migrate/20140304171625_passes_ahoy.rb +0 -52
- data/db/migrate/20140304174807_add_passes_kit.rb +0 -5
- data/db/migrate/20140307144454_add_events_pass_types.rb +0 -9
- data/db/migrate/20140307193350_add_pass_id_to_cart.rb +0 -7
- data/db/migrate/20140314162422_add_total_paid_to_membership.rb +0 -13
- data/db/migrate/20140319191237_add_show_dates_to_advanced_search.rb +0 -6
- data/db/migrate/20140328172333_add_cols_to_events_pass_types.rb +0 -6
- data/db/migrate/20140328174217_add_deleted_at_to_ept.rb +0 -9
- data/db/migrate/20140328185432_add_active_to_ept.rb +0 -5
- data/db/migrate/20140328192612_add_pass_type_id_to_search.rb +0 -5
- data/db/migrate/20140415212841_add_min_max_start_dates_to_searches.artfully_ose_engine.rb +0 -6
- data/db/migrate/20140422193345_add_email_copy_to_pass_type.rb +0 -5
- data/db/migrate/20140423181639_add_min_max_end_dates_to_searches.artfully_ose_engine.rb +0 -6
- data/db/migrate/20140423185921_add_cached_stats_to_event.rb +0 -9
- data/db/migrate/20140424174423_add_lifetime_memberships_to_people.artfully_ose_engine.rb +0 -5
- data/db/migrate/20140506155241_add_lpt_to_membership_type.rb +0 -5
- data/db/migrate/20140507184646_add_bday_attributes_to_person.rb +0 -7
- data/db/migrate/20140507201048_add_check_number_to_orders.rb +0 -5
- data/db/migrate/20140515143651_remove_show_stats_view.rb +0 -6
- data/db/migrate/20140521195853_add_deleted_at_to_pass_type.rb +0 -5
- data/db/migrate/20140522205554_add_limit_to_events_pass_types.rb +0 -5
- data/db/migrate/20140523180444_remove_tickets_purchased_from_passes.rb +0 -5
- data/db/migrate/20140603200735_add_subtitle_to_events.rb +0 -5
- data/db/migrate/20140619194127_add_do_not_call_to_people.artfully_ose_engine.rb +0 -5
- data/db/migrate/20140623160543_add_index_to_items.rb +0 -7
- data/spec/factories/action_factories.rb +0 -19
- data/spec/factories/address_factories.rb +0 -11
- data/spec/factories/cart_factories.rb +0 -26
- data/spec/factories/chart_factories.rb +0 -52
- data/spec/factories/discount_factories.rb +0 -11
- data/spec/factories/donation_factories.rb +0 -14
- data/spec/factories/event_factories.rb +0 -29
- data/spec/factories/household_factories.rb +0 -8
- data/spec/factories/import_factories.rb +0 -61
- data/spec/factories/item_factories.rb +0 -51
- data/spec/factories/kit_factories.rb +0 -33
- data/spec/factories/member_factories.rb +0 -19
- data/spec/factories/membership_factories.rb +0 -9
- data/spec/factories/membership_type_factories.rb +0 -18
- data/spec/factories/order_factories.rb +0 -40
- data/spec/factories/organization_factories.rb +0 -48
- data/spec/factories/pass_type_factories.rb +0 -11
- data/spec/factories/payments_factories.rb +0 -97
- data/spec/factories/person_factories.rb +0 -47
- data/spec/factories/phone_factories.rb +0 -6
- data/spec/factories/section_factories.rb +0 -21
- data/spec/factories/segment_factories.rb +0 -6
- data/spec/factories/show_factories.rb +0 -33
- data/spec/factories/ticket_factories.rb +0 -57
- data/spec/factories/ticket_offer_factories.rb +0 -16
- data/spec/factories/ticket_type_factories.rb +0 -8
- data/spec/factories/user_factories.rb +0 -24
@@ -1,12 +1,14 @@
|
|
1
|
-
|
2
|
-
* jQuery Validation Plugin 1.
|
1
|
+
/**
|
2
|
+
* jQuery Validation Plugin 1.9.0
|
3
3
|
*
|
4
4
|
* http://bassistance.de/jquery-plugins/jquery-plugin-validation/
|
5
5
|
* http://docs.jquery.com/Plugins/Validation
|
6
6
|
*
|
7
|
-
* Copyright
|
8
|
-
*
|
7
|
+
* Copyright (c) 2006 - 2011 Jörn Zaefferer
|
8
|
+
*
|
9
|
+
* Dual licensed under the MIT and GPL licenses:
|
9
10
|
* http://www.opensource.org/licenses/mit-license.php
|
11
|
+
* http://www.gnu.org/licenses/gpl.html
|
10
12
|
*/
|
11
13
|
|
12
14
|
(function($) {
|
@@ -16,57 +18,53 @@ $.extend($.fn, {
|
|
16
18
|
validate: function( options ) {
|
17
19
|
|
18
20
|
// if nothing is selected, return nothing; can't chain anyway
|
19
|
-
if (
|
20
|
-
|
21
|
-
console.warn( "Nothing selected, can't validate, returning nothing." );
|
22
|
-
}
|
21
|
+
if (!this.length) {
|
22
|
+
options && options.debug && window.console && console.warn( "nothing selected, can't validate, returning nothing" );
|
23
23
|
return;
|
24
24
|
}
|
25
25
|
|
26
26
|
// check if a validator for this form was already created
|
27
|
-
var validator = $.data(
|
27
|
+
var validator = $.data(this[0], 'validator');
|
28
28
|
if ( validator ) {
|
29
29
|
return validator;
|
30
30
|
}
|
31
31
|
|
32
32
|
// Add novalidate tag if HTML5.
|
33
|
-
this.attr(
|
33
|
+
this.attr('novalidate', 'novalidate');
|
34
34
|
|
35
35
|
validator = new $.validator( options, this[0] );
|
36
|
-
$.data(
|
36
|
+
$.data(this[0], 'validator', validator);
|
37
37
|
|
38
38
|
if ( validator.settings.onsubmit ) {
|
39
39
|
|
40
|
-
this.
|
41
|
-
if ( validator.settings.submitHandler ) {
|
42
|
-
validator.submitButton = event.target;
|
43
|
-
}
|
44
|
-
// allow suppressing validation by adding a cancel class to the submit button
|
45
|
-
if ( $(event.target).hasClass("cancel") ) {
|
46
|
-
validator.cancelSubmit = true;
|
47
|
-
}
|
40
|
+
var inputsAndButtons = this.find("input, button");
|
48
41
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
}
|
42
|
+
// allow suppresing validation by adding a cancel class to the submit button
|
43
|
+
inputsAndButtons.filter(".cancel").click(function () {
|
44
|
+
validator.cancelSubmit = true;
|
53
45
|
});
|
54
46
|
|
47
|
+
// when a submitHandler is used, capture the submitting button
|
48
|
+
if (validator.settings.submitHandler) {
|
49
|
+
inputsAndButtons.filter(":submit").click(function () {
|
50
|
+
validator.submitButton = this;
|
51
|
+
});
|
52
|
+
}
|
53
|
+
|
55
54
|
// validate the form on submit
|
56
55
|
this.submit( function( event ) {
|
57
|
-
if ( validator.settings.debug )
|
56
|
+
if ( validator.settings.debug )
|
58
57
|
// prevent form submit to be able to see console output
|
59
58
|
event.preventDefault();
|
60
|
-
|
59
|
+
|
61
60
|
function handle() {
|
62
|
-
var hidden;
|
63
61
|
if ( validator.settings.submitHandler ) {
|
64
|
-
if (
|
62
|
+
if (validator.submitButton) {
|
65
63
|
// insert a hidden input as a replacement for the missing submit button
|
66
|
-
hidden = $("<input type='hidden'/>").attr("name", validator.submitButton.name).val(
|
64
|
+
var hidden = $("<input type='hidden'/>").attr("name", validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);
|
67
65
|
}
|
68
|
-
validator.settings.submitHandler.call( validator, validator.currentForm
|
69
|
-
if (
|
66
|
+
validator.settings.submitHandler.call( validator, validator.currentForm );
|
67
|
+
if (validator.submitButton) {
|
70
68
|
// and clean up afterwards; thanks to no-block-scope, hidden can be referenced
|
71
69
|
hidden.remove();
|
72
70
|
}
|
@@ -97,52 +95,49 @@ $.extend($.fn, {
|
|
97
95
|
},
|
98
96
|
// http://docs.jquery.com/Plugins/Validation/valid
|
99
97
|
valid: function() {
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
valid
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
98
|
+
if ( $(this[0]).is('form')) {
|
99
|
+
return this.validate().form();
|
100
|
+
} else {
|
101
|
+
var valid = true;
|
102
|
+
var validator = $(this[0].form).validate();
|
103
|
+
this.each(function() {
|
104
|
+
valid &= validator.element(this);
|
105
|
+
});
|
106
|
+
return valid;
|
107
|
+
}
|
108
|
+
},
|
111
109
|
// attributes: space seperated list of attributes to retrieve and remove
|
112
|
-
removeAttrs: function(
|
110
|
+
removeAttrs: function(attributes) {
|
113
111
|
var result = {},
|
114
112
|
$element = this;
|
115
|
-
$.each(attributes.split(/\s/), function(
|
113
|
+
$.each(attributes.split(/\s/), function(index, value) {
|
116
114
|
result[value] = $element.attr(value);
|
117
115
|
$element.removeAttr(value);
|
118
116
|
});
|
119
117
|
return result;
|
120
118
|
},
|
121
119
|
// http://docs.jquery.com/Plugins/Validation/rules
|
122
|
-
rules: function(
|
120
|
+
rules: function(command, argument) {
|
123
121
|
var element = this[0];
|
124
122
|
|
125
|
-
if (
|
126
|
-
var settings = $.data(element.form,
|
123
|
+
if (command) {
|
124
|
+
var settings = $.data(element.form, 'validator').settings;
|
127
125
|
var staticRules = settings.rules;
|
128
126
|
var existingRules = $.validator.staticRules(element);
|
129
127
|
switch(command) {
|
130
128
|
case "add":
|
131
129
|
$.extend(existingRules, $.validator.normalizeRule(argument));
|
132
|
-
// remove messages from rules, but allow them to be set separetely
|
133
|
-
delete existingRules.messages;
|
134
130
|
staticRules[element.name] = existingRules;
|
135
|
-
if (
|
131
|
+
if (argument.messages)
|
136
132
|
settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages );
|
137
|
-
}
|
138
133
|
break;
|
139
134
|
case "remove":
|
140
|
-
if (
|
135
|
+
if (!argument) {
|
141
136
|
delete staticRules[element.name];
|
142
137
|
return existingRules;
|
143
138
|
}
|
144
139
|
var filtered = {};
|
145
|
-
$.each(argument.split(/\s/), function(
|
140
|
+
$.each(argument.split(/\s/), function(index, method) {
|
146
141
|
filtered[method] = existingRules[method];
|
147
142
|
delete existingRules[method];
|
148
143
|
});
|
@@ -153,14 +148,14 @@ $.extend($.fn, {
|
|
153
148
|
var data = $.validator.normalizeRules(
|
154
149
|
$.extend(
|
155
150
|
{},
|
151
|
+
$.validator.metadataRules(element),
|
156
152
|
$.validator.classRules(element),
|
157
153
|
$.validator.attributeRules(element),
|
158
|
-
$.validator.dataRules(element),
|
159
154
|
$.validator.staticRules(element)
|
160
155
|
), element);
|
161
156
|
|
162
157
|
// make sure required is at front
|
163
|
-
if (
|
158
|
+
if (data.required) {
|
164
159
|
var param = data.required;
|
165
160
|
delete data.required;
|
166
161
|
data = $.extend({required: param}, data);
|
@@ -173,11 +168,11 @@ $.extend($.fn, {
|
|
173
168
|
// Custom selectors
|
174
169
|
$.extend($.expr[":"], {
|
175
170
|
// http://docs.jquery.com/Plugins/Validation/blank
|
176
|
-
blank: function(
|
171
|
+
blank: function(a) {return !$.trim("" + a.value);},
|
177
172
|
// http://docs.jquery.com/Plugins/Validation/filled
|
178
|
-
filled: function(
|
173
|
+
filled: function(a) {return !!$.trim("" + a.value);},
|
179
174
|
// http://docs.jquery.com/Plugins/Validation/unchecked
|
180
|
-
unchecked: function(
|
175
|
+
unchecked: function(a) {return !a.checked;}
|
181
176
|
});
|
182
177
|
|
183
178
|
// constructor for validator
|
@@ -187,24 +182,21 @@ $.validator = function( options, form ) {
|
|
187
182
|
this.init();
|
188
183
|
};
|
189
184
|
|
190
|
-
$.validator.format = function(
|
191
|
-
if ( arguments.length
|
185
|
+
$.validator.format = function(source, params) {
|
186
|
+
if ( arguments.length == 1 )
|
192
187
|
return function() {
|
193
188
|
var args = $.makeArray(arguments);
|
194
189
|
args.unshift(source);
|
195
190
|
return $.validator.format.apply( this, args );
|
196
191
|
};
|
197
|
-
|
198
|
-
if ( arguments.length > 2 && params.constructor !== Array ) {
|
192
|
+
if ( arguments.length > 2 && params.constructor != Array ) {
|
199
193
|
params = $.makeArray(arguments).slice(1);
|
200
194
|
}
|
201
|
-
if ( params.constructor
|
195
|
+
if ( params.constructor != Array ) {
|
202
196
|
params = [ params ];
|
203
197
|
}
|
204
|
-
$.each(params, function(
|
205
|
-
source = source.replace(
|
206
|
-
return n;
|
207
|
-
});
|
198
|
+
$.each(params, function(i, n) {
|
199
|
+
source = source.replace(new RegExp("\\{" + i + "\\}", "g"), n);
|
208
200
|
});
|
209
201
|
return source;
|
210
202
|
};
|
@@ -219,53 +211,47 @@ $.extend($.validator, {
|
|
219
211
|
validClass: "valid",
|
220
212
|
errorElement: "label",
|
221
213
|
focusInvalid: true,
|
222
|
-
errorContainer: $([]),
|
223
|
-
errorLabelContainer: $([]),
|
214
|
+
errorContainer: $( [] ),
|
215
|
+
errorLabelContainer: $( [] ),
|
224
216
|
onsubmit: true,
|
225
217
|
ignore: ":hidden",
|
226
218
|
ignoreTitle: false,
|
227
|
-
onfocusin: function(
|
219
|
+
onfocusin: function(element, event) {
|
228
220
|
this.lastActive = element;
|
229
221
|
|
230
222
|
// hide error label and remove error class on focus if enabled
|
231
223
|
if ( this.settings.focusCleanup && !this.blockFocusCleanup ) {
|
232
|
-
|
233
|
-
this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass );
|
234
|
-
}
|
224
|
+
this.settings.unhighlight && this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass );
|
235
225
|
this.addWrapper(this.errorsFor(element)).hide();
|
236
226
|
}
|
237
227
|
},
|
238
|
-
onfocusout: function(
|
228
|
+
onfocusout: function(element, event) {
|
239
229
|
if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) {
|
240
230
|
this.element(element);
|
241
231
|
}
|
242
232
|
},
|
243
|
-
onkeyup: function(
|
244
|
-
if (
|
245
|
-
return;
|
246
|
-
} else if ( element.name in this.submitted || element === this.lastElement ) {
|
233
|
+
onkeyup: function(element, event) {
|
234
|
+
if ( element.name in this.submitted || element == this.lastElement ) {
|
247
235
|
this.element(element);
|
248
236
|
}
|
249
237
|
},
|
250
|
-
onclick: function(
|
238
|
+
onclick: function(element, event) {
|
251
239
|
// click on selects, radiobuttons and checkboxes
|
252
|
-
if ( element.name in this.submitted )
|
240
|
+
if ( element.name in this.submitted )
|
253
241
|
this.element(element);
|
254
|
-
}
|
255
242
|
// or option elements, check parent select in that case
|
256
|
-
else if (
|
243
|
+
else if (element.parentNode.name in this.submitted)
|
257
244
|
this.element(element.parentNode);
|
258
|
-
}
|
259
245
|
},
|
260
|
-
highlight: function(
|
261
|
-
if (
|
246
|
+
highlight: function(element, errorClass, validClass) {
|
247
|
+
if (element.type === 'radio') {
|
262
248
|
this.findByName(element.name).addClass(errorClass).removeClass(validClass);
|
263
249
|
} else {
|
264
250
|
$(element).addClass(errorClass).removeClass(validClass);
|
265
251
|
}
|
266
252
|
},
|
267
|
-
unhighlight: function(
|
268
|
-
if (
|
253
|
+
unhighlight: function(element, errorClass, validClass) {
|
254
|
+
if (element.type === 'radio') {
|
269
255
|
this.findByName(element.name).removeClass(errorClass).addClass(validClass);
|
270
256
|
} else {
|
271
257
|
$(element).removeClass(errorClass).addClass(validClass);
|
@@ -274,7 +260,7 @@ $.extend($.validator, {
|
|
274
260
|
},
|
275
261
|
|
276
262
|
// http://docs.jquery.com/Plugins/Validation/Validator/setDefaults
|
277
|
-
setDefaults: function(
|
263
|
+
setDefaults: function(settings) {
|
278
264
|
$.extend( $.validator.defaults, settings );
|
279
265
|
},
|
280
266
|
|
@@ -289,6 +275,7 @@ $.extend($.validator, {
|
|
289
275
|
digits: "Please enter only digits.",
|
290
276
|
creditcard: "Please enter a valid credit card number.",
|
291
277
|
equalTo: "Please enter the same value again.",
|
278
|
+
accept: "Please enter a value with a valid extension.",
|
292
279
|
maxlength: $.validator.format("Please enter no more than {0} characters."),
|
293
280
|
minlength: $.validator.format("Please enter at least {0} characters."),
|
294
281
|
rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."),
|
@@ -313,38 +300,32 @@ $.extend($.validator, {
|
|
313
300
|
this.reset();
|
314
301
|
|
315
302
|
var groups = (this.groups = {});
|
316
|
-
$.each(this.settings.groups, function(
|
317
|
-
|
318
|
-
value = value.split(/\s/);
|
319
|
-
}
|
320
|
-
$.each(value, function( index, name ) {
|
303
|
+
$.each(this.settings.groups, function(key, value) {
|
304
|
+
$.each(value.split(/\s/), function(index, name) {
|
321
305
|
groups[name] = key;
|
322
306
|
});
|
323
307
|
});
|
324
308
|
var rules = this.settings.rules;
|
325
|
-
$.each(rules, function(
|
309
|
+
$.each(rules, function(key, value) {
|
326
310
|
rules[key] = $.validator.normalizeRule(value);
|
327
311
|
});
|
328
312
|
|
329
313
|
function delegate(event) {
|
330
314
|
var validator = $.data(this[0].form, "validator"),
|
331
315
|
eventType = "on" + event.type.replace(/^validate/, "");
|
332
|
-
|
333
|
-
validator.settings[eventType].call(validator, this[0], event);
|
334
|
-
}
|
316
|
+
validator.settings[eventType] && validator.settings[eventType].call(validator, this[0], event);
|
335
317
|
}
|
336
318
|
$(this.currentForm)
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
319
|
+
.validateDelegate("[type='text'], [type='password'], [type='file'], select, textarea, " +
|
320
|
+
"[type='number'], [type='search'] ,[type='tel'], [type='url'], " +
|
321
|
+
"[type='email'], [type='datetime'], [type='date'], [type='month'], " +
|
322
|
+
"[type='week'], [type='time'], [type='datetime-local'], " +
|
323
|
+
"[type='range'], [type='color'] ",
|
324
|
+
"focusin focusout keyup", delegate)
|
343
325
|
.validateDelegate("[type='radio'], [type='checkbox'], select, option", "click", delegate);
|
344
326
|
|
345
|
-
if (
|
327
|
+
if (this.settings.invalidHandler)
|
346
328
|
$(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler);
|
347
|
-
}
|
348
329
|
},
|
349
330
|
|
350
331
|
// http://docs.jquery.com/Plugins/Validation/Validator/form
|
@@ -352,9 +333,8 @@ $.extend($.validator, {
|
|
352
333
|
this.checkForm();
|
353
334
|
$.extend(this.submitted, this.errorMap);
|
354
335
|
this.invalid = $.extend({}, this.errorMap);
|
355
|
-
if (
|
336
|
+
if (!this.valid())
|
356
337
|
$(this.currentForm).triggerHandler("invalid-form", [this]);
|
357
|
-
}
|
358
338
|
this.showErrors();
|
359
339
|
return this.valid();
|
360
340
|
},
|
@@ -373,7 +353,7 @@ $.extend($.validator, {
|
|
373
353
|
this.lastElement = element;
|
374
354
|
this.prepareElement( element );
|
375
355
|
this.currentElements = $(element);
|
376
|
-
var result = this.check( element )
|
356
|
+
var result = this.check( element );
|
377
357
|
if ( result ) {
|
378
358
|
delete this.invalid[element.name];
|
379
359
|
} else {
|
@@ -388,8 +368,8 @@ $.extend($.validator, {
|
|
388
368
|
},
|
389
369
|
|
390
370
|
// http://docs.jquery.com/Plugins/Validation/Validator/showErrors
|
391
|
-
showErrors: function(
|
392
|
-
if
|
371
|
+
showErrors: function(errors) {
|
372
|
+
if(errors) {
|
393
373
|
// add items to error list and map
|
394
374
|
$.extend( this.errorMap, errors );
|
395
375
|
this.errorList = [];
|
@@ -400,27 +380,24 @@ $.extend($.validator, {
|
|
400
380
|
});
|
401
381
|
}
|
402
382
|
// remove items from success list
|
403
|
-
this.successList = $.grep( this.successList, function(
|
383
|
+
this.successList = $.grep( this.successList, function(element) {
|
404
384
|
return !(element.name in errors);
|
405
385
|
});
|
406
386
|
}
|
407
|
-
|
408
|
-
this.settings.showErrors.call( this, this.errorMap, this.errorList )
|
409
|
-
|
410
|
-
this.defaultShowErrors();
|
411
|
-
}
|
387
|
+
this.settings.showErrors
|
388
|
+
? this.settings.showErrors.call( this, this.errorMap, this.errorList )
|
389
|
+
: this.defaultShowErrors();
|
412
390
|
},
|
413
391
|
|
414
392
|
// http://docs.jquery.com/Plugins/Validation/Validator/resetForm
|
415
393
|
resetForm: function() {
|
416
|
-
if ( $.fn.resetForm )
|
417
|
-
$(this.currentForm).resetForm();
|
418
|
-
}
|
394
|
+
if ( $.fn.resetForm )
|
395
|
+
$( this.currentForm ).resetForm();
|
419
396
|
this.submitted = {};
|
420
397
|
this.lastElement = null;
|
421
398
|
this.prepareForm();
|
422
399
|
this.hideErrors();
|
423
|
-
this.elements().removeClass( this.settings.errorClass )
|
400
|
+
this.elements().removeClass( this.settings.errorClass );
|
424
401
|
},
|
425
402
|
|
426
403
|
numberOfInvalids: function() {
|
@@ -429,9 +406,8 @@ $.extend($.validator, {
|
|
429
406
|
|
430
407
|
objectLength: function( obj ) {
|
431
408
|
var count = 0;
|
432
|
-
for ( var i in obj )
|
409
|
+
for ( var i in obj )
|
433
410
|
count++;
|
434
|
-
}
|
435
411
|
return count;
|
436
412
|
},
|
437
413
|
|
@@ -440,7 +416,7 @@ $.extend($.validator, {
|
|
440
416
|
},
|
441
417
|
|
442
418
|
valid: function() {
|
443
|
-
return this.size()
|
419
|
+
return this.size() == 0;
|
444
420
|
},
|
445
421
|
|
446
422
|
size: function() {
|
@@ -448,7 +424,7 @@ $.extend($.validator, {
|
|
448
424
|
},
|
449
425
|
|
450
426
|
focusInvalid: function() {
|
451
|
-
if
|
427
|
+
if( this.settings.focusInvalid ) {
|
452
428
|
try {
|
453
429
|
$(this.findLastActive() || this.errorList.length && this.errorList[0].element || [])
|
454
430
|
.filter(":visible")
|
@@ -463,9 +439,9 @@ $.extend($.validator, {
|
|
463
439
|
|
464
440
|
findLastActive: function() {
|
465
441
|
var lastActive = this.lastActive;
|
466
|
-
return lastActive && $.grep(this.errorList, function(
|
467
|
-
return n.element.name
|
468
|
-
}).length
|
442
|
+
return lastActive && $.grep(this.errorList, function(n) {
|
443
|
+
return n.element.name == lastActive.name;
|
444
|
+
}).length == 1 && lastActive;
|
469
445
|
},
|
470
446
|
|
471
447
|
elements: function() {
|
@@ -478,14 +454,11 @@ $.extend($.validator, {
|
|
478
454
|
.not(":submit, :reset, :image, [disabled]")
|
479
455
|
.not( this.settings.ignore )
|
480
456
|
.filter(function() {
|
481
|
-
|
482
|
-
console.error( "%o has no name assigned", this);
|
483
|
-
}
|
457
|
+
!this.name && validator.settings.debug && window.console && console.error( "%o has no name assigned", this);
|
484
458
|
|
485
459
|
// select only the first element for each name, and only those with rules specified
|
486
|
-
if ( this.name in rulesCache || !validator.objectLength($(this).rules()) )
|
460
|
+
if ( this.name in rulesCache || !validator.objectLength($(this).rules()) )
|
487
461
|
return false;
|
488
|
-
}
|
489
462
|
|
490
463
|
rulesCache[this.name] = true;
|
491
464
|
return true;
|
@@ -493,12 +466,11 @@ $.extend($.validator, {
|
|
493
466
|
},
|
494
467
|
|
495
468
|
clean: function( selector ) {
|
496
|
-
return $(selector)[0];
|
469
|
+
return $( selector )[0];
|
497
470
|
},
|
498
471
|
|
499
472
|
errors: function() {
|
500
|
-
|
501
|
-
return $(this.settings.errorElement + "." + errorClass, this.errorContext);
|
473
|
+
return $( this.settings.errorElement + "." + this.settings.errorClass, this.errorContext );
|
502
474
|
},
|
503
475
|
|
504
476
|
reset: function() {
|
@@ -520,93 +492,80 @@ $.extend($.validator, {
|
|
520
492
|
this.toHide = this.errorsFor(element);
|
521
493
|
},
|
522
494
|
|
523
|
-
elementValue: function( element ) {
|
524
|
-
var type = $(element).attr("type"),
|
525
|
-
val = $(element).val();
|
526
|
-
|
527
|
-
if ( type === "radio" || type === "checkbox" ) {
|
528
|
-
return $("input[name='" + $(element).attr("name") + "']:checked").val();
|
529
|
-
}
|
530
|
-
|
531
|
-
if ( typeof val === "string" ) {
|
532
|
-
return val.replace(/\r/g, "");
|
533
|
-
}
|
534
|
-
return val;
|
535
|
-
},
|
536
|
-
|
537
495
|
check: function( element ) {
|
538
496
|
element = this.validationTargetFor( this.clean( element ) );
|
539
497
|
|
540
498
|
var rules = $(element).rules();
|
541
499
|
var dependencyMismatch = false;
|
542
|
-
var val = this.elementValue(element);
|
543
|
-
var result;
|
544
|
-
|
545
500
|
for (var method in rules ) {
|
546
501
|
var rule = { method: method, parameters: rules[method] };
|
547
502
|
try {
|
548
|
-
|
549
|
-
result = $.validator.methods[method].call( this, val, element, rule.parameters );
|
503
|
+
var result = $.validator.methods[method].call( this, element.value.replace(/\r/g, ""), element, rule.parameters );
|
550
504
|
|
551
505
|
// if a method indicates that the field is optional and therefore valid,
|
552
506
|
// don't mark it as valid when there are no other rules
|
553
|
-
if ( result
|
507
|
+
if ( result == "dependency-mismatch" ) {
|
554
508
|
dependencyMismatch = true;
|
555
509
|
continue;
|
556
510
|
}
|
557
511
|
dependencyMismatch = false;
|
558
512
|
|
559
|
-
if ( result
|
513
|
+
if ( result == "pending" ) {
|
560
514
|
this.toHide = this.toHide.not( this.errorsFor(element) );
|
561
515
|
return;
|
562
516
|
}
|
563
517
|
|
564
|
-
if
|
518
|
+
if( !result ) {
|
565
519
|
this.formatAndAdd( element, rule );
|
566
520
|
return false;
|
567
521
|
}
|
568
522
|
} catch(e) {
|
569
|
-
|
570
|
-
|
571
|
-
}
|
523
|
+
this.settings.debug && window.console && console.log("exception occured when checking element " + element.id
|
524
|
+
+ ", check the '" + rule.method + "' method", e);
|
572
525
|
throw e;
|
573
526
|
}
|
574
527
|
}
|
575
|
-
if (
|
528
|
+
if (dependencyMismatch)
|
576
529
|
return;
|
577
|
-
|
578
|
-
if ( this.objectLength(rules) ) {
|
530
|
+
if ( this.objectLength(rules) )
|
579
531
|
this.successList.push(element);
|
580
|
-
}
|
581
532
|
return true;
|
582
533
|
},
|
583
534
|
|
584
535
|
// return the custom message for the given element and validation method
|
585
|
-
// specified in the element's
|
586
|
-
|
587
|
-
|
536
|
+
// specified in the element's "messages" metadata
|
537
|
+
customMetaMessage: function(element, method) {
|
538
|
+
if (!$.metadata)
|
539
|
+
return;
|
540
|
+
|
541
|
+
var meta = this.settings.meta
|
542
|
+
? $(element).metadata()[this.settings.meta]
|
543
|
+
: $(element).metadata();
|
544
|
+
|
545
|
+
return meta && meta.messages && meta.messages[method];
|
588
546
|
},
|
589
547
|
|
590
548
|
// return the custom message for the given element name and validation method
|
591
549
|
customMessage: function( name, method ) {
|
592
550
|
var m = this.settings.messages[name];
|
593
|
-
return m && (m.constructor
|
551
|
+
return m && (m.constructor == String
|
552
|
+
? m
|
553
|
+
: m[method]);
|
594
554
|
},
|
595
555
|
|
596
556
|
// return the first defined argument, allowing empty strings
|
597
557
|
findDefined: function() {
|
598
558
|
for(var i = 0; i < arguments.length; i++) {
|
599
|
-
if (
|
559
|
+
if (arguments[i] !== undefined)
|
600
560
|
return arguments[i];
|
601
|
-
}
|
602
561
|
}
|
603
562
|
return undefined;
|
604
563
|
},
|
605
564
|
|
606
|
-
defaultMessage: function( element, method
|
565
|
+
defaultMessage: function( element, method) {
|
607
566
|
return this.findDefined(
|
608
567
|
this.customMessage( element.name, method ),
|
609
|
-
this.
|
568
|
+
this.customMetaMessage( element, method ),
|
610
569
|
// title is never undefined, so handle empty string as undefined
|
611
570
|
!this.settings.ignoreTitle && element.title || undefined,
|
612
571
|
$.validator.messages[method],
|
@@ -617,10 +576,10 @@ $.extend($.validator, {
|
|
617
576
|
formatAndAdd: function( element, rule ) {
|
618
577
|
var message = this.defaultMessage( element, rule.method ),
|
619
578
|
theregex = /\$?\{(\d+)\}/g;
|
620
|
-
if ( typeof message
|
579
|
+
if ( typeof message == "function" ) {
|
621
580
|
message = message.call(this, rule.parameters, element);
|
622
581
|
} else if (theregex.test(message)) {
|
623
|
-
message =
|
582
|
+
message = jQuery.format(message.replace(theregex, '{$1}'), rule.parameters);
|
624
583
|
}
|
625
584
|
this.errorList.push({
|
626
585
|
message: message,
|
@@ -631,32 +590,28 @@ $.extend($.validator, {
|
|
631
590
|
this.submitted[element.name] = message;
|
632
591
|
},
|
633
592
|
|
634
|
-
addWrapper: function(
|
635
|
-
if ( this.settings.wrapper )
|
593
|
+
addWrapper: function(toToggle) {
|
594
|
+
if ( this.settings.wrapper )
|
636
595
|
toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );
|
637
|
-
}
|
638
596
|
return toToggle;
|
639
597
|
},
|
640
598
|
|
641
599
|
defaultShowErrors: function() {
|
642
|
-
var i
|
643
|
-
for ( i = 0; this.errorList[i]; i++ ) {
|
600
|
+
for ( var i = 0; this.errorList[i]; i++ ) {
|
644
601
|
var error = this.errorList[i];
|
645
|
-
|
646
|
-
this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
|
647
|
-
}
|
602
|
+
this.settings.highlight && this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
|
648
603
|
this.showLabel( error.element, error.message );
|
649
604
|
}
|
650
|
-
if
|
605
|
+
if( this.errorList.length ) {
|
651
606
|
this.toShow = this.toShow.add( this.containers );
|
652
607
|
}
|
653
|
-
if (
|
654
|
-
for ( i = 0; this.successList[i]; i++ ) {
|
608
|
+
if (this.settings.success) {
|
609
|
+
for ( var i = 0; this.successList[i]; i++ ) {
|
655
610
|
this.showLabel( this.successList[i] );
|
656
611
|
}
|
657
612
|
}
|
658
|
-
if (
|
659
|
-
for ( i = 0, elements = this.validElements(); elements[i]; i++ ) {
|
613
|
+
if (this.settings.unhighlight) {
|
614
|
+
for ( var i = 0, elements = this.validElements(); elements[i]; i++ ) {
|
660
615
|
this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass );
|
661
616
|
}
|
662
617
|
}
|
@@ -675,17 +630,18 @@ $.extend($.validator, {
|
|
675
630
|
});
|
676
631
|
},
|
677
632
|
|
678
|
-
showLabel: function(
|
633
|
+
showLabel: function(element, message) {
|
679
634
|
var label = this.errorsFor( element );
|
680
635
|
if ( label.length ) {
|
681
636
|
// refresh error/success class
|
682
637
|
label.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );
|
683
|
-
|
684
|
-
label
|
638
|
+
|
639
|
+
// check if we have a generated label, replace the message then
|
640
|
+
label.attr("generated") && label.html(message);
|
685
641
|
} else {
|
686
642
|
// create label
|
687
|
-
label = $("<" + this.settings.errorElement + "
|
688
|
-
.attr("for"
|
643
|
+
label = $("<" + this.settings.errorElement + "/>")
|
644
|
+
.attr({"for": this.idOrName(element), generated: true})
|
689
645
|
.addClass(this.settings.errorClass)
|
690
646
|
.html(message || "");
|
691
647
|
if ( this.settings.wrapper ) {
|
@@ -693,109 +649,107 @@ $.extend($.validator, {
|
|
693
649
|
// actually showing the wrapped element is handled elsewhere
|
694
650
|
label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent();
|
695
651
|
}
|
696
|
-
if ( !this.labelContainer.append(label).length )
|
697
|
-
|
698
|
-
this.settings.errorPlacement(label, $(element) )
|
699
|
-
|
700
|
-
label.insertAfter(element);
|
701
|
-
}
|
702
|
-
}
|
652
|
+
if ( !this.labelContainer.append(label).length )
|
653
|
+
this.settings.errorPlacement
|
654
|
+
? this.settings.errorPlacement(label, $(element) )
|
655
|
+
: label.insertAfter(element);
|
703
656
|
}
|
704
657
|
if ( !message && this.settings.success ) {
|
705
658
|
label.text("");
|
706
|
-
|
707
|
-
label.addClass( this.settings.success )
|
708
|
-
|
709
|
-
this.settings.success( label, element );
|
710
|
-
}
|
659
|
+
typeof this.settings.success == "string"
|
660
|
+
? label.addClass( this.settings.success )
|
661
|
+
: this.settings.success( label );
|
711
662
|
}
|
712
663
|
this.toShow = this.toShow.add(label);
|
713
664
|
},
|
714
665
|
|
715
|
-
errorsFor: function(
|
666
|
+
errorsFor: function(element) {
|
716
667
|
var name = this.idOrName(element);
|
717
|
-
|
718
|
-
return $(this).attr(
|
668
|
+
return this.errors().filter(function() {
|
669
|
+
return $(this).attr('for') == name;
|
719
670
|
});
|
720
671
|
},
|
721
672
|
|
722
|
-
idOrName: function(
|
673
|
+
idOrName: function(element) {
|
723
674
|
return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name);
|
724
675
|
},
|
725
676
|
|
726
|
-
validationTargetFor: function(
|
677
|
+
validationTargetFor: function(element) {
|
727
678
|
// if radio/checkbox, validate first element in group instead
|
728
|
-
if (
|
679
|
+
if (this.checkable(element)) {
|
729
680
|
element = this.findByName( element.name ).not(this.settings.ignore)[0];
|
730
681
|
}
|
731
682
|
return element;
|
732
683
|
},
|
733
684
|
|
734
685
|
checkable: function( element ) {
|
735
|
-
return
|
686
|
+
return /radio|checkbox/i.test(element.type);
|
736
687
|
},
|
737
688
|
|
738
689
|
findByName: function( name ) {
|
739
|
-
|
690
|
+
// select by name and filter by form for performance over form.find("[name=...]")
|
691
|
+
var form = this.currentForm;
|
692
|
+
return $(document.getElementsByName(name)).map(function(index, element) {
|
693
|
+
return element.form == form && element.name == name && element || null;
|
694
|
+
});
|
740
695
|
},
|
741
696
|
|
742
|
-
getLength: function(
|
697
|
+
getLength: function(value, element) {
|
743
698
|
switch( element.nodeName.toLowerCase() ) {
|
744
|
-
case
|
699
|
+
case 'select':
|
745
700
|
return $("option:selected", element).length;
|
746
|
-
case
|
747
|
-
if
|
748
|
-
return this.findByName(element.name).filter(
|
749
|
-
}
|
701
|
+
case 'input':
|
702
|
+
if( this.checkable( element) )
|
703
|
+
return this.findByName(element.name).filter(':checked').length;
|
750
704
|
}
|
751
705
|
return value.length;
|
752
706
|
},
|
753
707
|
|
754
|
-
depend: function(
|
755
|
-
return this.dependTypes[typeof param]
|
708
|
+
depend: function(param, element) {
|
709
|
+
return this.dependTypes[typeof param]
|
710
|
+
? this.dependTypes[typeof param](param, element)
|
711
|
+
: true;
|
756
712
|
},
|
757
713
|
|
758
714
|
dependTypes: {
|
759
|
-
"boolean": function(
|
715
|
+
"boolean": function(param, element) {
|
760
716
|
return param;
|
761
717
|
},
|
762
|
-
"string": function(
|
718
|
+
"string": function(param, element) {
|
763
719
|
return !!$(param, element.form).length;
|
764
720
|
},
|
765
|
-
"function": function(
|
721
|
+
"function": function(param, element) {
|
766
722
|
return param(element);
|
767
723
|
}
|
768
724
|
},
|
769
725
|
|
770
|
-
optional: function(
|
771
|
-
|
772
|
-
return !$.validator.methods.required.call(this, val, element) && "dependency-mismatch";
|
726
|
+
optional: function(element) {
|
727
|
+
return !$.validator.methods.required.call(this, $.trim(element.value), element) && "dependency-mismatch";
|
773
728
|
},
|
774
729
|
|
775
|
-
startRequest: function(
|
776
|
-
if (
|
730
|
+
startRequest: function(element) {
|
731
|
+
if (!this.pending[element.name]) {
|
777
732
|
this.pendingRequest++;
|
778
733
|
this.pending[element.name] = true;
|
779
734
|
}
|
780
735
|
},
|
781
736
|
|
782
|
-
stopRequest: function(
|
737
|
+
stopRequest: function(element, valid) {
|
783
738
|
this.pendingRequest--;
|
784
739
|
// sometimes synchronization fails, make sure pendingRequest is never < 0
|
785
|
-
if (
|
740
|
+
if (this.pendingRequest < 0)
|
786
741
|
this.pendingRequest = 0;
|
787
|
-
}
|
788
742
|
delete this.pending[element.name];
|
789
|
-
if ( valid && this.pendingRequest
|
743
|
+
if ( valid && this.pendingRequest == 0 && this.formSubmitted && this.form() ) {
|
790
744
|
$(this.currentForm).submit();
|
791
745
|
this.formSubmitted = false;
|
792
|
-
} else if (!valid && this.pendingRequest
|
746
|
+
} else if (!valid && this.pendingRequest == 0 && this.formSubmitted) {
|
793
747
|
$(this.currentForm).triggerHandler("invalid-form", [this]);
|
794
748
|
this.formSubmitted = false;
|
795
749
|
}
|
796
750
|
},
|
797
751
|
|
798
|
-
previousValue: function(
|
752
|
+
previousValue: function(element) {
|
799
753
|
return $.data(element, "previousValue") || $.data(element, "previousValue", {
|
800
754
|
old: null,
|
801
755
|
valid: true,
|
@@ -811,117 +765,94 @@ $.extend($.validator, {
|
|
811
765
|
url: {url: true},
|
812
766
|
date: {date: true},
|
813
767
|
dateISO: {dateISO: true},
|
768
|
+
dateDE: {dateDE: true},
|
814
769
|
number: {number: true},
|
770
|
+
numberDE: {numberDE: true},
|
815
771
|
digits: {digits: true},
|
816
772
|
creditcard: {creditcard: true}
|
817
773
|
},
|
818
774
|
|
819
|
-
addClassRules: function(
|
820
|
-
|
821
|
-
this.classRuleSettings[className] = rules
|
822
|
-
} else {
|
775
|
+
addClassRules: function(className, rules) {
|
776
|
+
className.constructor == String ?
|
777
|
+
this.classRuleSettings[className] = rules :
|
823
778
|
$.extend(this.classRuleSettings, className);
|
824
|
-
}
|
825
779
|
},
|
826
780
|
|
827
|
-
classRules: function(
|
781
|
+
classRules: function(element) {
|
828
782
|
var rules = {};
|
829
|
-
var classes = $(element).attr(
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
});
|
836
|
-
}
|
783
|
+
var classes = $(element).attr('class');
|
784
|
+
classes && $.each(classes.split(' '), function() {
|
785
|
+
if (this in $.validator.classRuleSettings) {
|
786
|
+
$.extend(rules, $.validator.classRuleSettings[this]);
|
787
|
+
}
|
788
|
+
});
|
837
789
|
return rules;
|
838
790
|
},
|
839
791
|
|
840
|
-
attributeRules: function(
|
792
|
+
attributeRules: function(element) {
|
841
793
|
var rules = {};
|
842
794
|
var $element = $(element);
|
843
|
-
var type = $element[0].getAttribute("type");
|
844
795
|
|
845
796
|
for (var method in $.validator.methods) {
|
846
797
|
var value;
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
value = $element.get(0).getAttribute(method);
|
851
|
-
// Some browsers return an empty string for the required attribute
|
852
|
-
// and non-HTML5 browsers might have required="" markup
|
853
|
-
if ( value === "" ) {
|
854
|
-
value = true;
|
855
|
-
}
|
856
|
-
// force non-HTML5 browsers to return bool
|
857
|
-
value = !!value;
|
798
|
+
// If .prop exists (jQuery >= 1.6), use it to get true/false for required
|
799
|
+
if (method === 'required' && typeof $.fn.prop === 'function') {
|
800
|
+
value = $element.prop(method);
|
858
801
|
} else {
|
859
802
|
value = $element.attr(method);
|
860
803
|
}
|
861
|
-
|
862
|
-
// convert the value to a number for number inputs, and for text for backwards compability
|
863
|
-
// allows type="date" and others to be compared as strings
|
864
|
-
if ( /min|max/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) {
|
865
|
-
value = Number(value);
|
866
|
-
}
|
867
|
-
|
868
|
-
if ( value ) {
|
804
|
+
if (value) {
|
869
805
|
rules[method] = value;
|
870
|
-
} else if (
|
871
|
-
// exception: the jquery validate 'range' method
|
872
|
-
// does not test for the html5 'range' type
|
806
|
+
} else if ($element[0].getAttribute("type") === method) {
|
873
807
|
rules[method] = true;
|
874
808
|
}
|
875
809
|
}
|
876
810
|
|
877
811
|
// maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs
|
878
|
-
if (
|
812
|
+
if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) {
|
879
813
|
delete rules.maxlength;
|
880
814
|
}
|
881
815
|
|
882
816
|
return rules;
|
883
817
|
},
|
884
818
|
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
}
|
893
|
-
}
|
894
|
-
return rules;
|
819
|
+
metadataRules: function(element) {
|
820
|
+
if (!$.metadata) return {};
|
821
|
+
|
822
|
+
var meta = $.data(element.form, 'validator').settings.meta;
|
823
|
+
return meta ?
|
824
|
+
$(element).metadata()[meta] :
|
825
|
+
$(element).metadata();
|
895
826
|
},
|
896
827
|
|
897
|
-
staticRules: function(
|
828
|
+
staticRules: function(element) {
|
898
829
|
var rules = {};
|
899
|
-
var validator = $.data(element.form,
|
900
|
-
if (
|
830
|
+
var validator = $.data(element.form, 'validator');
|
831
|
+
if (validator.settings.rules) {
|
901
832
|
rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {};
|
902
833
|
}
|
903
834
|
return rules;
|
904
835
|
},
|
905
836
|
|
906
|
-
normalizeRules: function(
|
837
|
+
normalizeRules: function(rules, element) {
|
907
838
|
// handle dependency check
|
908
|
-
$.each(rules, function(
|
839
|
+
$.each(rules, function(prop, val) {
|
909
840
|
// ignore rule when param is explicitly false, eg. required:false
|
910
|
-
if (
|
841
|
+
if (val === false) {
|
911
842
|
delete rules[prop];
|
912
843
|
return;
|
913
844
|
}
|
914
|
-
if (
|
845
|
+
if (val.param || val.depends) {
|
915
846
|
var keepRule = true;
|
916
847
|
switch (typeof val.depends) {
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
848
|
+
case "string":
|
849
|
+
keepRule = !!$(val.depends, element.form).length;
|
850
|
+
break;
|
851
|
+
case "function":
|
852
|
+
keepRule = val.depends.call(element, element);
|
853
|
+
break;
|
923
854
|
}
|
924
|
-
if (
|
855
|
+
if (keepRule) {
|
925
856
|
rules[prop] = val.param !== undefined ? val.param : true;
|
926
857
|
} else {
|
927
858
|
delete rules[prop];
|
@@ -930,48 +861,47 @@ $.extend($.validator, {
|
|
930
861
|
});
|
931
862
|
|
932
863
|
// evaluate parameters
|
933
|
-
$.each(rules, function(
|
864
|
+
$.each(rules, function(rule, parameter) {
|
934
865
|
rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter;
|
935
866
|
});
|
936
867
|
|
937
868
|
// clean number parameters
|
938
|
-
$.each(['minlength', 'maxlength'], function() {
|
939
|
-
if (
|
869
|
+
$.each(['minlength', 'maxlength', 'min', 'max'], function() {
|
870
|
+
if (rules[this]) {
|
940
871
|
rules[this] = Number(rules[this]);
|
941
872
|
}
|
942
873
|
});
|
943
874
|
$.each(['rangelength', 'range'], function() {
|
944
|
-
|
945
|
-
|
946
|
-
if ( $.isArray(rules[this]) ) {
|
947
|
-
rules[this] = [Number(rules[this][0]), Number(rules[this][1])];
|
948
|
-
} else if ( typeof rules[this] === "string" ) {
|
949
|
-
parts = rules[this].split(/[\s,]+/);
|
950
|
-
rules[this] = [Number(parts[0]), Number(parts[1])];
|
951
|
-
}
|
875
|
+
if (rules[this]) {
|
876
|
+
rules[this] = [Number(rules[this][0]), Number(rules[this][1])];
|
952
877
|
}
|
953
878
|
});
|
954
879
|
|
955
|
-
if (
|
880
|
+
if ($.validator.autoCreateRanges) {
|
956
881
|
// auto-create ranges
|
957
|
-
if (
|
882
|
+
if (rules.min && rules.max) {
|
958
883
|
rules.range = [rules.min, rules.max];
|
959
884
|
delete rules.min;
|
960
885
|
delete rules.max;
|
961
886
|
}
|
962
|
-
if (
|
887
|
+
if (rules.minlength && rules.maxlength) {
|
963
888
|
rules.rangelength = [rules.minlength, rules.maxlength];
|
964
889
|
delete rules.minlength;
|
965
890
|
delete rules.maxlength;
|
966
891
|
}
|
967
892
|
}
|
968
893
|
|
894
|
+
// To support custom messages in metadata ignore rule methods titled "messages"
|
895
|
+
if (rules.messages) {
|
896
|
+
delete rules.messages;
|
897
|
+
}
|
898
|
+
|
969
899
|
return rules;
|
970
900
|
},
|
971
901
|
|
972
902
|
// Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
|
973
|
-
normalizeRule: function(
|
974
|
-
if
|
903
|
+
normalizeRule: function(data) {
|
904
|
+
if( typeof data == "string" ) {
|
975
905
|
var transformed = {};
|
976
906
|
$.each(data.split(/\s/), function() {
|
977
907
|
transformed[this] = true;
|
@@ -982,10 +912,10 @@ $.extend($.validator, {
|
|
982
912
|
},
|
983
913
|
|
984
914
|
// http://docs.jquery.com/Plugins/Validation/Validator/addMethod
|
985
|
-
addMethod: function(
|
915
|
+
addMethod: function(name, method, message) {
|
986
916
|
$.validator.methods[name] = method;
|
987
|
-
$.validator.messages[name] = message
|
988
|
-
if (
|
917
|
+
$.validator.messages[name] = message != undefined ? message : $.validator.messages[name];
|
918
|
+
if (method.length < 3) {
|
989
919
|
$.validator.addClassRules(name, $.validator.normalizeRule(name));
|
990
920
|
}
|
991
921
|
},
|
@@ -993,64 +923,147 @@ $.extend($.validator, {
|
|
993
923
|
methods: {
|
994
924
|
|
995
925
|
// http://docs.jquery.com/Plugins/Validation/Methods/required
|
996
|
-
required: function(
|
926
|
+
required: function(value, element, param) {
|
997
927
|
// check if dependency is met
|
998
|
-
if ( !this.depend(param, element) )
|
928
|
+
if ( !this.depend(param, element) )
|
999
929
|
return "dependency-mismatch";
|
1000
|
-
|
1001
|
-
|
930
|
+
switch( element.nodeName.toLowerCase() ) {
|
931
|
+
case 'select':
|
1002
932
|
// could be an array for select-multiple or a string, both are fine this way
|
1003
933
|
var val = $(element).val();
|
1004
934
|
return val && val.length > 0;
|
935
|
+
case 'input':
|
936
|
+
if ( this.checkable(element) )
|
937
|
+
return this.getLength(value, element) > 0;
|
938
|
+
default:
|
939
|
+
return $.trim(value).length > 0;
|
1005
940
|
}
|
1006
|
-
|
1007
|
-
|
941
|
+
},
|
942
|
+
|
943
|
+
// http://docs.jquery.com/Plugins/Validation/Methods/remote
|
944
|
+
remote: function(value, element, param) {
|
945
|
+
if ( this.optional(element) )
|
946
|
+
return "dependency-mismatch";
|
947
|
+
|
948
|
+
var previous = this.previousValue(element);
|
949
|
+
if (!this.settings.messages[element.name] )
|
950
|
+
this.settings.messages[element.name] = {};
|
951
|
+
previous.originalMessage = this.settings.messages[element.name].remote;
|
952
|
+
this.settings.messages[element.name].remote = previous.message;
|
953
|
+
|
954
|
+
param = typeof param == "string" && {url:param} || param;
|
955
|
+
|
956
|
+
if ( this.pending[element.name] ) {
|
957
|
+
return "pending";
|
1008
958
|
}
|
1009
|
-
|
959
|
+
if ( previous.old === value ) {
|
960
|
+
return previous.valid;
|
961
|
+
}
|
962
|
+
|
963
|
+
previous.old = value;
|
964
|
+
var validator = this;
|
965
|
+
this.startRequest(element);
|
966
|
+
var data = {};
|
967
|
+
data[element.name] = value;
|
968
|
+
$.ajax($.extend(true, {
|
969
|
+
url: param,
|
970
|
+
mode: "abort",
|
971
|
+
port: "validate" + element.name,
|
972
|
+
dataType: "json",
|
973
|
+
data: data,
|
974
|
+
success: function(response) {
|
975
|
+
validator.settings.messages[element.name].remote = previous.originalMessage;
|
976
|
+
var valid = response === true;
|
977
|
+
if ( valid ) {
|
978
|
+
var submitted = validator.formSubmitted;
|
979
|
+
validator.prepareElement(element);
|
980
|
+
validator.formSubmitted = submitted;
|
981
|
+
validator.successList.push(element);
|
982
|
+
validator.showErrors();
|
983
|
+
} else {
|
984
|
+
var errors = {};
|
985
|
+
var message = response || validator.defaultMessage( element, "remote" );
|
986
|
+
errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message;
|
987
|
+
validator.showErrors(errors);
|
988
|
+
}
|
989
|
+
previous.valid = valid;
|
990
|
+
validator.stopRequest(element, valid);
|
991
|
+
}
|
992
|
+
}, param));
|
993
|
+
return "pending";
|
994
|
+
},
|
995
|
+
|
996
|
+
// http://docs.jquery.com/Plugins/Validation/Methods/minlength
|
997
|
+
minlength: function(value, element, param) {
|
998
|
+
return this.optional(element) || this.getLength($.trim(value), element) >= param;
|
999
|
+
},
|
1000
|
+
|
1001
|
+
// http://docs.jquery.com/Plugins/Validation/Methods/maxlength
|
1002
|
+
maxlength: function(value, element, param) {
|
1003
|
+
return this.optional(element) || this.getLength($.trim(value), element) <= param;
|
1004
|
+
},
|
1005
|
+
|
1006
|
+
// http://docs.jquery.com/Plugins/Validation/Methods/rangelength
|
1007
|
+
rangelength: function(value, element, param) {
|
1008
|
+
var length = this.getLength($.trim(value), element);
|
1009
|
+
return this.optional(element) || ( length >= param[0] && length <= param[1] );
|
1010
|
+
},
|
1011
|
+
|
1012
|
+
// http://docs.jquery.com/Plugins/Validation/Methods/min
|
1013
|
+
min: function( value, element, param ) {
|
1014
|
+
return this.optional(element) || value >= param;
|
1015
|
+
},
|
1016
|
+
|
1017
|
+
// http://docs.jquery.com/Plugins/Validation/Methods/max
|
1018
|
+
max: function( value, element, param ) {
|
1019
|
+
return this.optional(element) || value <= param;
|
1020
|
+
},
|
1021
|
+
|
1022
|
+
// http://docs.jquery.com/Plugins/Validation/Methods/range
|
1023
|
+
range: function( value, element, param ) {
|
1024
|
+
return this.optional(element) || ( value >= param[0] && value <= param[1] );
|
1010
1025
|
},
|
1011
1026
|
|
1012
1027
|
// http://docs.jquery.com/Plugins/Validation/Methods/email
|
1013
|
-
email: function(
|
1028
|
+
email: function(value, element) {
|
1014
1029
|
// contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
|
1015
1030
|
return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(value);
|
1016
1031
|
},
|
1017
1032
|
|
1018
1033
|
// http://docs.jquery.com/Plugins/Validation/Methods/url
|
1019
|
-
url: function(
|
1034
|
+
url: function(value, element) {
|
1020
1035
|
// contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
|
1021
|
-
return this.optional(element) || /^(https?|
|
1036
|
+
return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
|
1022
1037
|
},
|
1023
1038
|
|
1024
1039
|
// http://docs.jquery.com/Plugins/Validation/Methods/date
|
1025
|
-
date: function(
|
1026
|
-
return this.optional(element) || !/Invalid|NaN/.test(new Date(value)
|
1040
|
+
date: function(value, element) {
|
1041
|
+
return this.optional(element) || !/Invalid|NaN/.test(new Date(value));
|
1027
1042
|
},
|
1028
1043
|
|
1029
1044
|
// http://docs.jquery.com/Plugins/Validation/Methods/dateISO
|
1030
|
-
dateISO: function(
|
1031
|
-
return this.optional(element) || /^\d{4}[
|
1045
|
+
dateISO: function(value, element) {
|
1046
|
+
return this.optional(element) || /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);
|
1032
1047
|
},
|
1033
1048
|
|
1034
1049
|
// http://docs.jquery.com/Plugins/Validation/Methods/number
|
1035
|
-
number: function(
|
1036
|
-
return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)
|
1050
|
+
number: function(value, element) {
|
1051
|
+
return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);
|
1037
1052
|
},
|
1038
1053
|
|
1039
1054
|
// http://docs.jquery.com/Plugins/Validation/Methods/digits
|
1040
|
-
digits: function(
|
1055
|
+
digits: function(value, element) {
|
1041
1056
|
return this.optional(element) || /^\d+$/.test(value);
|
1042
1057
|
},
|
1043
1058
|
|
1044
1059
|
// http://docs.jquery.com/Plugins/Validation/Methods/creditcard
|
1045
1060
|
// based on http://en.wikipedia.org/wiki/Luhn
|
1046
|
-
creditcard: function(
|
1047
|
-
if ( this.optional(element) )
|
1061
|
+
creditcard: function(value, element) {
|
1062
|
+
if ( this.optional(element) )
|
1048
1063
|
return "dependency-mismatch";
|
1049
|
-
}
|
1050
1064
|
// accept only spaces, digits and dashes
|
1051
|
-
if (
|
1065
|
+
if (/[^0-9 -]+/.test(value))
|
1052
1066
|
return false;
|
1053
|
-
}
|
1054
1067
|
var nCheck = 0,
|
1055
1068
|
nDigit = 0,
|
1056
1069
|
bEven = false;
|
@@ -1059,117 +1072,32 @@ $.extend($.validator, {
|
|
1059
1072
|
|
1060
1073
|
for (var n = value.length - 1; n >= 0; n--) {
|
1061
1074
|
var cDigit = value.charAt(n);
|
1062
|
-
nDigit = parseInt(cDigit, 10);
|
1063
|
-
if (
|
1064
|
-
if (
|
1075
|
+
var nDigit = parseInt(cDigit, 10);
|
1076
|
+
if (bEven) {
|
1077
|
+
if ((nDigit *= 2) > 9)
|
1065
1078
|
nDigit -= 9;
|
1066
|
-
}
|
1067
1079
|
}
|
1068
1080
|
nCheck += nDigit;
|
1069
1081
|
bEven = !bEven;
|
1070
1082
|
}
|
1071
1083
|
|
1072
|
-
return (nCheck % 10)
|
1073
|
-
},
|
1074
|
-
|
1075
|
-
// http://docs.jquery.com/Plugins/Validation/Methods/minlength
|
1076
|
-
minlength: function( value, element, param ) {
|
1077
|
-
var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);
|
1078
|
-
return this.optional(element) || length >= param;
|
1079
|
-
},
|
1080
|
-
|
1081
|
-
// http://docs.jquery.com/Plugins/Validation/Methods/maxlength
|
1082
|
-
maxlength: function( value, element, param ) {
|
1083
|
-
var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);
|
1084
|
-
return this.optional(element) || length <= param;
|
1085
|
-
},
|
1086
|
-
|
1087
|
-
// http://docs.jquery.com/Plugins/Validation/Methods/rangelength
|
1088
|
-
rangelength: function( value, element, param ) {
|
1089
|
-
var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);
|
1090
|
-
return this.optional(element) || ( length >= param[0] && length <= param[1] );
|
1091
|
-
},
|
1092
|
-
|
1093
|
-
// http://docs.jquery.com/Plugins/Validation/Methods/min
|
1094
|
-
min: function( value, element, param ) {
|
1095
|
-
return this.optional(element) || value >= param;
|
1084
|
+
return (nCheck % 10) == 0;
|
1096
1085
|
},
|
1097
1086
|
|
1098
|
-
// http://docs.jquery.com/Plugins/Validation/Methods/
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
// http://docs.jquery.com/Plugins/Validation/Methods/range
|
1104
|
-
range: function( value, element, param ) {
|
1105
|
-
return this.optional(element) || ( value >= param[0] && value <= param[1] );
|
1087
|
+
// http://docs.jquery.com/Plugins/Validation/Methods/accept
|
1088
|
+
accept: function(value, element, param) {
|
1089
|
+
param = typeof param == "string" ? param.replace(/,/g, '|') : "png|jpe?g|gif";
|
1090
|
+
return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i"));
|
1106
1091
|
},
|
1107
1092
|
|
1108
1093
|
// http://docs.jquery.com/Plugins/Validation/Methods/equalTo
|
1109
|
-
equalTo: function(
|
1094
|
+
equalTo: function(value, element, param) {
|
1110
1095
|
// bind to the blur event of the target in order to revalidate whenever the target field is updated
|
1111
1096
|
// TODO find a way to bind the event just once, avoiding the unbind-rebind overhead
|
1112
|
-
var target = $(param)
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
});
|
1117
|
-
}
|
1118
|
-
return value === target.val();
|
1119
|
-
},
|
1120
|
-
|
1121
|
-
// http://docs.jquery.com/Plugins/Validation/Methods/remote
|
1122
|
-
remote: function( value, element, param ) {
|
1123
|
-
if ( this.optional(element) ) {
|
1124
|
-
return "dependency-mismatch";
|
1125
|
-
}
|
1126
|
-
|
1127
|
-
var previous = this.previousValue(element);
|
1128
|
-
if (!this.settings.messages[element.name] ) {
|
1129
|
-
this.settings.messages[element.name] = {};
|
1130
|
-
}
|
1131
|
-
previous.originalMessage = this.settings.messages[element.name].remote;
|
1132
|
-
this.settings.messages[element.name].remote = previous.message;
|
1133
|
-
|
1134
|
-
param = typeof param === "string" && {url:param} || param;
|
1135
|
-
|
1136
|
-
if ( previous.old === value ) {
|
1137
|
-
return previous.valid;
|
1138
|
-
}
|
1139
|
-
|
1140
|
-
previous.old = value;
|
1141
|
-
var validator = this;
|
1142
|
-
this.startRequest(element);
|
1143
|
-
var data = {};
|
1144
|
-
data[element.name] = value;
|
1145
|
-
$.ajax($.extend(true, {
|
1146
|
-
url: param,
|
1147
|
-
mode: "abort",
|
1148
|
-
port: "validate" + element.name,
|
1149
|
-
dataType: "json",
|
1150
|
-
data: data,
|
1151
|
-
success: function( response ) {
|
1152
|
-
validator.settings.messages[element.name].remote = previous.originalMessage;
|
1153
|
-
var valid = response === true || response === "true";
|
1154
|
-
if ( valid ) {
|
1155
|
-
var submitted = validator.formSubmitted;
|
1156
|
-
validator.prepareElement(element);
|
1157
|
-
validator.formSubmitted = submitted;
|
1158
|
-
validator.successList.push(element);
|
1159
|
-
delete validator.invalid[element.name];
|
1160
|
-
validator.showErrors();
|
1161
|
-
} else {
|
1162
|
-
var errors = {};
|
1163
|
-
var message = response || validator.defaultMessage( element, "remote" );
|
1164
|
-
errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message;
|
1165
|
-
validator.invalid[element.name] = true;
|
1166
|
-
validator.showErrors(errors);
|
1167
|
-
}
|
1168
|
-
previous.valid = valid;
|
1169
|
-
validator.stopRequest(element, valid);
|
1170
|
-
}
|
1171
|
-
}, param));
|
1172
|
-
return "pending";
|
1097
|
+
var target = $(param).unbind(".validate-equalTo").bind("blur.validate-equalTo", function() {
|
1098
|
+
$(element).valid();
|
1099
|
+
});
|
1100
|
+
return value == target.val();
|
1173
1101
|
}
|
1174
1102
|
|
1175
1103
|
}
|
@@ -1179,18 +1107,18 @@ $.extend($.validator, {
|
|
1179
1107
|
// deprecated, use $.validator.format instead
|
1180
1108
|
$.format = $.validator.format;
|
1181
1109
|
|
1182
|
-
}(jQuery)
|
1110
|
+
})(jQuery);
|
1183
1111
|
|
1184
1112
|
// ajax mode: abort
|
1185
1113
|
// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
|
1186
1114
|
// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
|
1187
|
-
(function($) {
|
1115
|
+
;(function($) {
|
1188
1116
|
var pendingRequests = {};
|
1189
1117
|
// Use a prefilter if available (1.5+)
|
1190
1118
|
if ( $.ajaxPrefilter ) {
|
1191
|
-
$.ajaxPrefilter(function(
|
1119
|
+
$.ajaxPrefilter(function(settings, _, xhr) {
|
1192
1120
|
var port = settings.port;
|
1193
|
-
if (
|
1121
|
+
if (settings.mode == "abort") {
|
1194
1122
|
if ( pendingRequests[port] ) {
|
1195
1123
|
pendingRequests[port].abort();
|
1196
1124
|
}
|
@@ -1200,32 +1128,61 @@ $.format = $.validator.format;
|
|
1200
1128
|
} else {
|
1201
1129
|
// Proxy ajax
|
1202
1130
|
var ajax = $.ajax;
|
1203
|
-
$.ajax = function(
|
1131
|
+
$.ajax = function(settings) {
|
1204
1132
|
var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode,
|
1205
1133
|
port = ( "port" in settings ? settings : $.ajaxSettings ).port;
|
1206
|
-
if (
|
1134
|
+
if (mode == "abort") {
|
1207
1135
|
if ( pendingRequests[port] ) {
|
1208
1136
|
pendingRequests[port].abort();
|
1209
1137
|
}
|
1210
|
-
pendingRequests[port] = ajax.apply(this, arguments);
|
1211
|
-
return pendingRequests[port];
|
1138
|
+
return (pendingRequests[port] = ajax.apply(this, arguments));
|
1212
1139
|
}
|
1213
1140
|
return ajax.apply(this, arguments);
|
1214
1141
|
};
|
1215
1142
|
}
|
1216
|
-
}(jQuery)
|
1143
|
+
})(jQuery);
|
1144
|
+
|
1145
|
+
// provides cross-browser focusin and focusout events
|
1146
|
+
// IE has native support, in other browsers, use event caputuring (neither bubbles)
|
1217
1147
|
|
1218
1148
|
// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
|
1219
1149
|
// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target
|
1220
|
-
(function($) {
|
1150
|
+
;(function($) {
|
1151
|
+
// only implement if not provided by jQuery core (since 1.4)
|
1152
|
+
// TODO verify if jQuery 1.4's implementation is compatible with older jQuery special-event APIs
|
1153
|
+
if (!jQuery.event.special.focusin && !jQuery.event.special.focusout && document.addEventListener) {
|
1154
|
+
$.each({
|
1155
|
+
focus: 'focusin',
|
1156
|
+
blur: 'focusout'
|
1157
|
+
}, function( original, fix ){
|
1158
|
+
$.event.special[fix] = {
|
1159
|
+
setup:function() {
|
1160
|
+
this.addEventListener( original, handler, true );
|
1161
|
+
},
|
1162
|
+
teardown:function() {
|
1163
|
+
this.removeEventListener( original, handler, true );
|
1164
|
+
},
|
1165
|
+
handler: function(e) {
|
1166
|
+
arguments[0] = $.event.fix(e);
|
1167
|
+
arguments[0].type = fix;
|
1168
|
+
return $.event.handle.apply(this, arguments);
|
1169
|
+
}
|
1170
|
+
};
|
1171
|
+
function handler(e) {
|
1172
|
+
e = $.event.fix(e);
|
1173
|
+
e.type = fix;
|
1174
|
+
return $.event.handle.call(this, e);
|
1175
|
+
}
|
1176
|
+
});
|
1177
|
+
};
|
1221
1178
|
$.extend($.fn, {
|
1222
|
-
validateDelegate: function(
|
1223
|
-
return this.bind(type, function(
|
1179
|
+
validateDelegate: function(delegate, type, handler) {
|
1180
|
+
return this.bind(type, function(event) {
|
1224
1181
|
var target = $(event.target);
|
1225
|
-
if (
|
1182
|
+
if (target.is(delegate)) {
|
1226
1183
|
return handler.apply(target, arguments);
|
1227
1184
|
}
|
1228
1185
|
});
|
1229
1186
|
}
|
1230
1187
|
});
|
1231
|
-
}(jQuery)
|
1188
|
+
})(jQuery);
|