solidus_backend 1.2.3 → 1.3.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of solidus_backend might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile +3 -3
- data/Rakefile +1 -1
- data/app/assets/javascripts/spree/backend.js +5 -4
- data/app/assets/javascripts/spree/backend/adjustments.js.coffee +1 -1
- data/app/assets/javascripts/spree/backend/{admin.js.erb → admin.js} +13 -44
- data/app/assets/javascripts/spree/backend/checkouts/edit.js +36 -25
- data/app/assets/javascripts/spree/backend/components/tabs.coffee +79 -0
- data/app/assets/javascripts/spree/backend/components/tooltips.js +31 -0
- data/app/assets/javascripts/spree/backend/images/index.js.coffee +0 -3
- data/app/assets/javascripts/spree/backend/{line_items_on_order_edit.js.erb → line_items_on_order_edit.js} +3 -10
- data/app/assets/javascripts/spree/backend/{option_type_autocomplete.js.erb → option_type_autocomplete.js} +0 -0
- data/app/assets/javascripts/spree/backend/payments/edit.js.coffee +32 -147
- data/app/assets/javascripts/spree/backend/routes.js +1 -0
- data/app/assets/javascripts/spree/backend/shipments.js +314 -0
- data/app/assets/javascripts/spree/backend/{spree-select2.js.erb → spree-select2.js} +2 -11
- data/app/assets/javascripts/spree/backend/stock_management/index_add_forms.coffee +52 -73
- data/app/assets/javascripts/spree/backend/stock_management/index_update_forms.coffee +54 -52
- data/app/assets/javascripts/spree/backend/stock_management/stock_item.coffee +4 -37
- data/app/assets/javascripts/spree/backend/stock_movement.js.coffee +1 -1
- data/app/assets/javascripts/spree/backend/stock_transfers/edit.coffee +0 -10
- data/app/assets/javascripts/spree/backend/stock_transfers/receive.coffee +0 -10
- data/app/assets/javascripts/spree/backend/{taxon_autocomplete.js.erb → taxon_autocomplete.js} +10 -6
- data/app/assets/javascripts/spree/backend/templates/stock_items/stock_location_stock_item.hbs +25 -19
- data/app/assets/javascripts/spree/backend/user_picker.js +8 -5
- data/app/assets/javascripts/spree/backend/{variant_autocomplete.js.coffee.erb → variant_autocomplete.js.coffee} +2 -4
- data/app/assets/stylesheets/spree/backend.css +0 -3
- data/app/assets/stylesheets/spree/backend/_bootstrap_custom.scss +666 -0
- data/app/assets/stylesheets/spree/backend/components/_navigation.scss +17 -0
- data/app/assets/stylesheets/spree/backend/components/_progress.scss +1 -0
- data/app/assets/stylesheets/spree/backend/components/_tabs.scss +108 -0
- data/app/assets/stylesheets/spree/backend/plugins/_bootstrap_tooltip.scss +47 -0
- data/app/assets/stylesheets/spree/backend/sections/_orders.scss +1 -1
- data/app/assets/stylesheets/spree/backend/sections/_payments.scss +14 -0
- data/app/assets/stylesheets/spree/backend/sections/_stock_management.scss +11 -9
- data/app/assets/stylesheets/spree/backend/sections/_stock_transfers.scss +0 -49
- data/app/assets/stylesheets/spree/backend/shared/_forms.scss +11 -14
- data/app/assets/stylesheets/spree/backend/shared/_header.scss +30 -0
- data/app/assets/stylesheets/spree/backend/shared/_layout.scss +0 -105
- data/app/assets/stylesheets/spree/backend/shared/_skeleton.scss +242 -0
- data/app/assets/stylesheets/spree/backend/shared/_tables.scss +2 -0
- data/app/assets/stylesheets/spree/backend/shared/_typography.scss +5 -1
- data/app/assets/stylesheets/spree/backend/shared/_utilities.scss +35 -0
- data/app/assets/stylesheets/spree/backend/spree_admin.scss +9 -5
- data/app/controllers/spree/admin/adjustments_controller.rb +2 -3
- data/app/controllers/spree/admin/base_controller.rb +46 -56
- data/app/controllers/spree/admin/cancellations_controller.rb +1 -1
- data/app/controllers/spree/admin/countries_controller.rb +0 -2
- data/app/controllers/spree/admin/customer_returns_controller.rb +1 -1
- data/app/controllers/spree/admin/general_settings_controller.rb +6 -8
- data/app/controllers/spree/admin/images_controller.rb +16 -17
- data/app/controllers/spree/admin/log_entries_controller.rb +1 -2
- data/app/controllers/spree/admin/option_types_controller.rb +17 -21
- data/app/controllers/spree/admin/option_values_controller.rb +1 -1
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +21 -22
- data/app/controllers/spree/admin/orders_controller.rb +41 -42
- data/app/controllers/spree/admin/payment_methods_controller.rb +18 -18
- data/app/controllers/spree/admin/payments_controller.rb +11 -11
- data/app/controllers/spree/admin/product_properties_controller.rb +13 -13
- data/app/controllers/spree/admin/products_controller.rb +4 -4
- data/app/controllers/spree/admin/promotion_actions_controller.rb +15 -11
- data/app/controllers/spree/admin/promotion_codes_controller.rb +0 -1
- data/app/controllers/spree/admin/promotion_rules_controller.rb +15 -15
- data/app/controllers/spree/admin/promotions_controller.rb +35 -35
- data/app/controllers/spree/admin/prototypes_controller.rb +2 -3
- data/app/controllers/spree/admin/reports_controller.rb +11 -5
- data/app/controllers/spree/admin/resource_controller.rb +130 -133
- data/app/controllers/spree/admin/return_authorizations_controller.rb +2 -2
- data/app/controllers/spree/admin/return_items_controller.rb +0 -1
- data/app/controllers/spree/admin/search_controller.rb +1 -3
- data/app/controllers/spree/admin/shipping_methods_controller.rb +3 -3
- data/app/controllers/spree/admin/states_controller.rb +10 -10
- data/app/controllers/spree/admin/stock_items_controller.rb +42 -42
- data/app/controllers/spree/admin/stock_locations_controller.rb +4 -12
- data/app/controllers/spree/admin/stock_movements_controller.rb +1 -1
- data/app/controllers/spree/admin/stock_transfers_controller.rb +7 -4
- data/app/controllers/spree/admin/store_credits_controller.rb +4 -4
- data/app/controllers/spree/admin/style_guide_controller.rb +3 -0
- data/app/controllers/spree/admin/taxonomies_controller.rb +0 -6
- data/app/controllers/spree/admin/taxons_controller.rb +13 -36
- data/app/controllers/spree/admin/users_controller.rb +54 -72
- data/app/controllers/spree/admin/variants_controller.rb +22 -35
- data/app/controllers/spree/admin/variants_including_master_controller.rb +0 -2
- data/app/controllers/spree/admin/zones_controller.rb +11 -11
- data/app/helpers/spree/admin/adjustments_helper.rb +4 -5
- data/app/helpers/spree/admin/base_helper.rb +32 -34
- data/app/helpers/spree/admin/general_settings_helper.rb +1 -1
- data/app/helpers/spree/admin/images_helper.rb +0 -1
- data/app/helpers/spree/admin/navigation_helper.rb +41 -35
- data/app/helpers/spree/admin/orders_helper.rb +5 -6
- data/app/helpers/spree/admin/payments_helper.rb +1 -1
- data/app/helpers/spree/admin/products_helper.rb +7 -7
- data/app/helpers/spree/admin/stock_locations_helper.rb +1 -1
- data/app/helpers/spree/admin/store_credit_events_helper.rb +6 -6
- data/app/helpers/spree/admin/tables_helper.rb +0 -2
- data/app/helpers/spree/admin/taxons_helper.rb +1 -1
- data/app/helpers/spree/promotion_rules_helper.rb +1 -4
- data/app/models/spree/backend_configuration.rb +1 -0
- data/app/views/kaminari/solidus_admin/_first_page.html.erb +3 -0
- data/app/views/kaminari/solidus_admin/_gap.html.erb +3 -0
- data/app/views/kaminari/solidus_admin/_last_page.html.erb +3 -0
- data/app/views/kaminari/solidus_admin/_next_page.html.erb +3 -0
- data/app/views/kaminari/solidus_admin/_page.html.erb +9 -0
- data/app/views/kaminari/solidus_admin/_paginator.html.erb +15 -0
- data/app/views/kaminari/solidus_admin/_prev_page.html.erb +3 -0
- data/app/views/spree/admin/adjustment_reasons/edit.html.erb +2 -0
- data/app/views/spree/admin/adjustment_reasons/index.html.erb +7 -6
- data/app/views/spree/admin/adjustment_reasons/new.html.erb +2 -0
- data/app/views/spree/admin/adjustment_reasons/shared/_form.html.erb +3 -3
- data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +4 -4
- data/app/views/spree/admin/adjustments/_form.html.erb +5 -5
- data/app/views/spree/admin/adjustments/edit.html.erb +1 -2
- data/app/views/spree/admin/adjustments/new.html.erb +0 -1
- data/app/views/spree/admin/cancellations/index.html.erb +6 -6
- data/app/views/spree/admin/countries/_form.html.erb +3 -3
- data/app/views/spree/admin/countries/edit.html.erb +1 -1
- data/app/views/spree/admin/countries/index.html.erb +4 -4
- data/app/views/spree/admin/countries/new.html.erb +1 -1
- data/app/views/spree/admin/customer_returns/_reimbursements_table.html.erb +4 -4
- data/app/views/spree/admin/customer_returns/_return_item_decision.html.erb +10 -10
- data/app/views/spree/admin/customer_returns/_return_item_selection.html.erb +11 -11
- data/app/views/spree/admin/customer_returns/edit.html.erb +2 -2
- data/app/views/spree/admin/customer_returns/index.html.erb +9 -10
- data/app/views/spree/admin/customer_returns/new.html.erb +2 -3
- data/app/views/spree/admin/general_settings/edit.html.erb +37 -26
- data/app/views/spree/admin/images/_form.html.erb +2 -2
- data/app/views/spree/admin/images/edit.html.erb +0 -1
- data/app/views/spree/admin/images/index.html.erb +2 -2
- data/app/views/spree/admin/images/new.html.erb +0 -3
- data/app/views/spree/admin/log_entries/index.html.erb +2 -2
- data/app/views/spree/admin/option_types/_form.html.erb +3 -3
- data/app/views/spree/admin/option_types/_option_value_fields.html.erb +1 -1
- data/app/views/spree/admin/option_types/edit.html.erb +7 -5
- data/app/views/spree/admin/option_types/index.html.erb +6 -7
- data/app/views/spree/admin/orders/_add_product.html.erb +1 -1
- data/app/views/spree/admin/orders/_adjustments.html.erb +4 -2
- data/app/views/spree/admin/orders/_carton.html.erb +7 -7
- data/app/views/spree/admin/orders/_carton_manifest.html.erb +3 -5
- data/app/views/spree/admin/orders/_form.html.erb +0 -1
- data/app/views/spree/admin/orders/_line_items.html.erb +10 -8
- data/app/views/spree/admin/orders/_line_items_edit_form.html.erb +0 -2
- data/app/views/spree/admin/orders/_risk_analysis.html.erb +3 -1
- data/app/views/spree/admin/orders/_shipment.html.erb +99 -100
- data/app/views/spree/admin/orders/_shipment_manifest.html.erb +4 -9
- data/app/views/spree/admin/orders/confirm/_line_items.html.erb +4 -4
- data/app/views/spree/admin/orders/confirm/_payments.html.erb +7 -7
- data/app/views/spree/admin/orders/confirm/_shipment.html.erb +10 -7
- data/app/views/spree/admin/orders/confirm/_shipment_manifest.html.erb +2 -2
- data/app/views/spree/admin/orders/customer_details/_form.html.erb +1 -5
- data/app/views/spree/admin/orders/index.html.erb +15 -14
- data/app/views/spree/admin/payment_methods/_form.html.erb +9 -10
- data/app/views/spree/admin/payment_methods/edit.html.erb +1 -1
- data/app/views/spree/admin/payment_methods/index.html.erb +18 -17
- data/app/views/spree/admin/payment_methods/new.html.erb +2 -2
- data/app/views/spree/admin/payments/_capture_events.html.erb +2 -2
- data/app/views/spree/admin/payments/_form.html.erb +3 -3
- data/app/views/spree/admin/payments/_list.html.erb +29 -17
- data/app/views/spree/admin/payments/credit.html.erb +3 -3
- data/app/views/spree/admin/payments/index.html.erb +3 -3
- data/app/views/spree/admin/payments/new.html.erb +2 -2
- data/app/views/spree/admin/payments/show.html.erb +3 -3
- data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +4 -4
- data/app/views/spree/admin/payments/source_views/_gateway.html.erb +4 -4
- data/app/views/spree/admin/payments/source_views/_storecredit.html.erb +5 -5
- data/app/views/spree/admin/product_properties/index.html.erb +6 -8
- data/app/views/spree/admin/products/_form.html.erb +33 -33
- data/app/views/spree/admin/products/_properties_form.erb +1 -1
- data/app/views/spree/admin/products/index.html.erb +10 -9
- data/app/views/spree/admin/products/new.html.erb +6 -5
- data/app/views/spree/admin/promotion_codes/index.csv.ruby +2 -2
- data/app/views/spree/admin/promotions/_actions.html.erb +2 -2
- data/app/views/spree/admin/promotions/_form.html.erb +2 -2
- data/app/views/spree/admin/promotions/_rules.html.erb +1 -1
- data/app/views/spree/admin/promotions/actions/_promotion_calculators_with_custom_fields.html.erb +1 -1
- data/app/views/spree/admin/promotions/calculators/tiered_flat_rate/_fields.html.erb +1 -1
- data/app/views/spree/admin/promotions/calculators/tiered_percent/_fields.html.erb +1 -1
- data/app/views/spree/admin/promotions/index.html.erb +15 -16
- data/app/views/spree/admin/promotions/rules/_item_total.html.erb +5 -2
- data/app/views/spree/admin/promotions/rules/_option_value.html.erb +3 -3
- data/app/views/spree/admin/properties/_form.html.erb +2 -2
- data/app/views/spree/admin/properties/index.html.erb +8 -9
- data/app/views/spree/admin/prototypes/_form.html.erb +4 -4
- data/app/views/spree/admin/prototypes/_prototypes.html.erb +2 -2
- data/app/views/spree/admin/prototypes/index.html.erb +7 -10
- data/app/views/spree/admin/prototypes/new.js.erb +1 -1
- data/app/views/spree/admin/prototypes/show.html.erb +1 -1
- data/app/views/spree/admin/refund_reasons/edit.html.erb +2 -0
- data/app/views/spree/admin/refund_reasons/index.html.erb +7 -8
- data/app/views/spree/admin/refund_reasons/new.html.erb +2 -0
- data/app/views/spree/admin/refund_reasons/shared/_form.html.erb +2 -2
- data/app/views/spree/admin/refunds/edit.html.erb +3 -4
- data/app/views/spree/admin/refunds/new.html.erb +4 -5
- data/app/views/spree/admin/reimbursement_types/index.html.erb +4 -4
- data/app/views/spree/admin/reimbursements/edit.html.erb +10 -11
- data/app/views/spree/admin/reimbursements/index.html.erb +4 -6
- data/app/views/spree/admin/reimbursements/show.html.erb +12 -12
- data/app/views/spree/admin/return_authorizations/_form.html.erb +15 -15
- data/app/views/spree/admin/return_authorizations/edit.html.erb +1 -2
- data/app/views/spree/admin/return_authorizations/index.html.erb +5 -5
- data/app/views/spree/admin/return_authorizations/new.html.erb +1 -2
- data/app/views/spree/admin/return_reasons/index.html.erb +2 -2
- data/app/views/spree/admin/shared/_address_form.html.erb +10 -10
- data/app/views/spree/admin/shared/_areas_tabs.html.erb +19 -0
- data/app/views/spree/admin/shared/_calculator_fields.html.erb +2 -2
- data/app/views/spree/admin/shared/_configuration_menu.html.erb +9 -64
- data/app/views/spree/admin/shared/_destroy.js.erb +0 -2
- data/app/views/spree/admin/shared/_edit_resource_links.html.erb +0 -1
- data/app/views/spree/admin/shared/_flash.html.erb +11 -0
- data/app/views/spree/admin/shared/_general_tabs.html.erb +2 -0
- data/app/views/spree/admin/shared/_head.html.erb +10 -1
- data/app/views/spree/admin/shared/_header.html.erb +13 -5
- data/app/views/spree/admin/shared/_navigation.html.erb +1 -1
- data/app/views/spree/admin/shared/_navigation_header.html.erb +5 -0
- data/app/views/spree/admin/shared/_new_resource_links.html.erb +0 -1
- data/app/views/spree/admin/shared/_no_objects_found.html.erb +4 -0
- data/app/views/spree/admin/shared/_order_submenu.html.erb +18 -18
- data/app/views/spree/admin/shared/_order_summary.html.erb +12 -12
- data/app/views/spree/admin/shared/_order_tabs.html.erb +4 -1
- data/app/views/spree/admin/shared/_payments_tabs.html.erb +9 -0
- data/app/views/spree/admin/shared/_product_sub_menu.html.erb +2 -2
- data/app/views/spree/admin/shared/_product_tabs.html.erb +9 -14
- data/app/views/spree/admin/shared/_promotion_sub_menu.html.erb +1 -1
- data/app/views/spree/admin/shared/_refunds.html.erb +6 -6
- data/app/views/spree/admin/shared/_settings_checkout_tabs.html.erb +21 -0
- data/app/views/spree/admin/shared/_settings_sub_menu.html.erb +26 -0
- data/app/views/spree/admin/shared/_shipping_tabs.html.erb +17 -0
- data/app/views/spree/admin/shared/_spinner.html.erb +6 -0
- data/app/views/spree/admin/shared/_stock_sub_menu.html.erb +3 -3
- data/app/views/spree/admin/shared/_table_filter.html.erb +1 -1
- data/app/views/spree/admin/shared/_tabs.html.erb +4 -2
- data/app/views/spree/admin/shared/_taxes_tabs.html.erb +13 -0
- data/app/views/spree/admin/shared/_variant_search.html.erb +2 -2
- data/app/views/spree/admin/shared/named_types/_edit.html.erb +2 -0
- data/app/views/spree/admin/shared/named_types/_form.html.erb +3 -5
- data/app/views/spree/admin/shared/named_types/_index.html.erb +4 -5
- data/app/views/spree/admin/shared/named_types/_new.html.erb +2 -0
- data/app/views/spree/admin/shipping_categories/_form.html.erb +2 -2
- data/app/views/spree/admin/shipping_categories/edit.html.erb +1 -1
- data/app/views/spree/admin/shipping_categories/index.html.erb +6 -7
- data/app/views/spree/admin/shipping_categories/new.html.erb +1 -1
- data/app/views/spree/admin/shipping_methods/_form.html.erb +26 -8
- data/app/views/spree/admin/shipping_methods/edit.html.erb +1 -1
- data/app/views/spree/admin/shipping_methods/index.html.erb +10 -11
- data/app/views/spree/admin/shipping_methods/new.html.erb +1 -1
- data/app/views/spree/admin/states/_form.html.erb +2 -2
- data/app/views/spree/admin/states/_state_list.html.erb +3 -3
- data/app/views/spree/admin/states/edit.html.erb +1 -1
- data/app/views/spree/admin/states/index.html.erb +3 -3
- data/app/views/spree/admin/states/new.html.erb +1 -1
- data/app/views/spree/admin/stock_items/_stock_management.html.erb +15 -27
- data/app/views/spree/admin/stock_items/index.html.erb +1 -3
- data/app/views/spree/admin/stock_locations/_form.html.erb +17 -18
- data/app/views/spree/admin/stock_locations/_transfer_stock_form.html.erb +2 -3
- data/app/views/spree/admin/stock_locations/edit.html.erb +1 -1
- data/app/views/spree/admin/stock_locations/index.html.erb +9 -10
- data/app/views/spree/admin/stock_locations/new.html.erb +1 -1
- data/app/views/spree/admin/stock_movements/_form.html.erb +2 -2
- data/app/views/spree/admin/stock_movements/index.html.erb +8 -9
- data/app/views/spree/admin/stock_transfers/_stock_movements.html.erb +4 -4
- data/app/views/spree/admin/stock_transfers/_transfer_item_actions.html.erb +1 -1
- data/app/views/spree/admin/stock_transfers/_transfer_item_table.html.erb +1 -1
- data/app/views/spree/admin/stock_transfers/edit.html.erb +8 -21
- data/app/views/spree/admin/stock_transfers/index.html.erb +8 -6
- data/app/views/spree/admin/stock_transfers/new.html.erb +2 -3
- data/app/views/spree/admin/stock_transfers/receive.html.erb +6 -21
- data/app/views/spree/admin/stock_transfers/show.html.erb +8 -8
- data/app/views/spree/admin/stock_transfers/tracking_info.html.erb +10 -23
- data/app/views/spree/admin/store_credits/_form.html.erb +3 -3
- data/app/views/spree/admin/store_credits/_update_reason_field.html.erb +1 -1
- data/app/views/spree/admin/store_credits/edit_amount.html.erb +1 -1
- data/app/views/spree/admin/store_credits/edit_validity.html.erb +0 -1
- data/app/views/spree/admin/store_credits/index.html.erb +11 -12
- data/app/views/spree/admin/store_credits/show.html.erb +11 -11
- data/app/views/spree/admin/style_guide/topics/components/_tabs.html.erb +17 -0
- data/app/views/spree/admin/style_guide/topics/forms/_building_forms.html.erb +2 -2
- data/app/views/spree/admin/style_guide/topics/messaging/_tooltips.html.erb +1 -1
- data/app/views/spree/admin/tax_categories/_form.html.erb +5 -7
- data/app/views/spree/admin/tax_categories/edit.html.erb +1 -1
- data/app/views/spree/admin/tax_categories/index.html.erb +8 -9
- data/app/views/spree/admin/tax_categories/new.html.erb +1 -1
- data/app/views/spree/admin/tax_categories/show.html.erb +1 -1
- data/app/views/spree/admin/tax_rates/_form.html.erb +4 -4
- data/app/views/spree/admin/tax_rates/edit.html.erb +1 -1
- data/app/views/spree/admin/tax_rates/index.html.erb +12 -13
- data/app/views/spree/admin/tax_rates/new.html.erb +2 -2
- data/app/views/spree/admin/taxonomies/_form.html.erb +1 -1
- data/app/views/spree/admin/taxonomies/_list.html.erb +1 -1
- data/app/views/spree/admin/taxonomies/edit.erb +0 -3
- data/app/views/spree/admin/taxonomies/index.html.erb +4 -7
- data/app/views/spree/admin/taxonomies/new.html.erb +1 -3
- data/app/views/spree/admin/taxons/_form.html.erb +8 -7
- data/app/views/spree/admin/taxons/_taxon_table.html.erb +1 -1
- data/app/views/spree/admin/taxons/edit.html.erb +1 -4
- data/app/views/spree/admin/taxons/index.html.erb +1 -1
- data/app/views/spree/admin/trackers/_form.html.erb +3 -3
- data/app/views/spree/admin/trackers/edit.html.erb +1 -1
- data/app/views/spree/admin/trackers/index.html.erb +7 -8
- data/app/views/spree/admin/trackers/new.html.erb +1 -1
- data/app/views/spree/admin/users/_addresses_form.html.erb +2 -4
- data/app/views/spree/admin/users/_form.html.erb +6 -6
- data/app/views/spree/admin/users/_sidebar.html.erb +5 -5
- data/app/views/spree/admin/users/addresses.html.erb +1 -1
- data/app/views/spree/admin/users/edit.html.erb +0 -2
- data/app/views/spree/admin/users/index.html.erb +2 -2
- data/app/views/spree/admin/users/items.html.erb +11 -12
- data/app/views/spree/admin/users/orders.html.erb +9 -10
- data/app/views/spree/admin/variants/_form.html.erb +60 -34
- data/app/views/spree/admin/variants/_table.html.erb +47 -0
- data/app/views/spree/admin/variants/_table_filter.html.erb +25 -0
- data/app/views/spree/admin/variants/edit.html.erb +6 -1
- data/app/views/spree/admin/variants/index.html.erb +28 -112
- data/app/views/spree/admin/variants/new.html.erb +1 -1
- data/app/views/spree/admin/variants/new.js.erb +2 -3
- data/app/views/spree/admin/zones/_country_members.html.erb +2 -2
- data/app/views/spree/admin/zones/_form.html.erb +3 -3
- data/app/views/spree/admin/zones/_state_members.html.erb +2 -2
- data/app/views/spree/admin/zones/edit.html.erb +1 -1
- data/app/views/spree/admin/zones/index.html.erb +9 -10
- data/app/views/spree/admin/zones/new.html.erb +1 -1
- data/app/views/spree/layouts/admin.html.erb +15 -33
- data/config/initializers/assets.rb +7 -1
- data/config/initializers/form_builder.rb +2 -3
- data/config/routes.rb +12 -11
- data/lib/spree/backend.rb +1 -0
- data/lib/spree/backend/action_callbacks.rb +0 -1
- data/lib/spree/backend/callbacks.rb +3 -5
- data/lib/spree/backend/engine.rb +1 -14
- data/script/rails +0 -1
- data/solidus_backend.gemspec +1 -0
- data/spec/controllers/spree/admin/base_controller_spec.rb +2 -2
- data/spec/controllers/spree/admin/cancellations_controller_spec.rb +2 -2
- data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +6 -7
- data/spec/controllers/spree/admin/general_settings_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/missing_products_controller_spec.rb +2 -4
- data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +0 -1
- data/spec/controllers/spree/admin/orders_controller_spec.rb +27 -91
- data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +38 -13
- data/spec/controllers/spree/admin/payments_controller_spec.rb +108 -104
- data/spec/controllers/spree/admin/products_controller_spec.rb +7 -7
- data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +3 -3
- data/spec/controllers/spree/admin/promotion_codes_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +3 -3
- data/spec/controllers/spree/admin/promotions_controller_spec.rb +6 -9
- data/spec/controllers/spree/admin/refunds_controller_spec.rb +0 -1
- data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +3 -3
- data/spec/controllers/spree/admin/reports_controller_spec.rb +14 -9
- data/spec/controllers/spree/admin/resource_controller_spec.rb +6 -6
- data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +13 -13
- data/spec/controllers/spree/admin/return_items_controller_spec.rb +2 -2
- data/spec/controllers/spree/admin/search_controller_spec.rb +2 -2
- data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +3 -3
- data/spec/controllers/spree/admin/stock_items_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +8 -7
- data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +13 -25
- data/spec/controllers/spree/admin/store_credits_controller_spec.rb +3 -4
- data/spec/controllers/spree/admin/users_controller_spec.rb +19 -19
- data/spec/controllers/spree/admin/variants_controller_spec.rb +7 -6
- data/spec/features/admin/configuration/analytics_tracker_spec.rb +3 -3
- data/spec/features/admin/configuration/countries_spec.rb +1 -1
- data/spec/features/admin/configuration/general_settings_spec.rb +12 -2
- data/spec/features/admin/configuration/payment_methods_spec.rb +13 -12
- data/spec/features/admin/configuration/shipping_methods_spec.rb +7 -7
- data/spec/features/admin/configuration/states_spec.rb +12 -12
- data/spec/features/admin/configuration/stock_locations_spec.rb +5 -4
- data/spec/features/admin/configuration/tax_categories_spec.rb +6 -6
- data/spec/features/admin/configuration/tax_rates_spec.rb +4 -4
- data/spec/features/admin/configuration/taxonomies_spec.rb +6 -6
- data/spec/features/admin/configuration/zones_spec.rb +6 -6
- data/spec/features/admin/homepage_spec.rb +2 -5
- data/spec/features/admin/locale_spec.rb +9 -7
- data/spec/features/admin/orders/adjustments_promotions_spec.rb +15 -15
- data/spec/features/admin/orders/adjustments_spec.rb +17 -18
- data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +1 -2
- data/spec/features/admin/orders/cancelling_inventory_spec.rb +1 -1
- data/spec/features/admin/orders/customer_details_spec.rb +12 -12
- data/spec/features/admin/orders/line_items_spec.rb +3 -3
- data/spec/features/admin/orders/listing_spec.rb +21 -1
- data/spec/features/admin/orders/log_entries_spec.rb +7 -7
- data/spec/features/admin/orders/new_order_spec.rb +7 -7
- data/spec/features/admin/orders/order_details_spec.rb +41 -29
- data/spec/features/admin/orders/payments_spec.rb +20 -28
- data/spec/features/admin/orders/risk_analysis_spec.rb +2 -2
- data/spec/features/admin/orders/shipments_spec.rb +11 -6
- data/spec/features/admin/products/edit/images_spec.rb +14 -14
- data/spec/features/admin/products/edit/products_spec.rb +10 -10
- data/spec/features/admin/products/edit/taxons_spec.rb +2 -2
- data/spec/features/admin/products/edit/variants_spec.rb +9 -9
- data/spec/features/admin/products/option_types_spec.rb +11 -12
- data/spec/features/admin/products/products_spec.rb +66 -68
- data/spec/features/admin/products/properties_spec.rb +14 -14
- data/spec/features/admin/products/prototypes_spec.rb +3 -3
- data/spec/features/admin/products/stock_management_spec.rb +16 -11
- data/spec/features/admin/products/variant_spec.rb +4 -4
- data/spec/features/admin/promotion_adjustments_spec.rb +41 -41
- data/spec/features/admin/reports_spec.rb +9 -9
- data/spec/features/admin/stock_transfer_spec.rb +8 -22
- data/spec/features/admin/store_credits_spec.rb +0 -1
- data/spec/features/admin/taxons_spec.rb +5 -6
- data/spec/features/admin/users_spec.rb +6 -9
- data/spec/helpers/admin/base_helper_spec.rb +1 -2
- data/spec/helpers/admin/navigation_helper_spec.rb +15 -18
- data/spec/helpers/admin/reimbursements_helper_spec.rb +3 -3
- data/spec/helpers/admin/stock_movements_helper_spec.rb +1 -3
- data/spec/helpers/admin/store_credit_events_helper_spec.rb +3 -3
- data/spec/helpers/promotion_rules_helper_spec.rb +1 -1
- data/spec/spec_helper.rb +7 -4
- data/spec/support/feature/base_feature_helper.rb +3 -3
- data/vendor/assets/javascripts/{backbone.js → solidus_admin/backbone.js} +764 -452
- data/vendor/assets/javascripts/solidus_admin/bind-polyfill.js +28 -0
- data/vendor/assets/javascripts/solidus_admin/bootstrap.js +3560 -0
- data/vendor/assets/javascripts/solidus_admin/tether.js +1726 -0
- data/vendor/assets/javascripts/solidus_admin/underscore.js +1548 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_alert.scss +65 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_animation.scss +27 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_breadcrumb.scss +23 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_button-group.scss +224 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_buttons.scss +173 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_card.scss +292 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_carousel.scss +252 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_close.scss +28 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_code.scss +58 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_custom-forms.scss +226 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_dropdown.scss +193 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_forms.scss +452 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_grid.scss +76 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_images.scss +53 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_input-group.scss +189 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_jumbotron.scss +20 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_labels.scss +77 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_list-group.scss +140 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_media.scss +90 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_mixins.scss +55 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_modal.scss +146 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_nav.scss +162 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_navbar.scss +230 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_normalize.scss +428 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_pager.scss +57 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_pagination.scss +73 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_popover.scss +140 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_print.scss +88 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_progress.scss +156 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_reboot.scss +347 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_responsive-embed.scss +39 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_tables.scss +193 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_tooltip.scss +85 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_type.scss +157 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_utilities-background.scss +24 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_utilities-responsive.scss +49 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_utilities-spacing.scss +39 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_utilities.scss +95 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_variables.scss +666 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/bootstrap-flex.scss +8 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/bootstrap-grid.scss +62 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/bootstrap-reboot.scss +10 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/bootstrap.scss +56 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_alert.scss +14 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_background-variant.scss +13 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_border-radius.scss +35 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_breakpoints.scss +86 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_buttons.scss +100 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_cards.scss +38 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_center-block.scss +7 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_clearfix.scss +7 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_forms.scss +89 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_gradients.scss +43 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_grid-framework.scss +44 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_grid.scss +75 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_hover.scss +59 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_image.scss +34 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_label.scss +11 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_list-group.scss +30 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_lists.scss +7 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_nav-divider.scss +10 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_navbar-align.scss +9 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_pagination.scss +22 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_progress.scss +18 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_pulls.scss +6 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_reset-filter.scss +8 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_reset-text.scss +18 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_resize.scss +6 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_screen-reader.scss +32 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_size.scss +6 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_tab-focus.scss +9 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_table-row.scss +30 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_text-emphasis.scss +12 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_text-hide.scss +8 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/mixins/_text-truncate.scss +8 -0
- metadata +140 -35
- data/app/assets/javascripts/spree/backend/orders/edit_form.js +0 -20
- data/app/assets/javascripts/spree/backend/shipments.js.erb +0 -353
- data/app/assets/javascripts/spree/backend/stock_management/index.coffee +0 -4
- data/app/assets/javascripts/spree/backend/stock_transfers/ship.js.coffee +0 -10
- data/app/assets/javascripts/spree/backend/taxon_tree_menu.js.coffee +0 -21
- data/app/assets/javascripts/spree/frontend/backend.js +0 -1
- data/app/assets/stylesheets/spree/backend/components/_pagination.scss +0 -17
- data/app/assets/stylesheets/spree/backend/plugins/_powertip.scss +0 -87
- data/app/assets/stylesheets/spree/backend/plugins/_token-input.scss +0 -110
- data/app/assets/stylesheets/spree/frontend/backend.css +0 -1
- data/app/views/spree/admin/orders/_line_item.html.erb +0 -9
- data/app/views/spree/admin/shared/_content_header.html.erb +0 -23
- data/app/views/spree/admin/shared/_show_resource_links.html.erb +0 -5
- data/app/views/spree/admin/shared/_update_order_state.js +0 -7
- data/vendor/assets/javascripts/jquery.cookie.js +0 -41
- data/vendor/assets/javascripts/jquery.powertip.js +0 -1165
- data/vendor/assets/javascripts/underscore-min.js +0 -1227
- data/vendor/assets/stylesheets/bootstrap/components/_media.scss +0 -61
- data/vendor/assets/stylesheets/jquery.powertip.css +0 -85
@@ -1,110 +0,0 @@
|
|
1
|
-
/* Example tokeninput style #1: Token vertical list*/
|
2
|
-
ul.token-input-list {
|
3
|
-
overflow: hidden;
|
4
|
-
height: auto !important;
|
5
|
-
height: 1%;
|
6
|
-
width: 100%;
|
7
|
-
border: 1px solid $color-border;
|
8
|
-
border-radius: 3px;
|
9
|
-
cursor: text;
|
10
|
-
font-size: 90%;
|
11
|
-
padding: 4px 10px;
|
12
|
-
font-family: Verdana;
|
13
|
-
z-index: 999;
|
14
|
-
margin: 0;
|
15
|
-
background-color: #fff;
|
16
|
-
}
|
17
|
-
|
18
|
-
ul.token-input-list li {
|
19
|
-
list-style-type: none;
|
20
|
-
}
|
21
|
-
|
22
|
-
ul.token-input-list li input {
|
23
|
-
border: 0;
|
24
|
-
width: 350px;
|
25
|
-
padding: 3px 8px;
|
26
|
-
background-color: $color-1;
|
27
|
-
}
|
28
|
-
|
29
|
-
li.token-input-token {
|
30
|
-
overflow: hidden;
|
31
|
-
height: auto !important;
|
32
|
-
height: 1%;
|
33
|
-
margin: 3px;
|
34
|
-
padding: 3px 5px;
|
35
|
-
color: #000;
|
36
|
-
font-weight: $font-weight-bold;
|
37
|
-
cursor: default;
|
38
|
-
display: block;
|
39
|
-
}
|
40
|
-
|
41
|
-
li.token-input-token p {
|
42
|
-
float: left;
|
43
|
-
padding: 0;
|
44
|
-
margin: 0;
|
45
|
-
}
|
46
|
-
|
47
|
-
li.token-input-token span {
|
48
|
-
float: right;
|
49
|
-
color: #777;
|
50
|
-
cursor: pointer;
|
51
|
-
}
|
52
|
-
|
53
|
-
li.token-input-selected-token {
|
54
|
-
background-color: #08844e;
|
55
|
-
color: #fff;
|
56
|
-
}
|
57
|
-
|
58
|
-
li.token-input-selected-token span {
|
59
|
-
color: #bbb;
|
60
|
-
}
|
61
|
-
|
62
|
-
div.token-input-dropdown {
|
63
|
-
position: absolute;
|
64
|
-
width: 400px;
|
65
|
-
background-color: #fff;
|
66
|
-
overflow: hidden;
|
67
|
-
border-left: 1px solid #ccc;
|
68
|
-
border-right: 1px solid #ccc;
|
69
|
-
border-bottom: 1px solid #ccc;
|
70
|
-
cursor: default;
|
71
|
-
font-size: 12px;
|
72
|
-
font-family: Verdana;
|
73
|
-
z-index: 1;
|
74
|
-
}
|
75
|
-
|
76
|
-
div.token-input-dropdown p {
|
77
|
-
margin: 0;
|
78
|
-
padding: 5px;
|
79
|
-
font-weight: $font-weight-bold;
|
80
|
-
color: #777;
|
81
|
-
}
|
82
|
-
|
83
|
-
div.token-input-dropdown ul {
|
84
|
-
margin: 0;
|
85
|
-
padding: 0;
|
86
|
-
}
|
87
|
-
|
88
|
-
div.token-input-dropdown ul li {
|
89
|
-
background-color: #fff;
|
90
|
-
padding: 3px;
|
91
|
-
list-style-type: none;
|
92
|
-
}
|
93
|
-
|
94
|
-
div.token-input-dropdown ul li.token-input-dropdown-item {
|
95
|
-
background-color: #fafafa;
|
96
|
-
}
|
97
|
-
|
98
|
-
div.token-input-dropdown ul li.token-input-dropdown-item2 {
|
99
|
-
background-color: #fff;
|
100
|
-
}
|
101
|
-
|
102
|
-
div.token-input-dropdown ul li em {
|
103
|
-
font-weight: $font-weight-bold;
|
104
|
-
font-style: normal;
|
105
|
-
}
|
106
|
-
|
107
|
-
li.token-input-token, div.token-input-dropdown ul li.token-input-selected-dropdown-item {
|
108
|
-
background-color: #BBDAFD;
|
109
|
-
}
|
110
|
-
|
@@ -1 +0,0 @@
|
|
1
|
-
/* Placeholder for backend dummy app */
|
@@ -1,9 +0,0 @@
|
|
1
|
-
<tr id="<%= spree_dom_id(f.object) %>" data-hook="admin_order_form_line_item_row" class="<%= cycle('odd', 'even')%>">
|
2
|
-
<td><%=f.object.variant.product.name%> <%= "(#{f.object.variant.options_text})" unless f.object.variant.option_values.empty? %></td>
|
3
|
-
<td class="price align-center"><%= f.object.single_money %></td>
|
4
|
-
<td class="qty"><%= f.number_field :quantity, :min => 0, :class => "qty" %></td>
|
5
|
-
<td class="total align-center"><%= f.object.display_amount %></td>
|
6
|
-
<td data-hook="admin_order_form_line_item_actions" class="actions">
|
7
|
-
<%= link_to_delete f.object, {:url => admin_order_line_item_url(@order.number, f.object), :no_text => true} %>
|
8
|
-
</td>
|
9
|
-
</tr>
|
@@ -1,23 +0,0 @@
|
|
1
|
-
<% if content_for?(:page_title) || content_for?(:page_actions) %>
|
2
|
-
<div id="content-header" data-hook>
|
3
|
-
<div class="container">
|
4
|
-
<div class="sixteen columns">
|
5
|
-
<div class="block-table">
|
6
|
-
<% if content_for?(:page_title) %>
|
7
|
-
<div class="table-cell">
|
8
|
-
<h1 class="page-title <%= yield :page_title_classes %>"><%= yield :page_title %></h1>
|
9
|
-
</div>
|
10
|
-
<% end %>
|
11
|
-
|
12
|
-
<% if content_for?(:page_actions) %>
|
13
|
-
<div class="page-actions table-cell toolbar" data-hook="toolbar">
|
14
|
-
<ul class="inline-menu">
|
15
|
-
<%= yield :page_actions %>
|
16
|
-
</ul>
|
17
|
-
</div>
|
18
|
-
<% end %>
|
19
|
-
</div>
|
20
|
-
</div>
|
21
|
-
</div>
|
22
|
-
</div>
|
23
|
-
<% end %>
|
@@ -1,5 +0,0 @@
|
|
1
|
-
<p class="actions" data-hook="actions">
|
2
|
-
<%= link_to Spree.t(:edit), edit_object_url %> |
|
3
|
-
<%= link_to Spree.t(:back), collection_url %> |
|
4
|
-
<%= link_to Spree.t(:delete), object_url, :method => :delete, :data => { :confirm => Spree.t(:are_you_sure_you_want_to_delete_this_record) } %>
|
5
|
-
</p>
|
@@ -1,7 +0,0 @@
|
|
1
|
-
$('#order_tab_summary h5#order_status').html('<%= j Spree.t(:status) %>: <%= j Spree.t(@order.state, :scope => :order_state) %>');
|
2
|
-
$('#order_tab_summary h5#order_total').html('<%= j Spree.t(:total) %>: <%= j @order.display_total.to_html %>');
|
3
|
-
|
4
|
-
<% if @order.completed? %>
|
5
|
-
$('#order_tab_summary h5#payment_status').html('<%= j Spree.t(:payment) %>: <%= j Spree.t(@order.payment_state, :scope => :payment_states, :default => [:missing, "none"]) %>');
|
6
|
-
$('#order_tab_summary h5#shipment_status').html('<%= j Spree.t(:shipment) %>: <%= j Spree.t(@order.shipment_state, :scope => :shipment_state, :default => [:missing, "none"]) %>');
|
7
|
-
<% end %>
|
@@ -1,41 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* jQuery Cookie plugin
|
3
|
-
*
|
4
|
-
* Copyright (c) 2010 Klaus Hartl (stilbuero.de)
|
5
|
-
* Dual licensed under the MIT and GPL licenses:
|
6
|
-
* http://www.opensource.org/licenses/mit-license.php
|
7
|
-
* http://www.gnu.org/licenses/gpl.html
|
8
|
-
*
|
9
|
-
*/
|
10
|
-
jQuery.cookie = function (key, value, options) {
|
11
|
-
|
12
|
-
// key and at least value given, set cookie...
|
13
|
-
if (arguments.length > 1 && String(value) !== "[object Object]") {
|
14
|
-
options = jQuery.extend({}, options);
|
15
|
-
|
16
|
-
if (value === null || value === undefined) {
|
17
|
-
options.expires = -1;
|
18
|
-
}
|
19
|
-
|
20
|
-
if (typeof options.expires === 'number') {
|
21
|
-
var days = options.expires, t = options.expires = new Date();
|
22
|
-
t.setDate(t.getDate() + days);
|
23
|
-
}
|
24
|
-
|
25
|
-
value = String(value);
|
26
|
-
|
27
|
-
return (document.cookie = [
|
28
|
-
encodeURIComponent(key), '=',
|
29
|
-
options.raw ? value : encodeURIComponent(value),
|
30
|
-
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
31
|
-
options.path ? '; path=' + options.path : '',
|
32
|
-
options.domain ? '; domain=' + options.domain : '',
|
33
|
-
options.secure ? '; secure' : ''
|
34
|
-
].join(''));
|
35
|
-
}
|
36
|
-
|
37
|
-
// key and possibly options given, get cookie...
|
38
|
-
options = value || {};
|
39
|
-
var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
|
40
|
-
return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
|
41
|
-
};
|
@@ -1,1165 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
PowerTip - v1.2.0 - 2013-04-03
|
3
|
-
http://stevenbenner.github.com/jquery-powertip/
|
4
|
-
Copyright (c) 2013 Steven Benner (http://stevenbenner.com/).
|
5
|
-
Released under MIT license.
|
6
|
-
https://raw.github.com/stevenbenner/jquery-powertip/master/LICENSE.txt
|
7
|
-
*/
|
8
|
-
(function(factory) {
|
9
|
-
if (typeof define === 'function' && define.amd) {
|
10
|
-
// AMD. Register as an anonymous module.
|
11
|
-
define(['jquery'], factory);
|
12
|
-
} else {
|
13
|
-
// Browser globals
|
14
|
-
factory(jQuery);
|
15
|
-
}
|
16
|
-
}(function($) {
|
17
|
-
// useful private variables
|
18
|
-
var $document = $(document),
|
19
|
-
$window = $(window),
|
20
|
-
$body = $('body');
|
21
|
-
|
22
|
-
// constants
|
23
|
-
var DATA_DISPLAYCONTROLLER = 'displayController',
|
24
|
-
DATA_HASACTIVEHOVER = 'hasActiveHover',
|
25
|
-
DATA_FORCEDOPEN = 'forcedOpen',
|
26
|
-
DATA_HASMOUSEMOVE = 'hasMouseMove',
|
27
|
-
DATA_MOUSEONTOTIP = 'mouseOnToPopup',
|
28
|
-
DATA_ORIGINALTITLE = 'originalTitle',
|
29
|
-
DATA_POWERTIP = 'powertip',
|
30
|
-
DATA_POWERTIPJQ = 'powertipjq',
|
31
|
-
DATA_POWERTIPTARGET = 'powertiptarget',
|
32
|
-
RAD2DEG = 180 / Math.PI;
|
33
|
-
|
34
|
-
/**
|
35
|
-
* Session data
|
36
|
-
* Private properties global to all powerTip instances
|
37
|
-
*/
|
38
|
-
var session = {
|
39
|
-
isTipOpen: false,
|
40
|
-
isFixedTipOpen: false,
|
41
|
-
isClosing: false,
|
42
|
-
tipOpenImminent: false,
|
43
|
-
activeHover: null,
|
44
|
-
currentX: 0,
|
45
|
-
currentY: 0,
|
46
|
-
previousX: 0,
|
47
|
-
previousY: 0,
|
48
|
-
desyncTimeout: null,
|
49
|
-
mouseTrackingActive: false,
|
50
|
-
delayInProgress: false,
|
51
|
-
windowWidth: 0,
|
52
|
-
windowHeight: 0,
|
53
|
-
scrollTop: 0,
|
54
|
-
scrollLeft: 0
|
55
|
-
};
|
56
|
-
|
57
|
-
/**
|
58
|
-
* Collision enumeration
|
59
|
-
* @enum {number}
|
60
|
-
*/
|
61
|
-
var Collision = {
|
62
|
-
none: 0,
|
63
|
-
top: 1,
|
64
|
-
bottom: 2,
|
65
|
-
left: 4,
|
66
|
-
right: 8
|
67
|
-
};
|
68
|
-
|
69
|
-
/**
|
70
|
-
* Display hover tooltips on the matched elements.
|
71
|
-
* @param {(Object|string)} opts The options object to use for the plugin, or
|
72
|
-
* the name of a method to invoke on the first matched element.
|
73
|
-
* @param {*=} [arg] Argument for an invoked method (optional).
|
74
|
-
* @return {jQuery} jQuery object for the matched selectors.
|
75
|
-
*/
|
76
|
-
$.fn.powerTip = function(opts, arg) {
|
77
|
-
// don't do any work if there were no matched elements
|
78
|
-
if (!this.length) {
|
79
|
-
return this;
|
80
|
-
}
|
81
|
-
|
82
|
-
// handle api method calls on the plugin, e.g. powerTip('hide')
|
83
|
-
if ($.type(opts) === 'string' && $.powerTip[opts]) {
|
84
|
-
return $.powerTip[opts].call(this, this, arg);
|
85
|
-
}
|
86
|
-
|
87
|
-
// extend options and instantiate TooltipController
|
88
|
-
var options = $.extend({}, $.fn.powerTip.defaults, opts),
|
89
|
-
tipController = new TooltipController(options);
|
90
|
-
|
91
|
-
// hook mouse and viewport dimension tracking
|
92
|
-
initTracking();
|
93
|
-
|
94
|
-
// setup the elements
|
95
|
-
this.each(function elementSetup() {
|
96
|
-
var $this = $(this),
|
97
|
-
dataPowertip = $this.data(DATA_POWERTIP),
|
98
|
-
dataElem = $this.data(DATA_POWERTIPJQ),
|
99
|
-
dataTarget = $this.data(DATA_POWERTIPTARGET),
|
100
|
-
title;
|
101
|
-
|
102
|
-
// handle repeated powerTip calls on the same element by destroying the
|
103
|
-
// original instance hooked to it and replacing it with this call
|
104
|
-
if ($this.data(DATA_DISPLAYCONTROLLER)) {
|
105
|
-
$.powerTip.destroy($this);
|
106
|
-
}
|
107
|
-
|
108
|
-
// attempt to use title attribute text if there is no data-powertip,
|
109
|
-
// data-powertipjq or data-powertiptarget. If we do use the title
|
110
|
-
// attribute, delete the attribute so the browser will not show it
|
111
|
-
title = $this.attr('title');
|
112
|
-
if (!dataPowertip && !dataTarget && !dataElem && title) {
|
113
|
-
$this.data(DATA_POWERTIP, title);
|
114
|
-
$this.data(DATA_ORIGINALTITLE, title);
|
115
|
-
$this.removeAttr('title');
|
116
|
-
}
|
117
|
-
|
118
|
-
// create hover controllers for each element
|
119
|
-
$this.data(
|
120
|
-
DATA_DISPLAYCONTROLLER,
|
121
|
-
new DisplayController($this, options, tipController)
|
122
|
-
);
|
123
|
-
});
|
124
|
-
|
125
|
-
// attach events to matched elements if the manual options is not enabled
|
126
|
-
if (!options.manual) {
|
127
|
-
this.on({
|
128
|
-
// mouse events
|
129
|
-
'mouseenter.powertip': function elementMouseEnter(event) {
|
130
|
-
$.powerTip.show(this, event);
|
131
|
-
},
|
132
|
-
'mouseleave.powertip': function elementMouseLeave() {
|
133
|
-
$.powerTip.hide(this);
|
134
|
-
},
|
135
|
-
// keyboard events
|
136
|
-
'focus.powertip': function elementFocus() {
|
137
|
-
$.powerTip.show(this);
|
138
|
-
},
|
139
|
-
'blur.powertip': function elementBlur() {
|
140
|
-
$.powerTip.hide(this, true);
|
141
|
-
},
|
142
|
-
'keydown.powertip': function elementKeyDown(event) {
|
143
|
-
// close tooltip when the escape key is pressed
|
144
|
-
if (event.keyCode === 27) {
|
145
|
-
$.powerTip.hide(this, true);
|
146
|
-
}
|
147
|
-
}
|
148
|
-
});
|
149
|
-
}
|
150
|
-
|
151
|
-
return this;
|
152
|
-
};
|
153
|
-
|
154
|
-
/**
|
155
|
-
* Default options for the powerTip plugin.
|
156
|
-
*/
|
157
|
-
$.fn.powerTip.defaults = {
|
158
|
-
fadeInTime: 200,
|
159
|
-
fadeOutTime: 100,
|
160
|
-
followMouse: false,
|
161
|
-
popupId: 'powerTip',
|
162
|
-
intentSensitivity: 7,
|
163
|
-
intentPollInterval: 100,
|
164
|
-
closeDelay: 100,
|
165
|
-
placement: 'n',
|
166
|
-
smartPlacement: false,
|
167
|
-
offset: 10,
|
168
|
-
mouseOnToPopup: false,
|
169
|
-
manual: false
|
170
|
-
};
|
171
|
-
|
172
|
-
/**
|
173
|
-
* Default smart placement priority lists.
|
174
|
-
* The first item in the array is the highest priority, the last is the lowest.
|
175
|
-
* The last item is also the default, which will be used if all previous options
|
176
|
-
* do not fit.
|
177
|
-
*/
|
178
|
-
$.fn.powerTip.smartPlacementLists = {
|
179
|
-
n: ['n', 'ne', 'nw', 's'],
|
180
|
-
e: ['e', 'ne', 'se', 'w', 'nw', 'sw', 'n', 's', 'e'],
|
181
|
-
s: ['s', 'se', 'sw', 'n'],
|
182
|
-
w: ['w', 'nw', 'sw', 'e', 'ne', 'se', 'n', 's', 'w'],
|
183
|
-
nw: ['nw', 'w', 'sw', 'n', 's', 'se', 'nw'],
|
184
|
-
ne: ['ne', 'e', 'se', 'n', 's', 'sw', 'ne'],
|
185
|
-
sw: ['sw', 'w', 'nw', 's', 'n', 'ne', 'sw'],
|
186
|
-
se: ['se', 'e', 'ne', 's', 'n', 'nw', 'se'],
|
187
|
-
'nw-alt': ['nw-alt', 'n', 'ne-alt', 'sw-alt', 's', 'se-alt', 'w', 'e'],
|
188
|
-
'ne-alt': ['ne-alt', 'n', 'nw-alt', 'se-alt', 's', 'sw-alt', 'e', 'w'],
|
189
|
-
'sw-alt': ['sw-alt', 's', 'se-alt', 'nw-alt', 'n', 'ne-alt', 'w', 'e'],
|
190
|
-
'se-alt': ['se-alt', 's', 'sw-alt', 'ne-alt', 'n', 'nw-alt', 'e', 'w']
|
191
|
-
};
|
192
|
-
|
193
|
-
/**
|
194
|
-
* Public API
|
195
|
-
*/
|
196
|
-
$.powerTip = {
|
197
|
-
/**
|
198
|
-
* Attempts to show the tooltip for the specified element.
|
199
|
-
* @param {jQuery|Element} element The element to open the tooltip for.
|
200
|
-
* @param {jQuery.Event=} event jQuery event for hover intent and mouse
|
201
|
-
* tracking (optional).
|
202
|
-
*/
|
203
|
-
show: function apiShowTip(element, event) {
|
204
|
-
if (event) {
|
205
|
-
trackMouse(event);
|
206
|
-
session.previousX = event.pageX;
|
207
|
-
session.previousY = event.pageY;
|
208
|
-
$(element).data(DATA_DISPLAYCONTROLLER).show();
|
209
|
-
} else {
|
210
|
-
$(element).first().data(DATA_DISPLAYCONTROLLER).show(true, true);
|
211
|
-
}
|
212
|
-
return element;
|
213
|
-
},
|
214
|
-
|
215
|
-
/**
|
216
|
-
* Repositions the tooltip on the element.
|
217
|
-
* @param {jQuery|Element} element The element the tooltip is shown for.
|
218
|
-
*/
|
219
|
-
reposition: function apiResetPosition(element) {
|
220
|
-
$(element).first().data(DATA_DISPLAYCONTROLLER).resetPosition();
|
221
|
-
return element;
|
222
|
-
},
|
223
|
-
|
224
|
-
/**
|
225
|
-
* Attempts to close any open tooltips.
|
226
|
-
* @param {(jQuery|Element)=} element The element with the tooltip that
|
227
|
-
* should be closed (optional).
|
228
|
-
* @param {boolean=} immediate Disable close delay (optional).
|
229
|
-
*/
|
230
|
-
hide: function apiCloseTip(element, immediate) {
|
231
|
-
if (element) {
|
232
|
-
$(element).first().data(DATA_DISPLAYCONTROLLER).hide(immediate);
|
233
|
-
} else {
|
234
|
-
if (session.activeHover) {
|
235
|
-
session.activeHover.data(DATA_DISPLAYCONTROLLER).hide(true);
|
236
|
-
}
|
237
|
-
}
|
238
|
-
return element;
|
239
|
-
},
|
240
|
-
|
241
|
-
/**
|
242
|
-
* Destroy and roll back any powerTip() instance on the specified element.
|
243
|
-
* @param {jQuery|Element} element The element with the powerTip instance.
|
244
|
-
*/
|
245
|
-
destroy: function apiDestroy(element) {
|
246
|
-
$(element).off('.powertip').each(function destroy() {
|
247
|
-
var $this = $(this),
|
248
|
-
dataAttributes = [
|
249
|
-
DATA_ORIGINALTITLE,
|
250
|
-
DATA_DISPLAYCONTROLLER,
|
251
|
-
DATA_HASACTIVEHOVER,
|
252
|
-
DATA_FORCEDOPEN
|
253
|
-
];
|
254
|
-
|
255
|
-
if ($this.data(DATA_ORIGINALTITLE)) {
|
256
|
-
$this.attr('title', $this.data(DATA_ORIGINALTITLE));
|
257
|
-
dataAttributes.push(DATA_POWERTIP);
|
258
|
-
}
|
259
|
-
|
260
|
-
$this.removeData(dataAttributes);
|
261
|
-
});
|
262
|
-
return element;
|
263
|
-
}
|
264
|
-
};
|
265
|
-
|
266
|
-
// API aliasing
|
267
|
-
$.powerTip.showTip = $.powerTip.show;
|
268
|
-
$.powerTip.closeTip = $.powerTip.hide;
|
269
|
-
|
270
|
-
/**
|
271
|
-
* Creates a new CSSCoordinates object.
|
272
|
-
* @private
|
273
|
-
* @constructor
|
274
|
-
*/
|
275
|
-
function CSSCoordinates() {
|
276
|
-
var me = this;
|
277
|
-
|
278
|
-
// initialize object properties
|
279
|
-
me.top = 'auto';
|
280
|
-
me.left = 'auto';
|
281
|
-
me.right = 'auto';
|
282
|
-
me.bottom = 'auto';
|
283
|
-
|
284
|
-
/**
|
285
|
-
* Set a property to a value.
|
286
|
-
* @private
|
287
|
-
* @param {string} property The name of the property.
|
288
|
-
* @param {number} value The value of the property.
|
289
|
-
*/
|
290
|
-
me.set = function(property, value) {
|
291
|
-
if ($.isNumeric(value)) {
|
292
|
-
me[property] = Math.round(value);
|
293
|
-
}
|
294
|
-
};
|
295
|
-
}
|
296
|
-
|
297
|
-
/**
|
298
|
-
* Creates a new tooltip display controller.
|
299
|
-
* @private
|
300
|
-
* @constructor
|
301
|
-
* @param {jQuery} element The element that this controller will handle.
|
302
|
-
* @param {Object} options Options object containing settings.
|
303
|
-
* @param {TooltipController} tipController The TooltipController object for
|
304
|
-
* this instance.
|
305
|
-
*/
|
306
|
-
function DisplayController(element, options, tipController) {
|
307
|
-
var hoverTimer = null;
|
308
|
-
|
309
|
-
/**
|
310
|
-
* Begins the process of showing a tooltip.
|
311
|
-
* @private
|
312
|
-
* @param {boolean=} immediate Skip intent testing (optional).
|
313
|
-
* @param {boolean=} forceOpen Ignore cursor position and force tooltip to
|
314
|
-
* open (optional).
|
315
|
-
*/
|
316
|
-
function openTooltip(immediate, forceOpen) {
|
317
|
-
cancelTimer();
|
318
|
-
if (!element.data(DATA_HASACTIVEHOVER)) {
|
319
|
-
if (!immediate) {
|
320
|
-
session.tipOpenImminent = true;
|
321
|
-
hoverTimer = setTimeout(
|
322
|
-
function intentDelay() {
|
323
|
-
hoverTimer = null;
|
324
|
-
checkForIntent();
|
325
|
-
},
|
326
|
-
options.intentPollInterval
|
327
|
-
);
|
328
|
-
} else {
|
329
|
-
if (forceOpen) {
|
330
|
-
element.data(DATA_FORCEDOPEN, true);
|
331
|
-
}
|
332
|
-
tipController.showTip(element);
|
333
|
-
}
|
334
|
-
}
|
335
|
-
}
|
336
|
-
|
337
|
-
/**
|
338
|
-
* Begins the process of closing a tooltip.
|
339
|
-
* @private
|
340
|
-
* @param {boolean=} disableDelay Disable close delay (optional).
|
341
|
-
*/
|
342
|
-
function closeTooltip(disableDelay) {
|
343
|
-
cancelTimer();
|
344
|
-
session.tipOpenImminent = false;
|
345
|
-
if (element.data(DATA_HASACTIVEHOVER)) {
|
346
|
-
element.data(DATA_FORCEDOPEN, false);
|
347
|
-
if (!disableDelay) {
|
348
|
-
session.delayInProgress = true;
|
349
|
-
hoverTimer = setTimeout(
|
350
|
-
function closeDelay() {
|
351
|
-
hoverTimer = null;
|
352
|
-
tipController.hideTip(element);
|
353
|
-
session.delayInProgress = false;
|
354
|
-
},
|
355
|
-
options.closeDelay
|
356
|
-
);
|
357
|
-
} else {
|
358
|
-
tipController.hideTip(element);
|
359
|
-
}
|
360
|
-
}
|
361
|
-
}
|
362
|
-
|
363
|
-
/**
|
364
|
-
* Checks mouse position to make sure that the user intended to hover on the
|
365
|
-
* specified element before showing the tooltip.
|
366
|
-
* @private
|
367
|
-
*/
|
368
|
-
function checkForIntent() {
|
369
|
-
// calculate mouse position difference
|
370
|
-
var xDifference = Math.abs(session.previousX - session.currentX),
|
371
|
-
yDifference = Math.abs(session.previousY - session.currentY),
|
372
|
-
totalDifference = xDifference + yDifference;
|
373
|
-
|
374
|
-
// check if difference has passed the sensitivity threshold
|
375
|
-
if (totalDifference < options.intentSensitivity) {
|
376
|
-
tipController.showTip(element);
|
377
|
-
} else {
|
378
|
-
// try again
|
379
|
-
session.previousX = session.currentX;
|
380
|
-
session.previousY = session.currentY;
|
381
|
-
openTooltip();
|
382
|
-
}
|
383
|
-
}
|
384
|
-
|
385
|
-
/**
|
386
|
-
* Cancels active hover timer.
|
387
|
-
* @private
|
388
|
-
*/
|
389
|
-
function cancelTimer() {
|
390
|
-
hoverTimer = clearTimeout(hoverTimer);
|
391
|
-
session.delayInProgress = false;
|
392
|
-
}
|
393
|
-
|
394
|
-
/**
|
395
|
-
* Repositions the tooltip on this element.
|
396
|
-
* @private
|
397
|
-
*/
|
398
|
-
function repositionTooltip() {
|
399
|
-
tipController.resetPosition(element);
|
400
|
-
}
|
401
|
-
|
402
|
-
// expose the methods
|
403
|
-
this.show = openTooltip;
|
404
|
-
this.hide = closeTooltip;
|
405
|
-
this.cancel = cancelTimer;
|
406
|
-
this.resetPosition = repositionTooltip;
|
407
|
-
}
|
408
|
-
|
409
|
-
/**
|
410
|
-
* Creates a new Placement Calculator.
|
411
|
-
* @private
|
412
|
-
* @constructor
|
413
|
-
*/
|
414
|
-
function PlacementCalculator() {
|
415
|
-
/**
|
416
|
-
* Compute the CSS position to display a tooltip at the specified placement
|
417
|
-
* relative to the specified element.
|
418
|
-
* @private
|
419
|
-
* @param {jQuery} element The element that the tooltip should target.
|
420
|
-
* @param {string} placement The placement for the tooltip.
|
421
|
-
* @param {number} tipWidth Width of the tooltip element in pixels.
|
422
|
-
* @param {number} tipHeight Height of the tooltip element in pixels.
|
423
|
-
* @param {number} offset Distance to offset tooltips in pixels.
|
424
|
-
* @return {CSSCoordinates} A CSSCoordinates object with the position.
|
425
|
-
*/
|
426
|
-
function computePlacementCoords(element, placement, tipWidth, tipHeight, offset) {
|
427
|
-
var placementBase = placement.split('-')[0], // ignore 'alt' for corners
|
428
|
-
coords = new CSSCoordinates(),
|
429
|
-
position;
|
430
|
-
|
431
|
-
if (isSvgElement(element)) {
|
432
|
-
position = getSvgPlacement(element, placementBase);
|
433
|
-
} else {
|
434
|
-
position = getHtmlPlacement(element, placementBase);
|
435
|
-
}
|
436
|
-
|
437
|
-
// calculate the appropriate x and y position in the document
|
438
|
-
switch (placement) {
|
439
|
-
case 'n':
|
440
|
-
coords.set('left', position.left - (tipWidth / 2));
|
441
|
-
coords.set('bottom', session.windowHeight - position.top + offset);
|
442
|
-
break;
|
443
|
-
case 'e':
|
444
|
-
coords.set('left', position.left + offset);
|
445
|
-
coords.set('top', position.top - (tipHeight / 2));
|
446
|
-
break;
|
447
|
-
case 's':
|
448
|
-
coords.set('left', position.left - (tipWidth / 2));
|
449
|
-
coords.set('top', position.top + offset);
|
450
|
-
break;
|
451
|
-
case 'w':
|
452
|
-
coords.set('top', position.top - (tipHeight / 2));
|
453
|
-
coords.set('right', session.windowWidth - position.left + offset);
|
454
|
-
break;
|
455
|
-
case 'nw':
|
456
|
-
coords.set('bottom', session.windowHeight - position.top + offset);
|
457
|
-
coords.set('right', session.windowWidth - position.left - 20);
|
458
|
-
break;
|
459
|
-
case 'nw-alt':
|
460
|
-
coords.set('left', position.left);
|
461
|
-
coords.set('bottom', session.windowHeight - position.top + offset);
|
462
|
-
break;
|
463
|
-
case 'ne':
|
464
|
-
coords.set('left', position.left - 20);
|
465
|
-
coords.set('bottom', session.windowHeight - position.top + offset);
|
466
|
-
break;
|
467
|
-
case 'ne-alt':
|
468
|
-
coords.set('bottom', session.windowHeight - position.top + offset);
|
469
|
-
coords.set('right', session.windowWidth - position.left);
|
470
|
-
break;
|
471
|
-
case 'sw':
|
472
|
-
coords.set('top', position.top + offset);
|
473
|
-
coords.set('right', session.windowWidth - position.left - 20);
|
474
|
-
break;
|
475
|
-
case 'sw-alt':
|
476
|
-
coords.set('left', position.left);
|
477
|
-
coords.set('top', position.top + offset);
|
478
|
-
break;
|
479
|
-
case 'se':
|
480
|
-
coords.set('left', position.left - 20);
|
481
|
-
coords.set('top', position.top + offset);
|
482
|
-
break;
|
483
|
-
case 'se-alt':
|
484
|
-
coords.set('top', position.top + offset);
|
485
|
-
coords.set('right', session.windowWidth - position.left);
|
486
|
-
break;
|
487
|
-
}
|
488
|
-
|
489
|
-
return coords;
|
490
|
-
}
|
491
|
-
|
492
|
-
/**
|
493
|
-
* Finds the tooltip attachment point in the document for a HTML DOM element
|
494
|
-
* for the specified placement.
|
495
|
-
* @private
|
496
|
-
* @param {jQuery} element The element that the tooltip should target.
|
497
|
-
* @param {string} placement The placement for the tooltip.
|
498
|
-
* @return {Object} An object with the top,left position values.
|
499
|
-
*/
|
500
|
-
function getHtmlPlacement(element, placement) {
|
501
|
-
var objectOffset = element.offset(),
|
502
|
-
objectWidth = element.outerWidth(),
|
503
|
-
objectHeight = element.outerHeight(),
|
504
|
-
left,
|
505
|
-
top;
|
506
|
-
|
507
|
-
// calculate the appropriate x and y position in the document
|
508
|
-
switch (placement) {
|
509
|
-
case 'n':
|
510
|
-
left = objectOffset.left + objectWidth / 2;
|
511
|
-
top = objectOffset.top;
|
512
|
-
break;
|
513
|
-
case 'e':
|
514
|
-
left = objectOffset.left + objectWidth;
|
515
|
-
top = objectOffset.top + objectHeight / 2;
|
516
|
-
break;
|
517
|
-
case 's':
|
518
|
-
left = objectOffset.left + objectWidth / 2;
|
519
|
-
top = objectOffset.top + objectHeight;
|
520
|
-
break;
|
521
|
-
case 'w':
|
522
|
-
left = objectOffset.left;
|
523
|
-
top = objectOffset.top + objectHeight / 2;
|
524
|
-
break;
|
525
|
-
case 'nw':
|
526
|
-
left = objectOffset.left;
|
527
|
-
top = objectOffset.top;
|
528
|
-
break;
|
529
|
-
case 'ne':
|
530
|
-
left = objectOffset.left + objectWidth;
|
531
|
-
top = objectOffset.top;
|
532
|
-
break;
|
533
|
-
case 'sw':
|
534
|
-
left = objectOffset.left;
|
535
|
-
top = objectOffset.top + objectHeight;
|
536
|
-
break;
|
537
|
-
case 'se':
|
538
|
-
left = objectOffset.left + objectWidth;
|
539
|
-
top = objectOffset.top + objectHeight;
|
540
|
-
break;
|
541
|
-
}
|
542
|
-
|
543
|
-
return {
|
544
|
-
top: top,
|
545
|
-
left: left
|
546
|
-
};
|
547
|
-
}
|
548
|
-
|
549
|
-
/**
|
550
|
-
* Finds the tooltip attachment point in the document for a SVG element for
|
551
|
-
* the specified placement.
|
552
|
-
* @private
|
553
|
-
* @param {jQuery} element The element that the tooltip should target.
|
554
|
-
* @param {string} placement The placement for the tooltip.
|
555
|
-
* @return {Object} An object with the top,left position values.
|
556
|
-
*/
|
557
|
-
function getSvgPlacement(element, placement) {
|
558
|
-
var svgElement = element.closest('svg')[0],
|
559
|
-
domElement = element[0],
|
560
|
-
point = svgElement.createSVGPoint(),
|
561
|
-
boundingBox = domElement.getBBox(),
|
562
|
-
matrix = domElement.getScreenCTM(),
|
563
|
-
halfWidth = boundingBox.width / 2,
|
564
|
-
halfHeight = boundingBox.height / 2,
|
565
|
-
placements = [],
|
566
|
-
placementKeys = ['nw', 'n', 'ne', 'e', 'se', 's', 'sw', 'w'],
|
567
|
-
coords,
|
568
|
-
rotation,
|
569
|
-
steps,
|
570
|
-
x;
|
571
|
-
|
572
|
-
function pushPlacement() {
|
573
|
-
placements.push(point.matrixTransform(matrix));
|
574
|
-
}
|
575
|
-
|
576
|
-
// get bounding box corners and midpoints
|
577
|
-
point.x = boundingBox.x;
|
578
|
-
point.y = boundingBox.y;
|
579
|
-
pushPlacement();
|
580
|
-
point.x += halfWidth;
|
581
|
-
pushPlacement();
|
582
|
-
point.x += halfWidth;
|
583
|
-
pushPlacement();
|
584
|
-
point.y += halfHeight;
|
585
|
-
pushPlacement();
|
586
|
-
point.y += halfHeight;
|
587
|
-
pushPlacement();
|
588
|
-
point.x -= halfWidth;
|
589
|
-
pushPlacement();
|
590
|
-
point.x -= halfWidth;
|
591
|
-
pushPlacement();
|
592
|
-
point.y -= halfHeight;
|
593
|
-
pushPlacement();
|
594
|
-
|
595
|
-
// determine rotation
|
596
|
-
if (placements[0].y !== placements[1].y || placements[0].x !== placements[7].x) {
|
597
|
-
rotation = Math.atan2(matrix.b, matrix.a) * RAD2DEG;
|
598
|
-
steps = Math.ceil(((rotation % 360) - 22.5) / 45);
|
599
|
-
if (steps < 1) {
|
600
|
-
steps += 8;
|
601
|
-
}
|
602
|
-
while (steps--) {
|
603
|
-
placementKeys.push(placementKeys.shift());
|
604
|
-
}
|
605
|
-
}
|
606
|
-
|
607
|
-
// find placement
|
608
|
-
for (x = 0; x < placements.length; x++) {
|
609
|
-
if (placementKeys[x] === placement) {
|
610
|
-
coords = placements[x];
|
611
|
-
break;
|
612
|
-
}
|
613
|
-
}
|
614
|
-
|
615
|
-
return {
|
616
|
-
top: coords.y + session.scrollTop,
|
617
|
-
left: coords.x + session.scrollLeft
|
618
|
-
};
|
619
|
-
}
|
620
|
-
|
621
|
-
// expose methods
|
622
|
-
this.compute = computePlacementCoords;
|
623
|
-
}
|
624
|
-
|
625
|
-
/**
|
626
|
-
* Creates a new tooltip controller.
|
627
|
-
* @private
|
628
|
-
* @constructor
|
629
|
-
* @param {Object} options Options object containing settings.
|
630
|
-
*/
|
631
|
-
function TooltipController(options) {
|
632
|
-
var placementCalculator = new PlacementCalculator(),
|
633
|
-
tipElement = $('#' + options.popupId);
|
634
|
-
|
635
|
-
// build and append tooltip div if it does not already exist
|
636
|
-
if (tipElement.length === 0) {
|
637
|
-
tipElement = $('<div/>', { id: options.popupId });
|
638
|
-
// grab body element if it was not populated when the script loaded
|
639
|
-
// note: this hack exists solely for jsfiddle support
|
640
|
-
if ($body.length === 0) {
|
641
|
-
$body = $('body');
|
642
|
-
}
|
643
|
-
$body.append(tipElement);
|
644
|
-
}
|
645
|
-
|
646
|
-
// hook mousemove for cursor follow tooltips
|
647
|
-
if (options.followMouse) {
|
648
|
-
// only one positionTipOnCursor hook per tooltip element, please
|
649
|
-
if (!tipElement.data(DATA_HASMOUSEMOVE)) {
|
650
|
-
$document.on('mousemove', positionTipOnCursor);
|
651
|
-
$window.on('scroll', positionTipOnCursor);
|
652
|
-
tipElement.data(DATA_HASMOUSEMOVE, true);
|
653
|
-
}
|
654
|
-
}
|
655
|
-
|
656
|
-
// if we want to be able to mouse onto the tooltip then we need to attach
|
657
|
-
// hover events to the tooltip that will cancel a close request on hover and
|
658
|
-
// start a new close request on mouseleave
|
659
|
-
if (options.mouseOnToPopup) {
|
660
|
-
tipElement.on({
|
661
|
-
mouseenter: function tipMouseEnter() {
|
662
|
-
// we only let the mouse stay on the tooltip if it is set to let
|
663
|
-
// users interact with it
|
664
|
-
if (tipElement.data(DATA_MOUSEONTOTIP)) {
|
665
|
-
// check activeHover in case the mouse cursor entered the
|
666
|
-
// tooltip during the fadeOut and close cycle
|
667
|
-
if (session.activeHover) {
|
668
|
-
session.activeHover.data(DATA_DISPLAYCONTROLLER).cancel();
|
669
|
-
}
|
670
|
-
}
|
671
|
-
},
|
672
|
-
mouseleave: function tipMouseLeave() {
|
673
|
-
// check activeHover in case the mouse cursor entered the
|
674
|
-
// tooltip during the fadeOut and close cycle
|
675
|
-
if (session.activeHover) {
|
676
|
-
session.activeHover.data(DATA_DISPLAYCONTROLLER).hide();
|
677
|
-
}
|
678
|
-
}
|
679
|
-
});
|
680
|
-
}
|
681
|
-
|
682
|
-
/**
|
683
|
-
* Gives the specified element the active-hover state and queues up the
|
684
|
-
* showTip function.
|
685
|
-
* @private
|
686
|
-
* @param {jQuery} element The element that the tooltip should target.
|
687
|
-
*/
|
688
|
-
function beginShowTip(element) {
|
689
|
-
element.data(DATA_HASACTIVEHOVER, true);
|
690
|
-
// show tooltip, asap
|
691
|
-
tipElement.queue(function queueTipInit(next) {
|
692
|
-
showTip(element);
|
693
|
-
next();
|
694
|
-
});
|
695
|
-
}
|
696
|
-
|
697
|
-
/**
|
698
|
-
* Shows the tooltip, as soon as possible.
|
699
|
-
* @private
|
700
|
-
* @param {jQuery} element The element that the tooltip should target.
|
701
|
-
*/
|
702
|
-
function showTip(element) {
|
703
|
-
var tipContent;
|
704
|
-
|
705
|
-
// it is possible, especially with keyboard navigation, to move on to
|
706
|
-
// another element with a tooltip during the queue to get to this point
|
707
|
-
// in the code. if that happens then we need to not proceed or we may
|
708
|
-
// have the fadeout callback for the last tooltip execute immediately
|
709
|
-
// after this code runs, causing bugs.
|
710
|
-
if (!element.data(DATA_HASACTIVEHOVER)) {
|
711
|
-
return;
|
712
|
-
}
|
713
|
-
|
714
|
-
// if the tooltip is open and we got asked to open another one then the
|
715
|
-
// old one is still in its fadeOut cycle, so wait and try again
|
716
|
-
if (session.isTipOpen) {
|
717
|
-
if (!session.isClosing) {
|
718
|
-
hideTip(session.activeHover);
|
719
|
-
}
|
720
|
-
tipElement.delay(100).queue(function queueTipAgain(next) {
|
721
|
-
showTip(element);
|
722
|
-
next();
|
723
|
-
});
|
724
|
-
return;
|
725
|
-
}
|
726
|
-
|
727
|
-
// trigger powerTipPreRender event
|
728
|
-
element.trigger('powerTipPreRender');
|
729
|
-
|
730
|
-
// set tooltip content
|
731
|
-
tipContent = getTooltipContent(element);
|
732
|
-
if (tipContent) {
|
733
|
-
tipElement.empty().append(tipContent);
|
734
|
-
} else {
|
735
|
-
// we have no content to display, give up
|
736
|
-
return;
|
737
|
-
}
|
738
|
-
|
739
|
-
// trigger powerTipRender event
|
740
|
-
element.trigger('powerTipRender');
|
741
|
-
|
742
|
-
session.activeHover = element;
|
743
|
-
session.isTipOpen = true;
|
744
|
-
|
745
|
-
tipElement.data(DATA_MOUSEONTOTIP, options.mouseOnToPopup);
|
746
|
-
|
747
|
-
// set tooltip position
|
748
|
-
if (!options.followMouse) {
|
749
|
-
positionTipOnElement(element);
|
750
|
-
session.isFixedTipOpen = true;
|
751
|
-
} else {
|
752
|
-
positionTipOnCursor();
|
753
|
-
}
|
754
|
-
|
755
|
-
// fadein
|
756
|
-
tipElement.fadeIn(options.fadeInTime, function fadeInCallback() {
|
757
|
-
// start desync polling
|
758
|
-
if (!session.desyncTimeout) {
|
759
|
-
session.desyncTimeout = setInterval(closeDesyncedTip, 500);
|
760
|
-
}
|
761
|
-
|
762
|
-
// trigger powerTipOpen event
|
763
|
-
element.trigger('powerTipOpen');
|
764
|
-
});
|
765
|
-
}
|
766
|
-
|
767
|
-
/**
|
768
|
-
* Hides the tooltip.
|
769
|
-
* @private
|
770
|
-
* @param {jQuery} element The element that the tooltip should target.
|
771
|
-
*/
|
772
|
-
function hideTip(element) {
|
773
|
-
// reset session
|
774
|
-
session.isClosing = true;
|
775
|
-
session.activeHover = null;
|
776
|
-
session.isTipOpen = false;
|
777
|
-
|
778
|
-
// stop desync polling
|
779
|
-
session.desyncTimeout = clearInterval(session.desyncTimeout);
|
780
|
-
|
781
|
-
// reset element state
|
782
|
-
element.data(DATA_HASACTIVEHOVER, false);
|
783
|
-
element.data(DATA_FORCEDOPEN, false);
|
784
|
-
|
785
|
-
// fade out
|
786
|
-
tipElement.fadeOut(options.fadeOutTime, function fadeOutCallback() {
|
787
|
-
var coords = new CSSCoordinates();
|
788
|
-
|
789
|
-
// reset session and tooltip element
|
790
|
-
session.isClosing = false;
|
791
|
-
session.isFixedTipOpen = false;
|
792
|
-
tipElement.removeClass();
|
793
|
-
|
794
|
-
// support mouse-follow and fixed position tips at the same time by
|
795
|
-
// moving the tooltip to the last cursor location after it is hidden
|
796
|
-
coords.set('top', session.currentY + options.offset);
|
797
|
-
coords.set('left', session.currentX + options.offset);
|
798
|
-
tipElement.css(coords);
|
799
|
-
|
800
|
-
// trigger powerTipClose event
|
801
|
-
element.trigger('powerTipClose');
|
802
|
-
});
|
803
|
-
}
|
804
|
-
|
805
|
-
/**
|
806
|
-
* Moves the tooltip to the users mouse cursor.
|
807
|
-
* @private
|
808
|
-
*/
|
809
|
-
function positionTipOnCursor() {
|
810
|
-
// to support having fixed tooltips on the same page as cursor tooltips,
|
811
|
-
// where both instances are referencing the same tooltip element, we
|
812
|
-
// need to keep track of the mouse position constantly, but we should
|
813
|
-
// only set the tip location if a fixed tip is not currently open, a tip
|
814
|
-
// open is imminent or active, and the tooltip element in question does
|
815
|
-
// have a mouse-follow using it.
|
816
|
-
if (!session.isFixedTipOpen && (session.isTipOpen || (session.tipOpenImminent && tipElement.data(DATA_HASMOUSEMOVE)))) {
|
817
|
-
// grab measurements
|
818
|
-
var tipWidth = tipElement.outerWidth(),
|
819
|
-
tipHeight = tipElement.outerHeight(),
|
820
|
-
coords = new CSSCoordinates(),
|
821
|
-
collisions,
|
822
|
-
collisionCount;
|
823
|
-
|
824
|
-
// grab collisions
|
825
|
-
coords.set('top', session.currentY + options.offset);
|
826
|
-
coords.set('left', session.currentX + options.offset);
|
827
|
-
collisions = getViewportCollisions(
|
828
|
-
coords,
|
829
|
-
tipWidth,
|
830
|
-
tipHeight
|
831
|
-
);
|
832
|
-
|
833
|
-
// handle tooltip view port collisions
|
834
|
-
if (collisions !== Collision.none) {
|
835
|
-
collisionCount = countFlags(collisions);
|
836
|
-
if (collisionCount === 1) {
|
837
|
-
// if there is only one collision (bottom or right) then
|
838
|
-
// simply constrain the tooltip to the view port
|
839
|
-
if (collisions === Collision.right) {
|
840
|
-
coords.set('left', session.windowWidth - tipWidth);
|
841
|
-
} else if (collisions === Collision.bottom) {
|
842
|
-
coords.set('top', session.scrollTop + session.windowHeight - tipHeight);
|
843
|
-
}
|
844
|
-
} else {
|
845
|
-
// if the tooltip has more than one collision then it is
|
846
|
-
// trapped in the corner and should be flipped to get it out
|
847
|
-
// of the users way
|
848
|
-
coords.set('left', session.currentX - tipWidth - options.offset);
|
849
|
-
coords.set('top', session.currentY - tipHeight - options.offset);
|
850
|
-
}
|
851
|
-
}
|
852
|
-
|
853
|
-
// position the tooltip
|
854
|
-
tipElement.css(coords);
|
855
|
-
}
|
856
|
-
}
|
857
|
-
|
858
|
-
/**
|
859
|
-
* Sets the tooltip to the correct position relative to the specified target
|
860
|
-
* element. Based on options settings.
|
861
|
-
* @private
|
862
|
-
* @param {jQuery} element The element that the tooltip should target.
|
863
|
-
*/
|
864
|
-
function positionTipOnElement(element) {
|
865
|
-
var priorityList,
|
866
|
-
finalPlacement;
|
867
|
-
|
868
|
-
if (options.smartPlacement) {
|
869
|
-
priorityList = $.fn.powerTip.smartPlacementLists[options.placement];
|
870
|
-
|
871
|
-
// iterate over the priority list and use the first placement option
|
872
|
-
// that does not collide with the view port. if they all collide
|
873
|
-
// then the last placement in the list will be used.
|
874
|
-
$.each(priorityList, function(idx, pos) {
|
875
|
-
// place tooltip and find collisions
|
876
|
-
var collisions = getViewportCollisions(
|
877
|
-
placeTooltip(element, pos),
|
878
|
-
tipElement.outerWidth(),
|
879
|
-
tipElement.outerHeight()
|
880
|
-
);
|
881
|
-
|
882
|
-
// update the final placement variable
|
883
|
-
finalPlacement = pos;
|
884
|
-
|
885
|
-
// break if there were no collisions
|
886
|
-
if (collisions === Collision.none) {
|
887
|
-
return false;
|
888
|
-
}
|
889
|
-
});
|
890
|
-
} else {
|
891
|
-
// if we're not going to use the smart placement feature then just
|
892
|
-
// compute the coordinates and do it
|
893
|
-
placeTooltip(element, options.placement);
|
894
|
-
finalPlacement = options.placement;
|
895
|
-
}
|
896
|
-
|
897
|
-
// add placement as class for CSS arrows
|
898
|
-
tipElement.addClass(finalPlacement);
|
899
|
-
}
|
900
|
-
|
901
|
-
/**
|
902
|
-
* Sets the tooltip position to the appropriate values to show the tip at
|
903
|
-
* the specified placement. This function will iterate and test the tooltip
|
904
|
-
* to support elastic tooltips.
|
905
|
-
* @private
|
906
|
-
* @param {jQuery} element The element that the tooltip should target.
|
907
|
-
* @param {string} placement The placement for the tooltip.
|
908
|
-
* @return {CSSCoordinates} A CSSCoordinates object with the top, left, and
|
909
|
-
* right position values.
|
910
|
-
*/
|
911
|
-
function placeTooltip(element, placement) {
|
912
|
-
var iterationCount = 0,
|
913
|
-
tipWidth,
|
914
|
-
tipHeight,
|
915
|
-
coords = new CSSCoordinates();
|
916
|
-
|
917
|
-
// set the tip to 0,0 to get the full expanded width
|
918
|
-
coords.set('top', 0);
|
919
|
-
coords.set('left', 0);
|
920
|
-
tipElement.css(coords);
|
921
|
-
|
922
|
-
// to support elastic tooltips we need to check for a change in the
|
923
|
-
// rendered dimensions after the tooltip has been positioned
|
924
|
-
do {
|
925
|
-
// grab the current tip dimensions
|
926
|
-
tipWidth = tipElement.outerWidth();
|
927
|
-
tipHeight = tipElement.outerHeight();
|
928
|
-
|
929
|
-
// get placement coordinates
|
930
|
-
coords = placementCalculator.compute(
|
931
|
-
element,
|
932
|
-
placement,
|
933
|
-
tipWidth,
|
934
|
-
tipHeight,
|
935
|
-
options.offset
|
936
|
-
);
|
937
|
-
|
938
|
-
// place the tooltip
|
939
|
-
tipElement.css(coords);
|
940
|
-
} while (
|
941
|
-
// sanity check: limit to 5 iterations, and...
|
942
|
-
++iterationCount <= 5 &&
|
943
|
-
// try again if the dimensions changed after placement
|
944
|
-
(tipWidth !== tipElement.outerWidth() || tipHeight !== tipElement.outerHeight())
|
945
|
-
);
|
946
|
-
|
947
|
-
return coords;
|
948
|
-
}
|
949
|
-
|
950
|
-
/**
|
951
|
-
* Checks for a tooltip desync and closes the tooltip if one occurs.
|
952
|
-
* @private
|
953
|
-
*/
|
954
|
-
function closeDesyncedTip() {
|
955
|
-
var isDesynced = false;
|
956
|
-
// It is possible for the mouse cursor to leave an element without
|
957
|
-
// firing the mouseleave or blur event. This most commonly happens when
|
958
|
-
// the element is disabled under mouse cursor. If this happens it will
|
959
|
-
// result in a desynced tooltip because the tooltip was never asked to
|
960
|
-
// close. So we should periodically check for a desync situation and
|
961
|
-
// close the tip if such a situation arises.
|
962
|
-
if (session.isTipOpen && !session.isClosing && !session.delayInProgress) {
|
963
|
-
// user moused onto another tip or active hover is disabled
|
964
|
-
if (session.activeHover.data(DATA_HASACTIVEHOVER) === false || session.activeHover.is(':disabled')) {
|
965
|
-
isDesynced = true;
|
966
|
-
} else {
|
967
|
-
// hanging tip - have to test if mouse position is not over the
|
968
|
-
// active hover and not over a tooltip set to let the user
|
969
|
-
// interact with it.
|
970
|
-
// for keyboard navigation: this only counts if the element does
|
971
|
-
// not have focus.
|
972
|
-
// for tooltips opened via the api: we need to check if it has
|
973
|
-
// the forcedOpen flag.
|
974
|
-
if (!isMouseOver(session.activeHover) && !session.activeHover.is(':focus') && !session.activeHover.data(DATA_FORCEDOPEN)) {
|
975
|
-
if (tipElement.data(DATA_MOUSEONTOTIP)) {
|
976
|
-
if (!isMouseOver(tipElement)) {
|
977
|
-
isDesynced = true;
|
978
|
-
}
|
979
|
-
} else {
|
980
|
-
isDesynced = true;
|
981
|
-
}
|
982
|
-
}
|
983
|
-
}
|
984
|
-
|
985
|
-
if (isDesynced) {
|
986
|
-
// close the desynced tip
|
987
|
-
hideTip(session.activeHover);
|
988
|
-
}
|
989
|
-
}
|
990
|
-
}
|
991
|
-
|
992
|
-
// expose methods
|
993
|
-
this.showTip = beginShowTip;
|
994
|
-
this.hideTip = hideTip;
|
995
|
-
this.resetPosition = positionTipOnElement;
|
996
|
-
}
|
997
|
-
|
998
|
-
/**
|
999
|
-
* Determine whether a jQuery object is an SVG element
|
1000
|
-
* @private
|
1001
|
-
* @param {jQuery} element The element to check
|
1002
|
-
* @return {boolean} Whether this is an SVG element
|
1003
|
-
*/
|
1004
|
-
function isSvgElement(element) {
|
1005
|
-
return window.SVGElement && element[0] instanceof SVGElement;
|
1006
|
-
}
|
1007
|
-
|
1008
|
-
/**
|
1009
|
-
* Initializes the viewport dimension cache and hooks up the mouse position
|
1010
|
-
* tracking and viewport dimension tracking events.
|
1011
|
-
* Prevents attaching the events more than once.
|
1012
|
-
* @private
|
1013
|
-
*/
|
1014
|
-
function initTracking() {
|
1015
|
-
if (!session.mouseTrackingActive) {
|
1016
|
-
session.mouseTrackingActive = true;
|
1017
|
-
|
1018
|
-
// grab the current viewport dimensions on load
|
1019
|
-
$(function getViewportDimensions() {
|
1020
|
-
session.scrollLeft = $window.scrollLeft();
|
1021
|
-
session.scrollTop = $window.scrollTop();
|
1022
|
-
session.windowWidth = $window.width();
|
1023
|
-
session.windowHeight = $window.height();
|
1024
|
-
});
|
1025
|
-
|
1026
|
-
// hook mouse move tracking
|
1027
|
-
$document.on('mousemove', trackMouse);
|
1028
|
-
|
1029
|
-
// hook viewport dimensions tracking
|
1030
|
-
$window.on({
|
1031
|
-
resize: function trackResize() {
|
1032
|
-
session.windowWidth = $window.width();
|
1033
|
-
session.windowHeight = $window.height();
|
1034
|
-
},
|
1035
|
-
scroll: function trackScroll() {
|
1036
|
-
var x = $window.scrollLeft(),
|
1037
|
-
y = $window.scrollTop();
|
1038
|
-
if (x !== session.scrollLeft) {
|
1039
|
-
session.currentX += x - session.scrollLeft;
|
1040
|
-
session.scrollLeft = x;
|
1041
|
-
}
|
1042
|
-
if (y !== session.scrollTop) {
|
1043
|
-
session.currentY += y - session.scrollTop;
|
1044
|
-
session.scrollTop = y;
|
1045
|
-
}
|
1046
|
-
}
|
1047
|
-
});
|
1048
|
-
}
|
1049
|
-
}
|
1050
|
-
|
1051
|
-
/**
|
1052
|
-
* Saves the current mouse coordinates to the session object.
|
1053
|
-
* @private
|
1054
|
-
* @param {jQuery.Event} event The mousemove event for the document.
|
1055
|
-
*/
|
1056
|
-
function trackMouse(event) {
|
1057
|
-
session.currentX = event.pageX;
|
1058
|
-
session.currentY = event.pageY;
|
1059
|
-
}
|
1060
|
-
|
1061
|
-
/**
|
1062
|
-
* Tests if the mouse is currently over the specified element.
|
1063
|
-
* @private
|
1064
|
-
* @param {jQuery} element The element to check for hover.
|
1065
|
-
* @return {boolean}
|
1066
|
-
*/
|
1067
|
-
function isMouseOver(element) {
|
1068
|
-
// use getBoundingClientRect() because jQuery's width() and height()
|
1069
|
-
// methods do not work with SVG elements
|
1070
|
-
// compute width/height because those properties do not exist on the object
|
1071
|
-
// returned by getBoundingClientRect() in older versions of IE
|
1072
|
-
var elementPosition = element.offset(),
|
1073
|
-
elementBox = element[0].getBoundingClientRect(),
|
1074
|
-
elementWidth = elementBox.right - elementBox.left,
|
1075
|
-
elementHeight = elementBox.bottom - elementBox.top;
|
1076
|
-
|
1077
|
-
return session.currentX >= elementPosition.left &&
|
1078
|
-
session.currentX <= elementPosition.left + elementWidth &&
|
1079
|
-
session.currentY >= elementPosition.top &&
|
1080
|
-
session.currentY <= elementPosition.top + elementHeight;
|
1081
|
-
}
|
1082
|
-
|
1083
|
-
/**
|
1084
|
-
* Fetches the tooltip content from the specified element's data attributes.
|
1085
|
-
* @private
|
1086
|
-
* @param {jQuery} element The element to get the tooltip content for.
|
1087
|
-
* @return {(string|jQuery|undefined)} The text/HTML string, jQuery object, or
|
1088
|
-
* undefined if there was no tooltip content for the element.
|
1089
|
-
*/
|
1090
|
-
function getTooltipContent(element) {
|
1091
|
-
var tipText = element.data(DATA_POWERTIP),
|
1092
|
-
tipObject = element.data(DATA_POWERTIPJQ),
|
1093
|
-
tipTarget = element.data(DATA_POWERTIPTARGET),
|
1094
|
-
targetElement,
|
1095
|
-
content;
|
1096
|
-
|
1097
|
-
if (tipText) {
|
1098
|
-
if ($.isFunction(tipText)) {
|
1099
|
-
tipText = tipText.call(element[0]);
|
1100
|
-
}
|
1101
|
-
content = tipText;
|
1102
|
-
} else if (tipObject) {
|
1103
|
-
if ($.isFunction(tipObject)) {
|
1104
|
-
tipObject = tipObject.call(element[0]);
|
1105
|
-
}
|
1106
|
-
if (tipObject.length > 0) {
|
1107
|
-
content = tipObject.clone(true, true);
|
1108
|
-
}
|
1109
|
-
} else if (tipTarget) {
|
1110
|
-
targetElement = $('#' + tipTarget);
|
1111
|
-
if (targetElement.length > 0) {
|
1112
|
-
content = targetElement.html();
|
1113
|
-
}
|
1114
|
-
}
|
1115
|
-
|
1116
|
-
return content;
|
1117
|
-
}
|
1118
|
-
|
1119
|
-
/**
|
1120
|
-
* Finds any viewport collisions that an element (the tooltip) would have if it
|
1121
|
-
* were absolutely positioned at the specified coordinates.
|
1122
|
-
* @private
|
1123
|
-
* @param {CSSCoordinates} coords Coordinates for the element.
|
1124
|
-
* @param {number} elementWidth Width of the element in pixels.
|
1125
|
-
* @param {number} elementHeight Height of the element in pixels.
|
1126
|
-
* @return {number} Value with the collision flags.
|
1127
|
-
*/
|
1128
|
-
function getViewportCollisions(coords, elementWidth, elementHeight) {
|
1129
|
-
var viewportTop = session.scrollTop,
|
1130
|
-
viewportLeft = session.scrollLeft,
|
1131
|
-
viewportBottom = viewportTop + session.windowHeight,
|
1132
|
-
viewportRight = viewportLeft + session.windowWidth,
|
1133
|
-
collisions = Collision.none;
|
1134
|
-
|
1135
|
-
if (coords.top < viewportTop || Math.abs(coords.bottom - session.windowHeight) - elementHeight < viewportTop) {
|
1136
|
-
collisions |= Collision.top;
|
1137
|
-
}
|
1138
|
-
if (coords.top + elementHeight > viewportBottom || Math.abs(coords.bottom - session.windowHeight) > viewportBottom) {
|
1139
|
-
collisions |= Collision.bottom;
|
1140
|
-
}
|
1141
|
-
if (coords.left < viewportLeft || coords.right + elementWidth > viewportRight) {
|
1142
|
-
collisions |= Collision.left;
|
1143
|
-
}
|
1144
|
-
if (coords.left + elementWidth > viewportRight || coords.right < viewportLeft) {
|
1145
|
-
collisions |= Collision.right;
|
1146
|
-
}
|
1147
|
-
|
1148
|
-
return collisions;
|
1149
|
-
}
|
1150
|
-
|
1151
|
-
/**
|
1152
|
-
* Counts the number of bits set on a flags value.
|
1153
|
-
* @param {number} value The flags value.
|
1154
|
-
* @return {number} The number of bits that have been set.
|
1155
|
-
*/
|
1156
|
-
function countFlags(value) {
|
1157
|
-
var count = 0;
|
1158
|
-
while (value) {
|
1159
|
-
value &= value - 1;
|
1160
|
-
count++;
|
1161
|
-
}
|
1162
|
-
return count;
|
1163
|
-
}
|
1164
|
-
|
1165
|
-
}));
|