station 0.0.0 → 0.0.100
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.buildpacks +1 -0
- data/.editorconfig +23 -0
- data/.env.example +33 -0
- data/.gitignore +37 -22
- data/CODE_OF_CONDUCT.md +46 -0
- data/CONTRIBUTING.md +46 -0
- data/Dockerfile +69 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +14 -0
- data/LICENSE.md +400 -20
- data/LICENSE.txt +9 -0
- data/Procfile +1 -0
- data/README.md +54 -20
- data/app.json +24 -0
- data/babel.config.js +74 -0
- data/bin/nexmo-developer +120 -0
- data/docs/Getting-Started.md +39 -0
- data/docs/How-To-Use.md +272 -0
- data/docs/_config.yml +5 -0
- data/docs/index.md +46 -0
- data/lib/nexmo_developer/.disallowed_words +2 -0
- data/lib/nexmo_developer/.dockerignore +1 -0
- data/lib/nexmo_developer/.eslintrc.js +6 -0
- data/lib/nexmo_developer/.nvmrc +1 -0
- data/lib/nexmo_developer/.postcssrc.yml +4 -0
- data/lib/nexmo_developer/.pre-commit-config.yaml +8 -0
- data/lib/nexmo_developer/.rspec +3 -0
- data/lib/nexmo_developer/.rubocop.yml +276 -0
- data/lib/nexmo_developer/.ruby-version +1 -0
- data/lib/nexmo_developer/Dockerfile +28 -0
- data/lib/nexmo_developer/Gemfile +192 -0
- data/lib/nexmo_developer/Gemfile.lock +630 -0
- data/lib/nexmo_developer/Guardfile +109 -0
- data/lib/nexmo_developer/Procfile +2 -0
- data/lib/nexmo_developer/Rakefile +6 -0
- data/lib/nexmo_developer/Runbook.md +69 -0
- data/lib/nexmo_developer/app/admin/active_admin_feedback_author.rb +23 -0
- data/lib/nexmo_developer/app/admin/active_admin_redirect.rb +22 -0
- data/lib/nexmo_developer/app/admin/active_admin_session.rb +34 -0
- data/lib/nexmo_developer/app/admin/admin_building_block_event.rb +31 -0
- data/lib/nexmo_developer/app/admin/admin_event.rb +40 -0
- data/lib/nexmo_developer/app/admin/admin_feedback_feedback.rb +54 -0
- data/lib/nexmo_developer/app/admin/admin_feedback_resource.rb +42 -0
- data/lib/nexmo_developer/app/admin/admin_user.rb +37 -0
- data/lib/nexmo_developer/app/assets/config/manifest.js +5 -0
- data/lib/nexmo_developer/app/assets/fonts/Lato-Black.woff +0 -0
- data/lib/nexmo_developer/app/assets/fonts/Lato-Black.woff2 +0 -0
- data/lib/nexmo_developer/app/assets/fonts/Lato-Regular.woff +0 -0
- data/lib/nexmo_developer/app/assets/fonts/Lato-Regular.woff2 +0 -0
- data/lib/nexmo_developer/app/assets/fonts/Lato-Semibold.woff +0 -0
- data/lib/nexmo_developer/app/assets/fonts/Lato-Semibold.woff2 +0 -0
- data/lib/nexmo_developer/app/assets/fonts/icomoon.eot +0 -0
- data/lib/nexmo_developer/app/assets/fonts/icomoon.json +1257 -0
- data/lib/nexmo_developer/app/assets/fonts/icomoon.svg +55 -0
- data/lib/nexmo_developer/app/assets/fonts/icomoon.ttf +0 -0
- data/lib/nexmo_developer/app/assets/fonts/icomoon.woff +0 -0
- data/lib/nexmo_developer/app/assets/fonts/nexmo-developer.json +36483 -0
- data/lib/nexmo_developer/app/assets/images/.keep +0 -0
- data/lib/nexmo_developer/app/assets/images/logo@3x.png +0 -0
- data/lib/nexmo_developer/app/assets/images/logo_vonage.png +0 -0
- data/lib/nexmo_developer/app/assets/images/nexmo-developer-logo.svg +25 -0
- data/lib/nexmo_developer/app/assets/images/nexmo-logo-collapsed.svg +10 -0
- data/lib/nexmo_developer/app/assets/images/nexmo-vonage-white.svg +79 -0
- data/lib/nexmo_developer/app/assets/images/posters/chatapp.jpg +0 -0
- data/lib/nexmo_developer/app/assets/images/posters/chatapp_small.png +0 -0
- data/lib/nexmo_developer/app/assets/images/posters/nexmo.jpg +0 -0
- data/lib/nexmo_developer/app/assets/images/posters/numberinsight.jpg +0 -0
- data/lib/nexmo_developer/app/assets/images/posters/numberinsight_small.png +0 -0
- data/lib/nexmo_developer/app/assets/images/posters/sms.jpg +0 -0
- data/lib/nexmo_developer/app/assets/images/posters/sms_small.png +0 -0
- data/lib/nexmo_developer/app/assets/images/posters/verify.jpg +0 -0
- data/lib/nexmo_developer/app/assets/images/posters/verify_small.png +0 -0
- data/lib/nexmo_developer/app/assets/images/posters/voice.jpg +0 -0
- data/lib/nexmo_developer/app/assets/images/posters/voice_small.png +0 -0
- data/lib/nexmo_developer/app/assets/images/select-dropdown.png +0 -0
- data/lib/nexmo_developer/app/assets/images/slack.svg +33 -0
- data/lib/nexmo_developer/app/assets/images/themes/ea/topography.png +0 -0
- data/lib/nexmo_developer/app/assets/javascripts/active_admin.js.coffee +1 -0
- data/lib/nexmo_developer/app/assets/javascripts/application.js +19 -0
- data/lib/nexmo_developer/app/assets/javascripts/stats.js +14 -0
- data/lib/nexmo_developer/app/assets/regex/matching_chars.rb +1 -0
- data/lib/nexmo_developer/app/assets/regex/sequence_diagram_regex.rb +1 -0
- data/lib/nexmo_developer/app/assets/regex/stats_regex.rb +1 -0
- data/lib/nexmo_developer/app/assets/regex/webfont_regex.rb +1 -0
- data/lib/nexmo_developer/app/assets/stylesheets/active_admin.scss +17 -0
- data/lib/nexmo_developer/app/assets/stylesheets/application.css +1 -0
- data/lib/nexmo_developer/app/channels/application_cable/channel.rb +4 -0
- data/lib/nexmo_developer/app/channels/application_cable/connection.rb +4 -0
- data/lib/nexmo_developer/app/constraints/documentation_constraint.rb +25 -0
- data/lib/nexmo_developer/app/constraints/landing_page_constraint.rb +18 -0
- data/lib/nexmo_developer/app/constraints/locale_constraint.rb +17 -0
- data/lib/nexmo_developer/app/constraints/open_api_constraint.rb +49 -0
- data/lib/nexmo_developer/app/controllers/admin_api/code_snippets_controller.rb +45 -0
- data/lib/nexmo_developer/app/controllers/admin_api/feedback_controller.rb +11 -0
- data/lib/nexmo_developer/app/controllers/admin_api_controller.rb +17 -0
- data/lib/nexmo_developer/app/controllers/api_controller.rb +33 -0
- data/lib/nexmo_developer/app/controllers/api_errors_controller.rb +82 -0
- data/lib/nexmo_developer/app/controllers/application_controller.rb +93 -0
- data/lib/nexmo_developer/app/controllers/careers_controller.rb +9 -0
- data/lib/nexmo_developer/app/controllers/concerns/.keep +0 -0
- data/lib/nexmo_developer/app/controllers/dashboard_controller.rb +216 -0
- data/lib/nexmo_developer/app/controllers/extend_controller.rb +45 -0
- data/lib/nexmo_developer/app/controllers/feedback/feedbacks_controller.rb +85 -0
- data/lib/nexmo_developer/app/controllers/feeds_controller.rb +20 -0
- data/lib/nexmo_developer/app/controllers/jobs_controller.rb +64 -0
- data/lib/nexmo_developer/app/controllers/markdown_controller.rb +160 -0
- data/lib/nexmo_developer/app/controllers/search_controller.rb +35 -0
- data/lib/nexmo_developer/app/controllers/sessions_controller.rb +12 -0
- data/lib/nexmo_developer/app/controllers/slack_controller.rb +61 -0
- data/lib/nexmo_developer/app/controllers/static_controller.rb +195 -0
- data/lib/nexmo_developer/app/controllers/tutorial_controller.rb +113 -0
- data/lib/nexmo_developer/app/controllers/usage/ab_result_controller.rb +10 -0
- data/lib/nexmo_developer/app/controllers/usage/code_snippet_controller.rb +19 -0
- data/lib/nexmo_developer/app/controllers/use_case_controller.rb +65 -0
- data/lib/nexmo_developer/app/extensions/nokogiri/html/document.rb +23 -0
- data/lib/nexmo_developer/app/helpers/application_helper.rb +66 -0
- data/lib/nexmo_developer/app/helpers/date_range_helper.rb +9 -0
- data/lib/nexmo_developer/app/helpers/navigation_helper.rb +56 -0
- data/lib/nexmo_developer/app/helpers/parameter_values_helper.rb +5 -0
- data/lib/nexmo_developer/app/helpers/video_helper.rb +20 -0
- data/lib/nexmo_developer/app/jobs/application_job.rb +2 -0
- data/lib/nexmo_developer/app/mailers/application_mailer.rb +4 -0
- data/lib/nexmo_developer/app/middleware/nexmo_developer/building_block_redirect.rb +18 -0
- data/lib/nexmo_developer/app/middleware/nexmo_developer/visitor_id.rb +13 -0
- data/lib/nexmo_developer/app/models/api_error.rb +31 -0
- data/lib/nexmo_developer/app/models/application_record.rb +3 -0
- data/lib/nexmo_developer/app/models/concerns/.keep +0 -0
- data/lib/nexmo_developer/app/models/concerns/publishable.rb +13 -0
- data/lib/nexmo_developer/app/models/event.rb +38 -0
- data/lib/nexmo_developer/app/models/feedback.rb +5 -0
- data/lib/nexmo_developer/app/models/feedback/author.rb +5 -0
- data/lib/nexmo_developer/app/models/feedback/config.rb +16 -0
- data/lib/nexmo_developer/app/models/feedback/feedback.rb +34 -0
- data/lib/nexmo_developer/app/models/feedback/resource.rb +45 -0
- data/lib/nexmo_developer/app/models/product.rb +22 -0
- data/lib/nexmo_developer/app/models/redirect.rb +2 -0
- data/lib/nexmo_developer/app/models/session.rb +9 -0
- data/lib/nexmo_developer/app/models/tutorial.rb +189 -0
- data/lib/nexmo_developer/app/models/tutorial/file_loader.rb +28 -0
- data/lib/nexmo_developer/app/models/tutorial/metadata.rb +54 -0
- data/lib/nexmo_developer/app/models/tutorial/prerequisite.rb +31 -0
- data/lib/nexmo_developer/app/models/tutorial/task.rb +45 -0
- data/lib/nexmo_developer/app/models/usage.rb +5 -0
- data/lib/nexmo_developer/app/models/usage/code_snippet_event.rb +7 -0
- data/lib/nexmo_developer/app/models/user.rb +14 -0
- data/lib/nexmo_developer/app/presenters/card.rb +20 -0
- data/lib/nexmo_developer/app/presenters/career.rb +40 -0
- data/lib/nexmo_developer/app/presenters/feedback_presenter.rb +31 -0
- data/lib/nexmo_developer/app/presenters/footer.rb +88 -0
- data/lib/nexmo_developer/app/presenters/head.rb +96 -0
- data/lib/nexmo_developer/app/presenters/header.rb +56 -0
- data/lib/nexmo_developer/app/presenters/improve_page_presenter.rb +19 -0
- data/lib/nexmo_developer/app/presenters/languages_dropdown_presenter.rb +19 -0
- data/lib/nexmo_developer/app/presenters/locale_switcher_presenter.rb +36 -0
- data/lib/nexmo_developer/app/presenters/navigation.rb +44 -0
- data/lib/nexmo_developer/app/presenters/page_title.rb +38 -0
- data/lib/nexmo_developer/app/presenters/product_dropdown_presenter.rb +39 -0
- data/lib/nexmo_developer/app/presenters/sidenav.rb +64 -0
- data/lib/nexmo_developer/app/presenters/sidenav_item.rb +58 -0
- data/lib/nexmo_developer/app/presenters/sidenav_resolver.rb +136 -0
- data/lib/nexmo_developer/app/presenters/sidenav_subitem.rb +71 -0
- data/lib/nexmo_developer/app/presenters/title_normalizer.rb +25 -0
- data/lib/nexmo_developer/app/presenters/topnav.rb +23 -0
- data/lib/nexmo_developer/app/presenters/topnav_item.rb +19 -0
- data/lib/nexmo_developer/app/presenters/tutorial_list_item.rb +99 -0
- data/lib/nexmo_developer/app/screenshots/webhook-url-for-delivery-receipt.js +44 -0
- data/lib/nexmo_developer/app/screenshots/webhook-url-for-inbound-message.js +44 -0
- data/lib/nexmo_developer/app/services/diff.rb +146 -0
- data/lib/nexmo_developer/app/services/email_validator.rb +6 -0
- data/lib/nexmo_developer/app/services/feedback_slack_notifier.rb +141 -0
- data/lib/nexmo_developer/app/services/greenhouse.rb +45 -0
- data/lib/nexmo_developer/app/services/load_config.rb +14 -0
- data/lib/nexmo_developer/app/services/locale_redirector.rb +29 -0
- data/lib/nexmo_developer/app/services/not_found_notifier.rb +34 -0
- data/lib/nexmo_developer/app/services/open_api_definition_resolver.rb +25 -0
- data/lib/nexmo_developer/app/services/redirector.rb +33 -0
- data/lib/nexmo_developer/app/services/search/article.rb +39 -0
- data/lib/nexmo_developer/app/services/search/document.rb +37 -0
- data/lib/nexmo_developer/app/services/search_terms.rb +27 -0
- data/lib/nexmo_developer/app/services/smartling_api.rb +72 -0
- data/lib/nexmo_developer/app/services/translator/file_translator.rb +61 -0
- data/lib/nexmo_developer/app/services/translator/smartling/api/base.rb +54 -0
- data/lib/nexmo_developer/app/services/translator/smartling/api/create_batch.rb +48 -0
- data/lib/nexmo_developer/app/services/translator/smartling/api/create_job.rb +44 -0
- data/lib/nexmo_developer/app/services/translator/smartling/api/download_file.rb +44 -0
- data/lib/nexmo_developer/app/services/translator/smartling/api/file_status.rb +43 -0
- data/lib/nexmo_developer/app/services/translator/smartling/api/file_uris.rb +46 -0
- data/lib/nexmo_developer/app/services/translator/smartling/api/upload_file.rb +67 -0
- data/lib/nexmo_developer/app/services/translator/smartling/api_requests_generator.rb +64 -0
- data/lib/nexmo_developer/app/services/translator/smartling/token_generator.rb +16 -0
- data/lib/nexmo_developer/app/services/translator/smartling_coordinator.rb +56 -0
- data/lib/nexmo_developer/app/services/translator/smartling_downloader.rb +57 -0
- data/lib/nexmo_developer/app/services/translator/translation_request.rb +11 -0
- data/lib/nexmo_developer/app/services/translator/translator_coordinator.rb +33 -0
- data/lib/nexmo_developer/app/services/translator/utils.rb +42 -0
- data/lib/nexmo_developer/app/services/tutorial_list.rb +39 -0
- data/lib/nexmo_developer/app/views/admin/feedbacks/_steps.html.erb +44 -0
- data/lib/nexmo_developer/app/views/admin_api/code_snippets/index.json.erb +1 -0
- data/lib/nexmo_developer/app/views/admin_api/feedback/index.json.jbuilder +3 -0
- data/lib/nexmo_developer/app/views/api/show.html.erb +1 -0
- data/lib/nexmo_developer/app/views/api_errors/_error_example.html.erb +9 -0
- data/lib/nexmo_developer/app/views/api_errors/_error_table.html.erb +30 -0
- data/lib/nexmo_developer/app/views/api_errors/index.html.erb +45 -0
- data/lib/nexmo_developer/app/views/api_errors/show.html.erb +27 -0
- data/lib/nexmo_developer/app/views/careers/index.html.erb +76 -0
- data/lib/nexmo_developer/app/views/code_languages/_icon.html.erb +11 -0
- data/lib/nexmo_developer/app/views/contribute/administration/page-links.md +179 -0
- data/lib/nexmo_developer/app/views/contribute/code-snippets/how-to-update-code-snippets.md +89 -0
- data/lib/nexmo_developer/app/views/contribute/code-snippets/sample-code-snippet.md +42 -0
- data/lib/nexmo_developer/app/views/contribute/guides/code-examples.md +190 -0
- data/lib/nexmo_developer/app/views/contribute/guides/introduction.md +32 -0
- data/lib/nexmo_developer/app/views/contribute/guides/landing-pages.md +556 -0
- data/lib/nexmo_developer/app/views/contribute/guides/markdown-guide.md +420 -0
- data/lib/nexmo_developer/app/views/contribute/guides/platform.md +220 -0
- data/lib/nexmo_developer/app/views/contribute/guides/tutorials-and-use-cases.md +64 -0
- data/lib/nexmo_developer/app/views/contribute/guides/writing-style-guide.md +278 -0
- data/lib/nexmo_developer/app/views/contribute/overview.md +39 -0
- data/lib/nexmo_developer/app/views/contribute/structure/content-types/code-snippets.md +140 -0
- data/lib/nexmo_developer/app/views/contribute/structure/content-types/guides.md +14 -0
- data/lib/nexmo_developer/app/views/contribute/structure/content-types/overviews.md +34 -0
- data/lib/nexmo_developer/app/views/contribute/structure/content-types/tutorials.md +59 -0
- data/lib/nexmo_developer/app/views/contribute/structure/content-types/use-cases.md +18 -0
- data/lib/nexmo_developer/app/views/contribute/structure/overview.md +55 -0
- data/lib/nexmo_developer/app/views/contribute/tutorials-and-use-cases/tutorials.md +197 -0
- data/lib/nexmo_developer/app/views/contribute/tutorials-and-use-cases/use-cases.md +22 -0
- data/lib/nexmo_developer/app/views/dashboard/_performance_table.html.erb +18 -0
- data/lib/nexmo_developer/app/views/dashboard/coverage.html.erb +169 -0
- data/lib/nexmo_developer/app/views/dashboard/stats.html.erb +134 -0
- data/lib/nexmo_developer/app/views/dashboard/stats_summary.html.erb +62 -0
- data/lib/nexmo_developer/app/views/extend/index.html.erb +33 -0
- data/lib/nexmo_developer/app/views/extend/show.html.erb +31 -0
- data/lib/nexmo_developer/app/views/layouts/api.html.erb +24 -0
- data/lib/nexmo_developer/app/views/layouts/application.html.erb +15 -0
- data/lib/nexmo_developer/app/views/layouts/documentation-index.html.erb +16 -0
- data/lib/nexmo_developer/app/views/layouts/documentation.html.erb +26 -0
- data/lib/nexmo_developer/app/views/layouts/landing.html.erb +17 -0
- data/lib/nexmo_developer/app/views/layouts/mailer.html.erb +13 -0
- data/lib/nexmo_developer/app/views/layouts/mailer.text.erb +1 -0
- data/lib/nexmo_developer/app/views/layouts/open-api.html.erb +10 -0
- data/lib/nexmo_developer/app/views/layouts/page-full.html.erb +9 -0
- data/lib/nexmo_developer/app/views/layouts/page.html.erb +15 -0
- data/lib/nexmo_developer/app/views/layouts/partials/_feedback.html.erb +14 -0
- data/lib/nexmo_developer/app/views/layouts/partials/_footer.html.erb +50 -0
- data/lib/nexmo_developer/app/views/layouts/partials/_head.html.erb +139 -0
- data/lib/nexmo_developer/app/views/layouts/partials/_header.html.erb +57 -0
- data/lib/nexmo_developer/app/views/layouts/partials/_improve_this_page.html.erb +16 -0
- data/lib/nexmo_developer/app/views/layouts/partials/_locale_switcher.html.erb +28 -0
- data/lib/nexmo_developer/app/views/layouts/partials/_notices.html.erb +29 -0
- data/lib/nexmo_developer/app/views/layouts/partials/_post-body-tags.html.erb +4 -0
- data/lib/nexmo_developer/app/views/layouts/partials/_product_dropdown.html.erb +30 -0
- data/lib/nexmo_developer/app/views/layouts/partials/_programming_languages_dropdown.html.erb +29 -0
- data/lib/nexmo_developer/app/views/layouts/partials/_sidenav.html.erb +3 -0
- data/lib/nexmo_developer/app/views/layouts/partials/_sidenav_item.html.erb +18 -0
- data/lib/nexmo_developer/app/views/layouts/partials/_sidenav_subitem.html.erb +34 -0
- data/lib/nexmo_developer/app/views/layouts/partials/api/_voice.html.erb +84 -0
- data/lib/nexmo_developer/app/views/layouts/static.html.erb +33 -0
- data/lib/nexmo_developer/app/views/markdown/show.html.erb +1 -0
- data/lib/nexmo_developer/app/views/markdown/wip.html.erb +5 -0
- data/lib/nexmo_developer/app/views/product-lifecycle/beta.md +28 -0
- data/lib/nexmo_developer/app/views/product-lifecycle/dev-preview.md +22 -0
- data/lib/nexmo_developer/app/views/search/_result.html.erb +31 -0
- data/lib/nexmo_developer/app/views/search/results.html.erb +26 -0
- data/lib/nexmo_developer/app/views/sessions/set_user_locale.js.erb +1 -0
- data/lib/nexmo_developer/app/views/slack/join.html.erb +25 -0
- data/lib/nexmo_developer/app/views/static/404.html.erb +26 -0
- data/lib/nexmo_developer/app/views/static/_career.html.erb +15 -0
- data/lib/nexmo_developer/app/views/static/_community.html.erb +24 -0
- data/lib/nexmo_developer/app/views/static/_dotnet.html.erb +26 -0
- data/lib/nexmo_developer/app/views/static/_event.html.erb +7 -0
- data/lib/nexmo_developer/app/views/static/_products.html.erb +450 -0
- data/lib/nexmo_developer/app/views/static/_profile.html.erb +9 -0
- data/lib/nexmo_developer/app/views/static/_slack.html.erb +2 -0
- data/lib/nexmo_developer/app/views/static/_xwithy.html.erb +33 -0
- data/lib/nexmo_developer/app/views/static/default_landing.html.erb +22 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_action_button.html.erb +13 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_api_list.html.erb +30 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_call_to_action.html.erb +35 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_career.html.erb +3 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_client_sdk_card.html.erb +17 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_contact_community.html.erb +15 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_contact_support.html.erb +14 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_event_search_results.js.erb +2 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_event_search_results_content.html.erb +9 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_event_search_results_map_content.html.erb +10 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_events.html.erb +80 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_featured_session.html.erb +18 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_github_repo.html.erb +31 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_header.html.erb +24 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_headshot.html.erb +43 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_html.html.erb +3 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_join_slack.html.erb +3 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_line_divider.html.erb +5 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_linked_image.html.erb +10 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_migrate_details.html.erb +57 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_products.html.erb +1 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_section_header.html.erb +10 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_sessions.html.erb +30 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_structured_text.html.erb +24 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_submit_your_idea_form.html.erb +58 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_table.html.erb +25 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_team_members.html.erb +5 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_text.html.erb +5 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_tutorial.html.erb +30 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_unordered_list.html.erb +11 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_warning_callout.html.erb +8 -0
- data/lib/nexmo_developer/app/views/static/default_landing/partials/_write_for_nexmo.html.erb +12 -0
- data/lib/nexmo_developer/app/views/static/documentation.html.erb +1 -0
- data/lib/nexmo_developer/app/views/static/landing.html.erb +47 -0
- data/lib/nexmo_developer/app/views/static/past_events.html.erb +19 -0
- data/lib/nexmo_developer/app/views/static/podcast.html.erb +40 -0
- data/lib/nexmo_developer/app/views/static/robots.txt.erb +4 -0
- data/lib/nexmo_developer/app/views/tools/concatenation.html +1 -0
- data/lib/nexmo_developer/app/views/tutorial/_prerequisites.html.erb +23 -0
- data/lib/nexmo_developer/app/views/tutorial/index.html.erb +81 -0
- data/lib/nexmo_developer/app/views/tutorial/list.html.erb +63 -0
- data/lib/nexmo_developer/app/views/tutorial/single.html.erb +1 -0
- data/lib/nexmo_developer/app/views/use_case/_index.html.erb +53 -0
- data/lib/nexmo_developer/app/views/use_case/index.html.erb +12 -0
- data/lib/nexmo_developer/app/views/use_case/list/plain.html.erb +5 -0
- data/lib/nexmo_developer/app/views/use_case/show.html.erb +8 -0
- data/lib/nexmo_developer/app/webpacker/javascript/api_status/index.js +20 -0
- data/lib/nexmo_developer/app/webpacker/javascript/careers/index.js +134 -0
- data/lib/nexmo_developer/app/webpacker/javascript/code_snippet_events/index.js +89 -0
- data/lib/nexmo_developer/app/webpacker/javascript/components/concatenation/Concatenation.vue +96 -0
- data/lib/nexmo_developer/app/webpacker/javascript/components/concatenation/character_counter.js +112 -0
- data/lib/nexmo_developer/app/webpacker/javascript/components/feedback/Feedback.vue +156 -0
- data/lib/nexmo_developer/app/webpacker/javascript/components/feedback/FeedbackPath.vue +56 -0
- data/lib/nexmo_developer/app/webpacker/javascript/components/feedback/eventHub.js +3 -0
- data/lib/nexmo_developer/app/webpacker/javascript/components/feedback/step/FieldSet.vue +78 -0
- data/lib/nexmo_developer/app/webpacker/javascript/components/feedback/step/Plain.vue +26 -0
- data/lib/nexmo_developer/app/webpacker/javascript/components/feedback/step/RadioGroup.vue +65 -0
- data/lib/nexmo_developer/app/webpacker/javascript/components/feedback/step/TextArea.vue +86 -0
- data/lib/nexmo_developer/app/webpacker/javascript/components/feedback/step/base.vue +53 -0
- data/lib/nexmo_developer/app/webpacker/javascript/components/feedback/store.js +50 -0
- data/lib/nexmo_developer/app/webpacker/javascript/components/jwt_generator/JwtGenerator.vue +220 -0
- data/lib/nexmo_developer/app/webpacker/javascript/components/search/NDPArticle.vue +38 -0
- data/lib/nexmo_developer/app/webpacker/javascript/components/search/Search.vue +182 -0
- data/lib/nexmo_developer/app/webpacker/javascript/components/search/ZendeskArticle.vue +30 -0
- data/lib/nexmo_developer/app/webpacker/javascript/format/index.js +36 -0
- data/lib/nexmo_developer/app/webpacker/javascript/github_cards/index.js +16 -0
- data/lib/nexmo_developer/app/webpacker/javascript/locale_switcher/index.js +40 -0
- data/lib/nexmo_developer/app/webpacker/javascript/notices/index.js +52 -0
- data/lib/nexmo_developer/app/webpacker/javascript/scroll/index.js +25 -0
- data/lib/nexmo_developer/app/webpacker/javascript/sidenav/index.js +251 -0
- data/lib/nexmo_developer/app/webpacker/javascript/spotlight/index.js +12 -0
- data/lib/nexmo_developer/app/webpacker/javascript/volta/tooltip.min.js +5 -0
- data/lib/nexmo_developer/app/webpacker/javascript/volta/volta.js +2145 -0
- data/lib/nexmo_developer/app/webpacker/javascript/volta_tabbed_examples/index.js +106 -0
- data/lib/nexmo_developer/app/webpacker/javascript/volta_tabbed_examples/user_preference.js +78 -0
- data/lib/nexmo_developer/app/webpacker/packs/application.js +136 -0
- data/lib/nexmo_developer/app/webpacker/src/application.css +0 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/application.scss +62 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/custom/_core.scss +196 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/custom/_mixins.scss +51 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/custom/_syntax.scss +63 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/custom/_typography.scss +248 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/custom/_variables.scss +23 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/layout/_api.scss +167 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/layout/_careers.scss +29 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/layout/_community.scss +70 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/layout/_feedback.scss +16 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/layout/_footer.scss +113 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/layout/_header.scss +207 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/layout/_hero.scss +16 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/layout/_print.scss +14 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/layout/_search.scss +115 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/layout/_team.scss +36 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/objects/_building-block.scss +32 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/objects/_card.scss +150 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/objects/_collapsible.scss +18 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/objects/_content-block.scss +24 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/objects/_extend.scss +49 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/objects/_focus.scss +5 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/objects/_icons.scss +334 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/objects/_js-sequence-diagram.scss +9 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/objects/_navigation.scss +113 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/objects/_notices.scss +49 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/objects/_tabs.scss +35 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/objects/_use_cases.scss +29 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/objects/_video.scss +14 -0
- data/lib/nexmo_developer/app/webpacker/stylesheets/themes/_ea.scss +32 -0
- data/lib/nexmo_developer/bin/initiate +23 -0
- data/lib/nexmo_developer/bin/rails +4 -0
- data/lib/nexmo_developer/bin/setup +36 -0
- data/lib/nexmo_developer/bin/update +31 -0
- data/lib/nexmo_developer/bin/webpack +19 -0
- data/lib/nexmo_developer/bin/webpack-dev-server +19 -0
- data/lib/nexmo_developer/bin/yarn +11 -0
- data/lib/nexmo_developer/config.ru +5 -0
- data/lib/nexmo_developer/config/application.rb +44 -0
- data/lib/nexmo_developer/config/boot.rb +4 -0
- data/lib/nexmo_developer/config/cable.yml +10 -0
- data/lib/nexmo_developer/config/credentials.yml.enc +1 -0
- data/lib/nexmo_developer/config/database.yml +91 -0
- data/lib/nexmo_developer/config/dynamic_content.yml +1 -0
- data/lib/nexmo_developer/config/environment.rb +7 -0
- data/lib/nexmo_developer/config/environments/development.rb +63 -0
- data/lib/nexmo_developer/config/environments/production.rb +102 -0
- data/lib/nexmo_developer/config/environments/staging.rb +86 -0
- data/lib/nexmo_developer/config/environments/test.rb +48 -0
- data/lib/nexmo_developer/config/feedback.yml +104 -0
- data/lib/nexmo_developer/config/initializers/active_admin.rb +295 -0
- data/lib/nexmo_developer/config/initializers/algolia.rb +30 -0
- data/lib/nexmo_developer/config/initializers/application_controller_renderer.rb +8 -0
- data/lib/nexmo_developer/config/initializers/assets.rb +16 -0
- data/lib/nexmo_developer/config/initializers/backtrace_silencers.rb +7 -0
- data/lib/nexmo_developer/config/initializers/bugsnag.rb +8 -0
- data/lib/nexmo_developer/config/initializers/content_security_policy.rb +25 -0
- data/lib/nexmo_developer/config/initializers/cookies_serializer.rb +5 -0
- data/lib/nexmo_developer/config/initializers/devise.rb +279 -0
- data/lib/nexmo_developer/config/initializers/doc_finder.rb +10 -0
- data/lib/nexmo_developer/config/initializers/filter_parameter_logging.rb +4 -0
- data/lib/nexmo_developer/config/initializers/geocoder.rb +24 -0
- data/lib/nexmo_developer/config/initializers/gravatar_image_tag.rb +5 -0
- data/lib/nexmo_developer/config/initializers/greenhouse_io.rb +7 -0
- data/lib/nexmo_developer/config/initializers/inflections.rb +16 -0
- data/lib/nexmo_developer/config/initializers/locale.rb +6 -0
- data/lib/nexmo_developer/config/initializers/mime_types.rb +4 -0
- data/lib/nexmo_developer/config/initializers/recaptcha.rb +6 -0
- data/lib/nexmo_developer/config/initializers/session_store.rb +3 -0
- data/lib/nexmo_developer/config/initializers/slack_safety_check.rb +29 -0
- data/lib/nexmo_developer/config/initializers/split.rb +5 -0
- data/lib/nexmo_developer/config/initializers/wrap_parameters.rb +14 -0
- data/lib/nexmo_developer/config/initializers/zeitwerk.rb +7 -0
- data/lib/nexmo_developer/config/master.key +1 -0
- data/lib/nexmo_developer/config/newrelic.yml +35 -0
- data/lib/nexmo_developer/config/puma.rb +41 -0
- data/lib/nexmo_developer/config/redirects.yml +280 -0
- data/lib/nexmo_developer/config/repos.yml +27 -0
- data/lib/nexmo_developer/config/routes.rb +108 -0
- data/lib/nexmo_developer/config/secrets.yml +25 -0
- data/lib/nexmo_developer/config/spring.rb +6 -0
- data/lib/nexmo_developer/config/stitch-redirects.yml +145 -0
- data/lib/nexmo_developer/config/storage.yml +34 -0
- data/lib/nexmo_developer/config/tutorials/.gitkeep +0 -0
- data/lib/nexmo_developer/config/tutorials/en/app-to-app.yml +49 -0
- data/lib/nexmo_developer/config/tutorials/en/app-to-phone.yml +43 -0
- data/lib/nexmo_developer/config/tutorials/en/create-and-retrieve-a-report.yml +24 -0
- data/lib/nexmo_developer/config/tutorials/en/create-report-using-graphical-tools.yml +20 -0
- data/lib/nexmo_developer/config/tutorials/en/get-json-records-cli.yml +20 -0
- data/lib/nexmo_developer/config/tutorials/en/ifttt-to-sms.yml +10 -0
- data/lib/nexmo_developer/config/tutorials/en/in-app-messaging.yml +4 -0
- data/lib/nexmo_developer/config/tutorials/en/in-app-messaging/javascript.yml +50 -0
- data/lib/nexmo_developer/config/tutorials/en/in-app-messaging/kotlin.yml +52 -0
- data/lib/nexmo_developer/config/tutorials/en/in-app-messaging/objective_c.yml +50 -0
- data/lib/nexmo_developer/config/tutorials/en/in-app-messaging/swift.yml +50 -0
- data/lib/nexmo_developer/config/tutorials/en/number-insight-api-aspnet.yml +11 -0
- data/lib/nexmo_developer/config/tutorials/en/phone-to-app.yml +4 -0
- data/lib/nexmo_developer/config/tutorials/en/phone-to-app/javascript.yml +38 -0
- data/lib/nexmo_developer/config/tutorials/en/receive-sms-dotnet.yml +9 -0
- data/lib/nexmo_developer/config/tutorials/en/receive-sms-with-java.yml +9 -0
- data/lib/nexmo_developer/config/tutorials/en/receive-sms-with-php.yml +10 -0
- data/lib/nexmo_developer/config/tutorials/en/receive-sms-with-ruby.yml +9 -0
- data/lib/nexmo_developer/config/tutorials/en/send-facebook-message-with-failover.yml +41 -0
- data/lib/nexmo_developer/config/tutorials/en/send-fbm-message.yml +42 -0
- data/lib/nexmo_developer/config/tutorials/en/send-sms-with-dotnet.yml +9 -0
- data/lib/nexmo_developer/config/tutorials/en/send-sms-with-flask.yml +9 -0
- data/lib/nexmo_developer/config/tutorials/en/send-sms-with-java.yml +9 -0
- data/lib/nexmo_developer/config/tutorials/en/send-sms-with-messages.yml +38 -0
- data/lib/nexmo_developer/config/tutorials/en/send-sms-with-php.yml +9 -0
- data/lib/nexmo_developer/config/tutorials/en/send-sms-with-ruby.yml +9 -0
- data/lib/nexmo_developer/config/tutorials/en/send-viber-message.yml +40 -0
- data/lib/nexmo_developer/config/tutorials/en/send-whatsapp-message.yml +40 -0
- data/lib/nexmo_developer/config/tutorials/en/sms-browser-notifications.yml +10 -0
- data/lib/nexmo_developer/config/tutorials/en/sms-dlr-with-dotnet.yml +9 -0
- data/lib/nexmo_developer/config/tutorials/en/sms-dlr-with-php.yml +9 -0
- data/lib/nexmo_developer/config/tutorials/en/sms-dlr-with-ruby.yml +9 -0
- data/lib/nexmo_developer/config/tutorials/en/sms-fortune-cookies-with-ibm-cloud.yml +10 -0
- data/lib/nexmo_developer/config/tutorials/en/two-factor-authentication-dotnet-verify-api.yml +11 -0
- data/lib/nexmo_developer/config/webpack/custom.js +7 -0
- data/lib/nexmo_developer/config/webpack/development.js +3 -0
- data/lib/nexmo_developer/config/webpack/environment.js +22 -0
- data/lib/nexmo_developer/config/webpack/loaders/vue.js +6 -0
- data/lib/nexmo_developer/config/webpack/production.js +3 -0
- data/lib/nexmo_developer/config/webpack/staging.js +4 -0
- data/lib/nexmo_developer/config/webpack/test.js +3 -0
- data/lib/nexmo_developer/config/webpacker.yml +82 -0
- data/lib/nexmo_developer/db/migrate/20170215101603_create_events.rb +15 -0
- data/lib/nexmo_developer/db/migrate/20170413143802_enable_uuid_ossp_extension.rb +6 -0
- data/lib/nexmo_developer/db/migrate/20170413154102_change_event_id_to_uuid.rb +7 -0
- data/lib/nexmo_developer/db/migrate/20170413154510_create_sessions.rb +13 -0
- data/lib/nexmo_developer/db/migrate/20170831144035_create_feedback_feedbacks.rb +18 -0
- data/lib/nexmo_developer/db/migrate/20170831150024_create_feedback_resources.rb +10 -0
- data/lib/nexmo_developer/db/migrate/20170901093402_sorcery_core.rb +17 -0
- data/lib/nexmo_developer/db/migrate/20170907172926_create_feedback_authors.rb +10 -0
- data/lib/nexmo_developer/db/migrate/20170908112821_create_active_admin_comments.rb +19 -0
- data/lib/nexmo_developer/db/migrate/20170908153555_change_events_start_at_and_end_at_to_date_type.rb +6 -0
- data/lib/nexmo_developer/db/migrate/20170914145346_add_code_language_to_feedback.rb +6 -0
- data/lib/nexmo_developer/db/migrate/20170915081222_correct_uri_of_resources.rb +31 -0
- data/lib/nexmo_developer/db/migrate/20170919151243_add_langugage_set_filters_to_feedbacks.rb +9 -0
- data/lib/nexmo_developer/db/migrate/20170920153649_add_resolved_to_feedback_feedbacks.rb +6 -0
- data/lib/nexmo_developer/db/migrate/20170921120626_drop_users.rb +5 -0
- data/lib/nexmo_developer/db/migrate/20170921121218_devise_create_users.rb +44 -0
- data/lib/nexmo_developer/db/migrate/20171030115603_add_api_key_and_api_secret_to_users.rb +6 -0
- data/lib/nexmo_developer/db/migrate/20180125163023_add_api_secret_to_users.rb +18 -0
- data/lib/nexmo_developer/db/migrate/20180306142355_create_careers.rb +14 -0
- data/lib/nexmo_developer/db/migrate/20180306161650_add_summary_and_icon_to_careers.rb +6 -0
- data/lib/nexmo_developer/db/migrate/20180306184030_create_friendly_id_slugs.rb +15 -0
- data/lib/nexmo_developer/db/migrate/20180306184642_add_slug_to_career.rb +6 -0
- data/lib/nexmo_developer/db/migrate/20180306185340_add_description_short_to_careers.rb +5 -0
- data/lib/nexmo_developer/db/migrate/20180308101927_add_role_group_to_careers.rb +6 -0
- data/lib/nexmo_developer/db/migrate/20180403111850_add_product_to_feedback_resources.rb +41 -0
- data/lib/nexmo_developer/db/migrate/20180404124814_add_published_to_sessions.rb +6 -0
- data/lib/nexmo_developer/db/migrate/20180827133110_usage_building_block_events.rb +16 -0
- data/lib/nexmo_developer/db/migrate/20181006144242_create_redirects.rb +8 -0
- data/lib/nexmo_developer/db/migrate/20190220092207_add_city_country_to_events.rb +6 -0
- data/lib/nexmo_developer/db/migrate/20190306130440_add_latitude_longitude_to_events.rb +6 -0
- data/lib/nexmo_developer/db/migrate/20190415162421_rename_usage_building_block_events.rb +7 -0
- data/lib/nexmo_developer/db/migrate/20190711141227_drop_careers_table.rb +21 -0
- data/lib/nexmo_developer/db/migrate/20190711143408_drop_friendly_id_slugs_table.rb +16 -0
- data/lib/nexmo_developer/db/migrate/20191022100247_add_foreign_key_to_active_storage_for_blob_id.rb +10 -0
- data/lib/nexmo_developer/db/migrate/20200402092734_add_remote_to_events.rb +5 -0
- data/lib/nexmo_developer/db/migrate/20201016102902_create_feedback_config.rb +10 -0
- data/lib/nexmo_developer/db/migrate/20201016110604_add_details_to_feedback_feedback.rb +7 -0
- data/lib/nexmo_developer/db/schema.rb +152 -0
- data/lib/nexmo_developer/db/seeds.rb +70 -0
- data/lib/nexmo_developer/docker-compose.yml +43 -0
- data/lib/nexmo_developer/github_deploy_key.enc +0 -0
- data/lib/nexmo_developer/lib/common_errors.rb +5 -0
- data/lib/nexmo_developer/lib/tasks/.keep +0 -0
- data/lib/nexmo_developer/lib/tasks/cache.rake +6 -0
- data/lib/nexmo_developer/lib/tasks/careers.rake +8 -0
- data/lib/nexmo_developer/lib/tasks/ci.rake +171 -0
- data/lib/nexmo_developer/lib/tasks/diff.rake +40 -0
- data/lib/nexmo_developer/lib/tasks/documentation.rake +18 -0
- data/lib/nexmo_developer/lib/tasks/generate_search_terms.rake +39 -0
- data/lib/nexmo_developer/lib/tasks/links.rake +135 -0
- data/lib/nexmo_developer/lib/tasks/move.rake +58 -0
- data/lib/nexmo_developer/lib/tasks/repos.rake +57 -0
- data/lib/nexmo_developer/lib/tasks/screenshots.rake +11 -0
- data/lib/nexmo_developer/lib/tasks/section.rake +146 -0
- data/lib/nexmo_developer/lib/tasks/smartling.rake +65 -0
- data/lib/nexmo_developer/lib/tasks/test.rake +22 -0
- data/lib/nexmo_developer/nexmo_developer.rb +1 -0
- data/lib/nexmo_developer/public/404.html +67 -0
- data/lib/nexmo_developer/public/422.html +67 -0
- data/lib/nexmo_developer/public/500.html +66 -0
- data/lib/nexmo_developer/public/android-chrome-192x192.png +0 -0
- data/lib/nexmo_developer/public/android-chrome-512x512.png +0 -0
- data/lib/nexmo_developer/public/apple-touch-icon-precomposed.png +0 -0
- data/lib/nexmo_developer/public/apple-touch-icon.png +0 -0
- data/lib/nexmo_developer/public/browserconfig.xml +9 -0
- data/lib/nexmo_developer/public/favicon-16x16.png +0 -0
- data/lib/nexmo_developer/public/favicon-32x32.png +0 -0
- data/lib/nexmo_developer/public/favicon.ico +0 -0
- data/lib/nexmo_developer/public/fonts/Lato-Heavy.woff +0 -0
- data/lib/nexmo_developer/public/fonts/Lato-Heavy.woff2 +0 -0
- data/lib/nexmo_developer/public/fonts/Lato-Regular.woff +0 -0
- data/lib/nexmo_developer/public/fonts/Lato-Regular.woff2 +0 -0
- data/lib/nexmo_developer/public/fonts/Lato-Semibold.woff +0 -0
- data/lib/nexmo_developer/public/fonts/Lato-Semibold.woff2 +0 -0
- data/lib/nexmo_developer/public/manifest.json +17 -0
- data/lib/nexmo_developer/public/mstile-144x144.png +0 -0
- data/lib/nexmo_developer/public/mstile-150x150.png +0 -0
- data/lib/nexmo_developer/public/nexmo-developer-logo.svg +25 -0
- data/lib/nexmo_developer/public/nexmo-vonage-white.svg +79 -0
- data/lib/nexmo_developer/public/packs-test/css/application-5047da33.chunk.css +14950 -0
- data/lib/nexmo_developer/public/packs-test/css/application-5047da33.chunk.css.map +1 -0
- data/lib/nexmo_developer/public/packs-test/css/application-a5fa0fdb.chunk.css +15085 -0
- data/lib/nexmo_developer/public/packs-test/css/application-a5fa0fdb.chunk.css.map +1 -0
- data/lib/nexmo_developer/public/packs-test/css/application-f92656e6.chunk.css +13 -0
- data/lib/nexmo_developer/public/packs-test/css/application-f92656e6.chunk.css.map +1 -0
- data/lib/nexmo_developer/public/packs-test/css/application-f9d1bdbc.chunk.css +13 -0
- data/lib/nexmo_developer/public/packs-test/css/application-f9d1bdbc.chunk.css.map +1 -0
- data/lib/nexmo_developer/public/packs-test/js/0-e58f598fb97314a89835.chunk.js +59763 -0
- data/lib/nexmo_developer/public/packs-test/js/0-e58f598fb97314a89835.chunk.js.map +1 -0
- data/lib/nexmo_developer/public/packs-test/js/application-21483bf220c794127fa9.chunk.js +6405 -0
- data/lib/nexmo_developer/public/packs-test/js/application-21483bf220c794127fa9.chunk.js.map +1 -0
- data/lib/nexmo_developer/public/packs-test/js/application-6e53f67bc3230c42f9dd.chunk.js +7839 -0
- data/lib/nexmo_developer/public/packs-test/js/application-6e53f67bc3230c42f9dd.chunk.js.map +1 -0
- data/lib/nexmo_developer/public/packs-test/js/application-76d5a80c3775a7e2327a.chunk.js +6405 -0
- data/lib/nexmo_developer/public/packs-test/js/application-76d5a80c3775a7e2327a.chunk.js.map +1 -0
- data/lib/nexmo_developer/public/packs-test/js/application-c6f3e7a9d98562f76890.chunk.js +6619 -0
- data/lib/nexmo_developer/public/packs-test/js/application-c6f3e7a9d98562f76890.chunk.js.map +1 -0
- data/lib/nexmo_developer/public/packs-test/js/application-d280e78dd4f9d3d9b466.chunk.js +6405 -0
- data/lib/nexmo_developer/public/packs-test/js/application-d280e78dd4f9d3d9b466.chunk.js.map +1 -0
- data/lib/nexmo_developer/public/packs-test/js/runtime~application-1c11a8c601900ade80b6.js +155 -0
- data/lib/nexmo_developer/public/packs-test/js/runtime~application-1c11a8c601900ade80b6.js.map +1 -0
- data/lib/nexmo_developer/public/packs-test/js/vendors~application-6518249ed8d7aa985a8b.chunk.js +61849 -0
- data/lib/nexmo_developer/public/packs-test/js/vendors~application-6518249ed8d7aa985a8b.chunk.js.map +1 -0
- data/lib/nexmo_developer/public/packs-test/js/vendors~application-bc967911d70f3f4a5151.chunk.js +59077 -0
- data/lib/nexmo_developer/public/packs-test/js/vendors~application-bc967911d70f3f4a5151.chunk.js.map +1 -0
- data/lib/nexmo_developer/public/packs-test/js/vendors~application-d2bde7a8e622fafdeb1d.chunk.js +61843 -0
- data/lib/nexmo_developer/public/packs-test/js/vendors~application-d2bde7a8e622fafdeb1d.chunk.js.map +1 -0
- data/lib/nexmo_developer/public/packs-test/js/vendors~application-eb13e7814c54bf76b364.chunk.js +62431 -0
- data/lib/nexmo_developer/public/packs-test/js/vendors~application-eb13e7814c54bf76b364.chunk.js.map +1 -0
- data/lib/nexmo_developer/public/packs-test/manifest.json +85 -0
- data/lib/nexmo_developer/public/safari-pinned-tab.svg +1 -0
- data/lib/nexmo_developer/public/symbol/volta-brand-icons.svg +1 -0
- data/lib/nexmo_developer/public/symbol/volta-icons.svg +1 -0
- data/lib/nexmo_developer/vendor/assets/javascripts/.keep +0 -0
- data/lib/nexmo_developer/vendor/assets/javascripts/jquery-scrolltofixed.js +567 -0
- data/lib/nexmo_developer/vendor/assets/javascripts/mermaid.js +49 -0
- data/lib/nexmo_developer/vendor/assets/javascripts/underscore.js +5 -0
- data/lib/nexmo_developer/vendor/assets/javascripts/volta/addons/jquery.tablesorter.js +1031 -0
- data/lib/nexmo_developer/vendor/assets/javascripts/volta/addons/prism.js +22 -0
- data/lib/nexmo_developer/vendor/assets/javascripts/volta/components/side-navigation/volta.menu.js +377 -0
- data/lib/nexmo_developer/vendor/assets/javascripts/volta/components/volta.accordion.js +249 -0
- data/lib/nexmo_developer/vendor/assets/javascripts/volta/components/volta.dropdown.js +145 -0
- data/lib/nexmo_developer/vendor/assets/javascripts/volta/components/volta.flash.js +175 -0
- data/lib/nexmo_developer/vendor/assets/javascripts/volta/components/volta.modal.js +312 -0
- data/lib/nexmo_developer/vendor/assets/javascripts/volta/components/volta.tab.js +203 -0
- data/lib/nexmo_developer/vendor/assets/javascripts/volta/components/volta.tooltip.js +71 -0
- data/lib/nexmo_developer/vendor/assets/javascripts/volta/popper.min.js +5 -0
- data/lib/nexmo_developer/vendor/assets/javascripts/volta/svgxuse.min.js +12 -0
- data/lib/nexmo_developer/vendor/assets/javascripts/volta/tooltip.min.js +5 -0
- data/lib/nexmo_developer/vendor/assets/javascripts/volta/volta.core.js +238 -0
- data/lib/nexmo_developer/vendor/assets/javascripts/volta/volta.js +2141 -0
- data/lib/nexmo_developer/vendor/assets/javascripts/volta/volta.min.js +1 -0
- data/lib/nexmo_developer/vendor/assets/stylesheets/.keep +0 -0
- data/lib/nexmo_developer/version.rb +3 -0
- data/package.json +124 -0
- data/station.gemspec +94 -42
- data/yarn.lock +13943 -0
- metadata +1888 -55
- data/.document +0 -5
- data/Rakefile +0 -61
- data/VERSION +0 -1
- data/lib/station.rb +0 -3
@@ -0,0 +1,12 @@
|
|
1
|
+
import Volta from "../volta/volta.js"
|
2
|
+
|
3
|
+
export default () => {
|
4
|
+
$(document).ready(function() {
|
5
|
+
$(document).on('ajax:success', '#spotlight-form', function(event, response) {
|
6
|
+
Volta.flash.show('success');
|
7
|
+
event.target.reset();
|
8
|
+
}).on('ajax:error', '#spotlight-form', function(event) {
|
9
|
+
Volta.flash.show('error');
|
10
|
+
});
|
11
|
+
});
|
12
|
+
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (C) Federico Zivolo 2018
|
3
|
+
Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT).
|
4
|
+
*/(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?module.exports=b(require('popper.js')):'function'==typeof define&&define.amd?define(['popper.js'],b):a.Tooltip=b(a.Popper)})(this,function(a){'use strict';function b(a){return a&&'[object Function]'==={}.toString.call(a)}a=a&&a.hasOwnProperty('default')?a['default']:a;var c=function(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')},d=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),e=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},f={container:!1,delay:0,html:!1,placement:'top',title:'',template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:'hover focus',offset:0},g=function(){function g(a,b){c(this,g),h.call(this),b=e({},f,b),a.jquery&&(a=a[0]),this.reference=a,this.options=b;var d='string'==typeof b.trigger?b.trigger.split(' ').filter(function(a){return-1!==['click','hover','focus'].indexOf(a)}):[];this._isOpen=!1,this._popperOptions={},this._setEventListeners(a,d,b)}return d(g,[{key:'_create',value:function(a,b,c,d){var e=window.document.createElement('div');e.innerHTML=b.trim();var f=e.childNodes[0];f.id='tooltip_'+Math.random().toString(36).substr(2,10),f.setAttribute('aria-hidden','false');var g=e.querySelector(this.innerSelector);return this._addTitleContent(a,c,d,g),f}},{key:'_addTitleContent',value:function(a,c,d,e){if(1===c.nodeType||11===c.nodeType)d&&e.appendChild(c);else if(b(c)){var f=c.call(a);d?e.innerHTML=f:e.textContent=f}else d?e.innerHTML=c:e.textContent=c}},{key:'_show',value:function(b,c){if(this._isOpen&&!this._isOpening)return this;if(this._isOpen=!0,this._tooltipNode)return this._tooltipNode.style.display='',this._tooltipNode.setAttribute('aria-hidden','false'),this.popperInstance.update(),this;var d=b.getAttribute('title')||c.title;if(!d)return this;var f=this._create(b,c.template,d,c.html);b.setAttribute('aria-describedby',f.id);var g=this._findContainer(c.container,b);return this._append(f,g),this._popperOptions=e({},c.popperOptions,{placement:c.placement}),this._popperOptions.modifiers=e({},this._popperOptions.modifiers,{arrow:{element:this.arrowSelector},offset:{offset:c.offset}}),c.boundariesElement&&(this._popperOptions.modifiers.preventOverflow={boundariesElement:c.boundariesElement}),this.popperInstance=new a(b,f,this._popperOptions),this._tooltipNode=f,this}},{key:'_hide',value:function(){return this._isOpen?(this._isOpen=!1,this._tooltipNode.style.display='none',this._tooltipNode.setAttribute('aria-hidden','true'),this):this}},{key:'_dispose',value:function(){var a=this;return this._events.forEach(function(b){var c=b.func,d=b.event;a.reference.removeEventListener(d,c)}),this._events=[],this._tooltipNode&&(this._hide(),this.popperInstance.destroy(),!this.popperInstance.options.removeOnDestroy&&(this._tooltipNode.parentNode.removeChild(this._tooltipNode),this._tooltipNode=null)),this}},{key:'_findContainer',value:function(a,b){return'string'==typeof a?a=window.document.querySelector(a):!1===a&&(a=b.parentNode),a}},{key:'_append',value:function(a,b){b.appendChild(a)}},{key:'_setEventListeners',value:function(a,b,c){var d=this,e=[],f=[];b.forEach(function(a){'hover'===a?(e.push('mouseenter'),f.push('mouseleave')):'focus'===a?(e.push('focus'),f.push('blur')):'click'===a?(e.push('click'),f.push('click')):void 0}),e.forEach(function(b){var e=function(b){!0===d._isOpening||(b.usedByTooltip=!0,d._scheduleShow(a,c.delay,c,b))};d._events.push({event:b,func:e}),a.addEventListener(b,e)}),f.forEach(function(b){var e=function(b){!0===b.usedByTooltip||d._scheduleHide(a,c.delay,c,b)};d._events.push({event:b,func:e}),a.addEventListener(b,e)})}},{key:'_scheduleShow',value:function(a,b,c){var d=this;this._isOpening=!0;var e=b&&b.show||b||0;this._showTimeout=window.setTimeout(function(){return d._show(a,c)},e)}},{key:'_scheduleHide',value:function(a,b,c,d){var e=this;this._isOpening=!1;var f=b&&b.hide||b||0;window.setTimeout(function(){if((window.clearTimeout(e._showTimeout),!1!==e._isOpen)&&document.body.contains(e._tooltipNode)){if('mouseleave'===d.type){var f=e._setTooltipNodeEvent(d,a,b,c);if(f)return}e._hide(a,c)}},f)}},{key:'_updateTitleContent',value:function(a){if('undefined'==typeof this._tooltipNode)return void('undefined'!=typeof this.options.title&&(this.options.title=a));var b=this._tooltipNode.parentNode.querySelector(this.innerSelector);this._clearTitleContent(b,this.options.html,this.reference.getAttribute('title')||this.options.title),this._addTitleContent(this.reference,a,this.options.html,b),this.options.title=a,this.popperInstance.update()}},{key:'_clearTitleContent',value:function(a,b,c){1===c.nodeType||11===c.nodeType?b&&a.removeChild(c):b?a.innerHTML='':a.textContent=''}}]),g}(),h=function(){var a=this;this.show=function(){return a._show(a.reference,a.options)},this.hide=function(){return a._hide()},this.dispose=function(){return a._dispose()},this.toggle=function(){return a._isOpen?a.hide():a.show()},this.updateTitleContent=function(b){return a._updateTitleContent(b)},this.arrowSelector='.tooltip-arrow, .tooltip__arrow',this.innerSelector='.tooltip-inner, .tooltip__inner',this._events=[],this._setTooltipNodeEvent=function(b,c,d,e){var f=b.relatedreference||b.toElement||b.relatedTarget;return!!a._tooltipNode.contains(f)&&(a._tooltipNode.addEventListener(b.type,function d(f){var g=f.relatedreference||f.toElement||f.relatedTarget;a._tooltipNode.removeEventListener(b.type,d),c.contains(g)||a._scheduleHide(c,e.delay,e,f)}),!0)}};return g});
|
5
|
+
//# sourceMappingURL=tooltip.min.js.map
|
@@ -0,0 +1,2145 @@
|
|
1
|
+
import Tooltip from './tooltip.min.js';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Copyright (c) 2001-present, Vonage.
|
5
|
+
*
|
6
|
+
* Core of volta
|
7
|
+
*/
|
8
|
+
'use strict';
|
9
|
+
var Volta;
|
10
|
+
|
11
|
+
Volta = function (){
|
12
|
+
return {
|
13
|
+
_closest: closest,
|
14
|
+
_hasClass: hasClass,
|
15
|
+
init: initialise,
|
16
|
+
_isMobile: isMobileDevice,
|
17
|
+
_getElementSiblings: getElementSiblings,
|
18
|
+
_getFunction: getFunctionFromString,
|
19
|
+
_removeFromArr: removeFromArr
|
20
|
+
}
|
21
|
+
|
22
|
+
/**
|
23
|
+
* @private
|
24
|
+
*
|
25
|
+
* @description Finds the first ancestor of the given element, matching a specific selector.
|
26
|
+
* @param {HTMLElement} element Starting element
|
27
|
+
* @param {string} selector Selector to find (can be .class, #id, div...)
|
28
|
+
* @param {string} stopSelector Selector to stop searching on (can be .class, #id, div...)
|
29
|
+
* @returns {HTMLElement|null} The matched element or null if no element is found
|
30
|
+
*/
|
31
|
+
function closest(element, selector, stopSelector) {
|
32
|
+
var match = null;
|
33
|
+
while (element) {
|
34
|
+
if (element.matches(selector)) {
|
35
|
+
match = element;
|
36
|
+
break
|
37
|
+
} else if (stopSelector && element.matches(stopSelector)) {
|
38
|
+
break
|
39
|
+
}
|
40
|
+
element = element.parentElement;
|
41
|
+
}
|
42
|
+
return match;
|
43
|
+
}
|
44
|
+
|
45
|
+
/**
|
46
|
+
* @private
|
47
|
+
* @description Given the name of a function returns the function itself
|
48
|
+
* @param {string} callbackFnName The function name e.g. "testFunction" OR "test.function"
|
49
|
+
* @returns {Function}
|
50
|
+
*/
|
51
|
+
function getFunctionFromString(fnName) {
|
52
|
+
var fn;
|
53
|
+
|
54
|
+
if(fnName) {
|
55
|
+
var fnNames = fnName.split(".");
|
56
|
+
var fn = window;
|
57
|
+
for(var i = 0; i < fnNames.length; i++) {
|
58
|
+
fn = fn[fnNames[i]];
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
return fn;
|
63
|
+
}
|
64
|
+
|
65
|
+
/**
|
66
|
+
* @private
|
67
|
+
* @description Get all siblings of an element
|
68
|
+
* @param {HTMLElement} el
|
69
|
+
*/
|
70
|
+
function getElementSiblings(element) {
|
71
|
+
var siblings = [];
|
72
|
+
element = element.parentNode.firstChild;
|
73
|
+
do {
|
74
|
+
if(element.nodeType === 1) {
|
75
|
+
siblings.push(element);
|
76
|
+
}
|
77
|
+
} while (element = element.nextSibling);
|
78
|
+
return siblings;
|
79
|
+
}
|
80
|
+
|
81
|
+
/**
|
82
|
+
* @private
|
83
|
+
*
|
84
|
+
* @description Check if the given element has a particular class
|
85
|
+
* @param {HTMLElement} el Element to evaluate
|
86
|
+
* @param {string} className Class name to check for
|
87
|
+
* @returns {boolean} True if the element has the class or false if not
|
88
|
+
*/
|
89
|
+
function hasClass(element, className) {
|
90
|
+
if(!element) {
|
91
|
+
return false;
|
92
|
+
}
|
93
|
+
return (" " + element.className + " ").replace(/[\n\t]/g, " ").indexOf(" " + className+ " ") > -1;
|
94
|
+
}
|
95
|
+
|
96
|
+
/**
|
97
|
+
* @private
|
98
|
+
*
|
99
|
+
* @description Is the current device a mobile
|
100
|
+
* @returns {boolean} True if mobile false if not
|
101
|
+
*/
|
102
|
+
function isMobileDevice() {
|
103
|
+
var isMobile = /Android|webOS|iPhone|iPad|BlackBerry|Windows Phone|Opera Mini|IEMobile|Mobile/i;
|
104
|
+
|
105
|
+
return isMobile.test(navigator.userAgent);
|
106
|
+
}
|
107
|
+
|
108
|
+
/**
|
109
|
+
* @public
|
110
|
+
*
|
111
|
+
* @description Initailise volta with required components
|
112
|
+
* @param {Array} components Array of strings, names of the components to initialise
|
113
|
+
*/
|
114
|
+
function initialise(components) {
|
115
|
+
polyfilsForIE11();
|
116
|
+
|
117
|
+
if(components.indexOf('accordion') !== -1){
|
118
|
+
if(Volta.accordion) {
|
119
|
+
Volta.accordion.init();
|
120
|
+
} else {
|
121
|
+
console.warn('Volta: volta.accordion.js component missing')
|
122
|
+
}
|
123
|
+
}
|
124
|
+
if(components.indexOf('callout') !== -1){
|
125
|
+
if(Volta.callout) {
|
126
|
+
Volta.callout.init();
|
127
|
+
} else {
|
128
|
+
console.warn('Volta: volta.callout.js component missing')
|
129
|
+
}
|
130
|
+
}
|
131
|
+
if(components.indexOf('badge') !== -1){
|
132
|
+
if(Volta.badge) {
|
133
|
+
Volta.badge.init();
|
134
|
+
} else {
|
135
|
+
console.warn('Volta: volta.badge.js component missing')
|
136
|
+
}
|
137
|
+
}
|
138
|
+
if(components.indexOf('dropdown') !== -1){
|
139
|
+
if(Volta.dropdown) {
|
140
|
+
Volta.dropdown.init();
|
141
|
+
} else {
|
142
|
+
console.warn('Volta: volta.dropdown.js component missing')
|
143
|
+
}
|
144
|
+
}
|
145
|
+
if(components.indexOf('flash') !== -1){
|
146
|
+
if(Volta.flash) {
|
147
|
+
Volta.flash.init();
|
148
|
+
} else {
|
149
|
+
console.warn('Volta: volta.dropdown.js component missing')
|
150
|
+
}
|
151
|
+
}
|
152
|
+
if(components.indexOf('menu') !== -1){
|
153
|
+
if(Volta.menu) {
|
154
|
+
Volta.menu.init();
|
155
|
+
} else {
|
156
|
+
console.warn('Volta: volta.menu.js component missing')
|
157
|
+
}
|
158
|
+
}
|
159
|
+
if(components.indexOf('menuCollapse') !== -1){
|
160
|
+
if(Volta.menuCollapse) {
|
161
|
+
Volta.menuCollapse.init();
|
162
|
+
} else {
|
163
|
+
console.warn('Volta: volta.menuCollapse.js component missing')
|
164
|
+
}
|
165
|
+
}
|
166
|
+
if(components.indexOf('modal') !== -1){
|
167
|
+
if(Volta.modal) {
|
168
|
+
Volta.modal.init();
|
169
|
+
} else {
|
170
|
+
console.warn('Volta: volta.modal.js component missing')
|
171
|
+
}
|
172
|
+
}
|
173
|
+
if(components.indexOf('tab') !== -1){
|
174
|
+
if(Volta.tab) {
|
175
|
+
Volta.tab.init();
|
176
|
+
} else {
|
177
|
+
console.warn('Volta: volta.tab.js component missing')
|
178
|
+
}
|
179
|
+
}
|
180
|
+
if(components.indexOf('table') !== -1){
|
181
|
+
if(Volta.table) {
|
182
|
+
Volta.table.init();
|
183
|
+
} else {
|
184
|
+
console.warn('Volta: volta.table.js component missing')
|
185
|
+
}
|
186
|
+
}
|
187
|
+
if(components.indexOf('tooltip') !== -1){
|
188
|
+
if(Volta.tooltip) {
|
189
|
+
Volta.tooltip.init();
|
190
|
+
} else {
|
191
|
+
console.warn('Volta: volta.tooltip.js component missing')
|
192
|
+
}
|
193
|
+
}
|
194
|
+
}
|
195
|
+
|
196
|
+
/**
|
197
|
+
* @private
|
198
|
+
*
|
199
|
+
* @description Remove an element from an array
|
200
|
+
* @param {Array} arr The array containing the element
|
201
|
+
* @param {Element} element The element to remove
|
202
|
+
* @returns {Array} The array minus the element
|
203
|
+
*/
|
204
|
+
function removeFromArr(arr, element) {
|
205
|
+
var index = arr.indexOf(element);
|
206
|
+
arr.splice(index, 1);
|
207
|
+
return arr;
|
208
|
+
}
|
209
|
+
|
210
|
+
/**
|
211
|
+
* @private
|
212
|
+
*
|
213
|
+
*/
|
214
|
+
function polyfilsForIE11() {
|
215
|
+
if (window.NodeList && !NodeList.prototype.forEach) {
|
216
|
+
NodeList.prototype.forEach = function (callback, thisArg) {
|
217
|
+
thisArg = thisArg || window;
|
218
|
+
for (var i = 0; i < this.length; i++) {
|
219
|
+
callback.call(thisArg, this[i], i, this);
|
220
|
+
}
|
221
|
+
};
|
222
|
+
}
|
223
|
+
|
224
|
+
if (!Element.prototype.matches) {
|
225
|
+
Element.prototype.matches =
|
226
|
+
Element.prototype.matchesSelector ||
|
227
|
+
Element.prototype.mozMatchesSelector ||
|
228
|
+
Element.prototype.msMatchesSelector ||
|
229
|
+
Element.prototype.oMatchesSelector ||
|
230
|
+
Element.prototype.webkitMatchesSelector ||
|
231
|
+
function(s) {
|
232
|
+
var matches = (this.document || this.ownerDocument).querySelectorAll(s),
|
233
|
+
i = matches.length;
|
234
|
+
while (--i >= 0 && matches.item(i) !== this) {}
|
235
|
+
return i > -1;
|
236
|
+
};
|
237
|
+
}
|
238
|
+
}
|
239
|
+
}();
|
240
|
+
|
241
|
+
/**
|
242
|
+
* Copyright (c) 2001-present, Vonage.
|
243
|
+
*
|
244
|
+
* Accordions (requires core)
|
245
|
+
*/
|
246
|
+
|
247
|
+
'use strict';
|
248
|
+
|
249
|
+
Volta.accordion = function () {
|
250
|
+
var _class = {
|
251
|
+
standard: {
|
252
|
+
container: 'Vlt-accordion',
|
253
|
+
containerGroup: 'Vlt-accordion--group',
|
254
|
+
trigger: 'Vlt-accordion__trigger',
|
255
|
+
triggerActive: 'Vlt-accordion__trigger_active',
|
256
|
+
content: 'Vlt-accordion__content',
|
257
|
+
contentOpen: 'Vlt-accordion__content_open',
|
258
|
+
contentOpening: 'Vlt-accordion__content_opening',
|
259
|
+
contentClosing: 'Vlt-accordion__content_closing',
|
260
|
+
},
|
261
|
+
js: {
|
262
|
+
content: 'Vlt-js-accordion__content',
|
263
|
+
contentOpen: 'Vlt-js-accordion__content_open',
|
264
|
+
contentOpening: 'Vlt-js-accordion__content_opening',
|
265
|
+
contentClosing: 'Vlt-js-accordion__content_closing',
|
266
|
+
trigger: 'Vlt-js-accordion__trigger',
|
267
|
+
triggerActive: 'Vlt-js-accordion__trigger_active'
|
268
|
+
}
|
269
|
+
}
|
270
|
+
|
271
|
+
function Accordion() {}
|
272
|
+
|
273
|
+
Accordion.prototype = {
|
274
|
+
init: function(element, suppressClickHandler, triggerElem) {
|
275
|
+
if(this.isStandard) {
|
276
|
+
this._initStandard(element, suppressClickHandler);
|
277
|
+
} else {
|
278
|
+
this._initJs(element, suppressClickHandler, triggerElem);
|
279
|
+
}
|
280
|
+
},
|
281
|
+
_initStandard: function(element, suppressClickHandler) {
|
282
|
+
var self = this;
|
283
|
+
|
284
|
+
if(!suppressClickHandler) {
|
285
|
+
element.querySelectorAll('.' + _class.standard.trigger).forEach(function(trigger) {
|
286
|
+
var parent = Volta._closest(trigger, '.' + _class.standard.container, _class.standard.container);
|
287
|
+
|
288
|
+
if(parent && parent == element) {
|
289
|
+
trigger.addEventListener('click', function(){
|
290
|
+
self.toggle(trigger);
|
291
|
+
});
|
292
|
+
}
|
293
|
+
});
|
294
|
+
}
|
295
|
+
},
|
296
|
+
_initJs: function(element, suppressClickHandler, triggerElem) {
|
297
|
+
this._content = element;
|
298
|
+
|
299
|
+
if(triggerElem) {
|
300
|
+
this.trigger = triggerElem;
|
301
|
+
} else if(this._content.dataset.trigger) {
|
302
|
+
var triggerId = this._content.dataset.trigger;
|
303
|
+
this.trigger = document.querySelector('#' + triggerId);
|
304
|
+
} else {
|
305
|
+
console.warn("Volta: js accordion trigger missing");
|
306
|
+
}
|
307
|
+
|
308
|
+
var self = this;
|
309
|
+
if(!suppressClickHandler && this.trigger) {
|
310
|
+
this.trigger.addEventListener('click', function(){
|
311
|
+
self.toggle();
|
312
|
+
});
|
313
|
+
}
|
314
|
+
},
|
315
|
+
close: function(trigger) {
|
316
|
+
var panel = this._content || trigger.nextElementSibling;
|
317
|
+
var trigger = this.trigger || trigger;
|
318
|
+
var classes = this.trigger ? _class.js : _class.standard;
|
319
|
+
|
320
|
+
trigger.classList.remove(classes.triggerActive);
|
321
|
+
panel.classList.add(classes.contentClosing);
|
322
|
+
|
323
|
+
panel.style.height = window.getComputedStyle(panel).height;
|
324
|
+
panel.offsetHeight; // force repaint
|
325
|
+
panel.style.height = '0px';
|
326
|
+
panel.classList.remove(classes.contentOpen);
|
327
|
+
|
328
|
+
var self = this;
|
329
|
+
panel.addEventListener('transitionend', function closingTransitionEndEvent(event) {
|
330
|
+
if (event.propertyName == 'height' && Volta._hasClass(panel, classes.contentClosing)) {
|
331
|
+
panel.classList.remove(classes.contentClosing);
|
332
|
+
panel.style.height = '0px';
|
333
|
+
panel.removeEventListener('transitionend', closingTransitionEndEvent, false);
|
334
|
+
|
335
|
+
if(self.isGroup && self._isTriggerActive(trigger, true)){
|
336
|
+
self._activeGroupTrigger = undefined;
|
337
|
+
}
|
338
|
+
}
|
339
|
+
}, { passive: true, once: true });
|
340
|
+
},
|
341
|
+
isOpening: false,
|
342
|
+
_activeGroupTrigger: undefined,
|
343
|
+
_isTriggerActive: function(trigger, match) {
|
344
|
+
return (this.isGroup && this._activeGroupTrigger && (!match || this._activeGroupTrigger === trigger)) || Volta._hasClass(trigger, _class.standard.triggerActive);
|
345
|
+
},
|
346
|
+
open: function(trigger) {
|
347
|
+
if(!this.trigger) {
|
348
|
+
if(this._isTriggerActive(trigger, false)) {
|
349
|
+
this.close(this._activeGroupTrigger || trigger);
|
350
|
+
}
|
351
|
+
if(this.isGroup) {
|
352
|
+
this._activeGroupTrigger = trigger;
|
353
|
+
}
|
354
|
+
}
|
355
|
+
|
356
|
+
var trig = this.trigger || trigger;
|
357
|
+
var classes = this.trigger ? _class.js : _class.standard;
|
358
|
+
var panel = this._content || trig.nextElementSibling;
|
359
|
+
|
360
|
+
this.isOpening = true;
|
361
|
+
|
362
|
+
trig.classList.add(classes.triggerActive);
|
363
|
+
panel.classList.add(classes.contentOpening);
|
364
|
+
|
365
|
+
var startHeight = panel.style.height;
|
366
|
+
panel.style.height = 'auto';
|
367
|
+
var endHeight = window.getComputedStyle(panel).height;
|
368
|
+
panel.style.height = startHeight;
|
369
|
+
panel.offsetHeight; // force repaint
|
370
|
+
panel.style.height = endHeight;
|
371
|
+
|
372
|
+
var self = this;
|
373
|
+
panel.addEventListener('transitionend', function openingTransitionEndEvent(event) {
|
374
|
+
if (event.propertyName == 'height' && Volta._hasClass(panel, classes.contentOpening)) {
|
375
|
+
panel.style.height = 'auto';
|
376
|
+
panel.classList.remove(classes.contentOpening);
|
377
|
+
panel.classList.add(classes.contentOpen);
|
378
|
+
panel.removeEventListener('transitionend', openingTransitionEndEvent, false);
|
379
|
+
self.isOpening = false;
|
380
|
+
}
|
381
|
+
}, { passive: true, once: true });
|
382
|
+
},
|
383
|
+
toggle: function(trigger) {
|
384
|
+
if(this.isOpening) {
|
385
|
+
return false;
|
386
|
+
}
|
387
|
+
if((this.trigger && Volta._hasClass(this._content, _class.js.contentOpen))
|
388
|
+
|| (!this.trigger && this._isTriggerActive(trigger, true))) {
|
389
|
+
this.close(trigger);
|
390
|
+
} else {
|
391
|
+
this.open(trigger);
|
392
|
+
}
|
393
|
+
}
|
394
|
+
}
|
395
|
+
|
396
|
+
return {
|
397
|
+
create: create,
|
398
|
+
init: initialise
|
399
|
+
}
|
400
|
+
|
401
|
+
/**
|
402
|
+
* @public
|
403
|
+
*
|
404
|
+
* @description Create an individual accordion object
|
405
|
+
* @param {Element|string} elementOrId Reference to the accordion content element or the id
|
406
|
+
* @param {Boolean} suppressClickHandler Whether click events should be attached on creation
|
407
|
+
* @param {Element} trigger Private required for legacy accordions
|
408
|
+
* @param {Boolean} isGroup Private required for legacy accordions
|
409
|
+
* @return {Object}
|
410
|
+
*/
|
411
|
+
function create(elementOrId, suppressClickHandler, trigger, isGroup, isStandard) {
|
412
|
+
if(!elementOrId) {
|
413
|
+
console.warn("Volta: no parameter supplied to accordion.create()");
|
414
|
+
}
|
415
|
+
var accordion = Object.create(Accordion.prototype, {});
|
416
|
+
var element = getElement(elementOrId);
|
417
|
+
|
418
|
+
Object.defineProperties(accordion, {
|
419
|
+
'isStandard': {
|
420
|
+
value: isStandard || Volta._hasClass(element, _class.standard.container),
|
421
|
+
writable: false
|
422
|
+
}
|
423
|
+
});
|
424
|
+
|
425
|
+
Object.defineProperties(accordion, {
|
426
|
+
'isGroup': {
|
427
|
+
value: isGroup,
|
428
|
+
writable: false
|
429
|
+
}
|
430
|
+
});
|
431
|
+
|
432
|
+
accordion.init(element, suppressClickHandler, trigger);
|
433
|
+
|
434
|
+
return accordion;
|
435
|
+
}
|
436
|
+
|
437
|
+
/**
|
438
|
+
* @public
|
439
|
+
*
|
440
|
+
* @description Initialise all the accordions on the current screen
|
441
|
+
*/
|
442
|
+
function initialise() {
|
443
|
+
//standard
|
444
|
+
var standardAccordions = document.querySelectorAll('.' + _class.standard.container);
|
445
|
+
|
446
|
+
if(standardAccordions.length) {
|
447
|
+
standardAccordions.forEach(function(accordion){
|
448
|
+
create(accordion, false, null, Volta._hasClass(accordion, _class.standard.containerGroup), true);
|
449
|
+
});
|
450
|
+
}
|
451
|
+
|
452
|
+
//js
|
453
|
+
var triggers = document.querySelectorAll('.' + _class.js.trigger + '[data-accordion]');
|
454
|
+
if(triggers.length > 0) {
|
455
|
+
triggers.forEach(function(trigger) {
|
456
|
+
var accordionId = trigger.dataset.accordion;
|
457
|
+
if(!accordionId) {
|
458
|
+
return;
|
459
|
+
}
|
460
|
+
create(accordionId, false, trigger);
|
461
|
+
});
|
462
|
+
}
|
463
|
+
|
464
|
+
//js - legacy
|
465
|
+
var jsAccordions = document.querySelectorAll('.' + _class.js.content + '[data-trigger]');
|
466
|
+
if(jsAccordions.length > 0) {
|
467
|
+
jsAccordions.forEach(function(jsLegacy) {
|
468
|
+
create(jsLegacy);
|
469
|
+
});
|
470
|
+
}
|
471
|
+
}
|
472
|
+
|
473
|
+
/**
|
474
|
+
* @private
|
475
|
+
*/
|
476
|
+
function getElement(elementOrId) {
|
477
|
+
var element;
|
478
|
+
|
479
|
+
if(elementOrId.classList) {
|
480
|
+
element = elementOrId;
|
481
|
+
} else if (elementOrId.substring(0, 1) === "#") {
|
482
|
+
element = document.querySelector(elementOrId);
|
483
|
+
} else {
|
484
|
+
element = document.querySelector('#' + elementOrId);
|
485
|
+
}
|
486
|
+
|
487
|
+
return element;
|
488
|
+
}
|
489
|
+
}();
|
490
|
+
|
491
|
+
/**
|
492
|
+
* Copyright (c) 2001-present, Vonage.
|
493
|
+
*
|
494
|
+
* Badges (requires core)
|
495
|
+
*/
|
496
|
+
|
497
|
+
'use strict';
|
498
|
+
|
499
|
+
Volta.badge = function () {
|
500
|
+
var _class = {
|
501
|
+
badge: 'Vlt-badge',
|
502
|
+
dismiss: 'Vlt-badge__dismiss',
|
503
|
+
dismissed: 'Vlt-badge--dismissed'
|
504
|
+
}
|
505
|
+
|
506
|
+
return {
|
507
|
+
dismiss: dismiss,
|
508
|
+
init: attachBadgeHandlers
|
509
|
+
}
|
510
|
+
|
511
|
+
/**
|
512
|
+
* @public
|
513
|
+
*
|
514
|
+
* @description Attach a one time listener to dismissable badges
|
515
|
+
*/
|
516
|
+
function attachBadgeHandlers() {
|
517
|
+
document.querySelectorAll('.' + _class.dismiss).forEach(create);
|
518
|
+
}
|
519
|
+
|
520
|
+
/**
|
521
|
+
* @private
|
522
|
+
*
|
523
|
+
* @description Create a badge
|
524
|
+
* @param {HTMLElement} badge
|
525
|
+
*/
|
526
|
+
function create(badgeOrDismiss) {
|
527
|
+
var badge, badgeDismiss;
|
528
|
+
|
529
|
+
if(Volta._hasClass(badgeOrDismiss, _class.badge)) {
|
530
|
+
badge = badgeOrDismiss;
|
531
|
+
badgeDismiss = badge.querySelector('.' + _class.dismiss);
|
532
|
+
} else if(Volta._hasClass(badgeOrDismiss, _class.dismiss)){
|
533
|
+
badgeDismiss = badgeOrDismiss;
|
534
|
+
badge = badgeDismiss.parentElement;
|
535
|
+
}
|
536
|
+
|
537
|
+
badgeDismiss.addEventListener('click', function(){
|
538
|
+
dismiss(badge);
|
539
|
+
}, { once : true});
|
540
|
+
}
|
541
|
+
|
542
|
+
/**
|
543
|
+
* @public
|
544
|
+
*
|
545
|
+
* @description Dismiss a badge
|
546
|
+
* @param {HTMLElement} badge
|
547
|
+
*/
|
548
|
+
function dismiss(badge) {
|
549
|
+
badge.classList.add(_class.dismissed);
|
550
|
+
|
551
|
+
if(badge.dataset.callback) {
|
552
|
+
return Volta._getFunction(badgeWrapper.dataset.callback)();
|
553
|
+
}
|
554
|
+
}
|
555
|
+
}();
|
556
|
+
/**
|
557
|
+
* Copyright (c) 2001-present, Vonage.
|
558
|
+
*
|
559
|
+
* Callouts (requires core)
|
560
|
+
*/
|
561
|
+
|
562
|
+
'use strict';
|
563
|
+
|
564
|
+
Volta.callout = function () {
|
565
|
+
var _class = {
|
566
|
+
callout: 'Vlt-callout',
|
567
|
+
dismiss: 'Vlt-callout__dismiss',
|
568
|
+
dismissed: 'Vlt-callout--dismissed'
|
569
|
+
}
|
570
|
+
|
571
|
+
return {
|
572
|
+
dismiss: dismiss,
|
573
|
+
init: attachCalloutHandlers
|
574
|
+
}
|
575
|
+
|
576
|
+
/**
|
577
|
+
* @public
|
578
|
+
*
|
579
|
+
* @description Attach a one time listener to dismissable callouts
|
580
|
+
*/
|
581
|
+
function attachCalloutHandlers() {
|
582
|
+
document.querySelectorAll('.' + _class.dismiss).forEach(create);
|
583
|
+
}
|
584
|
+
|
585
|
+
/**
|
586
|
+
* @private
|
587
|
+
*
|
588
|
+
* @description Create a callout
|
589
|
+
* @param {HTMLElement} callout
|
590
|
+
*/
|
591
|
+
function create(calloutOrDismiss) {
|
592
|
+
var callout, calloutDismiss;
|
593
|
+
|
594
|
+
if(Volta._hasClass(calloutOrDismiss, _class.callout)) {
|
595
|
+
callout = calloutOrDismiss;
|
596
|
+
calloutDismiss = callout.querySelector('.' + _class.dismiss);
|
597
|
+
} else if(Volta._hasClass(calloutOrDismiss, _class.dismiss)){
|
598
|
+
calloutDismiss = calloutOrDismiss;
|
599
|
+
callout = calloutDismiss.parentElement;
|
600
|
+
}
|
601
|
+
|
602
|
+
calloutDismiss.addEventListener('click', function(){
|
603
|
+
dismiss(callout);
|
604
|
+
}, { once : true});
|
605
|
+
}
|
606
|
+
|
607
|
+
/**
|
608
|
+
* @public
|
609
|
+
*
|
610
|
+
* @description Dismiss a callout
|
611
|
+
* @param {HTMLElement} callout
|
612
|
+
*/
|
613
|
+
function dismiss(callout) {
|
614
|
+
callout.classList.add(_class.dismissed);
|
615
|
+
|
616
|
+
if(callout.dataset.callback) {
|
617
|
+
return Volta._getFunction(calloutWrapper.dataset.callback)();
|
618
|
+
}
|
619
|
+
}
|
620
|
+
}();
|
621
|
+
/**
|
622
|
+
* Copyright (c) 2001-present, Vonage.
|
623
|
+
*
|
624
|
+
* Dropdowns (requires core)
|
625
|
+
*/
|
626
|
+
|
627
|
+
'use strict';
|
628
|
+
|
629
|
+
Volta.dropdown = function () {
|
630
|
+
var _class = {
|
631
|
+
wrapper: 'Vlt-dropdown',
|
632
|
+
block: 'Vlt-dropdown__block',
|
633
|
+
btn: 'Vlt-dropdown__trigger',
|
634
|
+
btnLegacy: 'Vlt-dropdown__btn',
|
635
|
+
dismissed: 'Vlt-callout--dismissed',
|
636
|
+
expanded: 'Vlt-dropdown--expanded',
|
637
|
+
label: 'Vlt-dropdown__label',
|
638
|
+
link: 'Vlt-dropdown__link',
|
639
|
+
noCloseLink: 'Vlt-dropdown__link--noclose',
|
640
|
+
noCloseBlock: 'Vlt-dropdown__block--noclose',
|
641
|
+
panel: 'Vlt-dropdown__panel',
|
642
|
+
panelContent: 'Vlt-dropdown__panel__content',
|
643
|
+
selection: 'Vlt-dropdown__selection',
|
644
|
+
switch: 'Vlt-switch',
|
645
|
+
switchSlider: 'Vlt-switch__slider'
|
646
|
+
}
|
647
|
+
|
648
|
+
function Dropdown() {}
|
649
|
+
|
650
|
+
Dropdown.prototype = {
|
651
|
+
init: function(element, supressClickHandler) {
|
652
|
+
this.dropdown = element;
|
653
|
+
this.selection = this.dropdown.querySelector('.' + _class.selection);
|
654
|
+
this.isSelectionVisible = !!this.selection;
|
655
|
+
this.btn = this.dropdown.querySelector('.' + _class.btn) || this.dropdown.querySelector('.' + _class.btnLegacy);
|
656
|
+
this._suppress = supressClickHandler;
|
657
|
+
|
658
|
+
if(!this._suppress) {
|
659
|
+
this._addEventListener();
|
660
|
+
}
|
661
|
+
},
|
662
|
+
_addEventListener: function(){
|
663
|
+
var openHandler = this.open.bind(this);
|
664
|
+
this.dropdown.addEventListener('click', openHandler, { once: true })
|
665
|
+
},
|
666
|
+
close: function(text) {
|
667
|
+
if(text) {
|
668
|
+
this._setDropdownSelectionText(text);
|
669
|
+
}
|
670
|
+
this.dropdown.classList.remove(_class.expanded);
|
671
|
+
|
672
|
+
if(!this._suppress){
|
673
|
+
this._addEventListener();
|
674
|
+
}
|
675
|
+
|
676
|
+
},
|
677
|
+
_closeEventHandler: undefined,
|
678
|
+
_closeEvent: function(e) {
|
679
|
+
var targetIsPanel = Volta._hasClass(e.target, _class.panel);
|
680
|
+
var parentIsPanel = Volta._closest(e.target, '.' + _class.panelContent, _class.panel) !== null;
|
681
|
+
var parentLink = Volta._closest(e.target, '.' + _class.link, _class.wrapper);
|
682
|
+
var parentIsLink = parentLink && parentLink.length === 1;
|
683
|
+
var isSwitchSlider = Volta._hasClass(e.target, _class.switchSlider);
|
684
|
+
var isParentSwitch = Volta._closest(e.target,'.' + _class.switch, _class.link);
|
685
|
+
var isNoClose = Volta._hasClass(e.target, _class.noCloseLink) || Volta._hasClass(e.target, _class.noCloseBlock);
|
686
|
+
var isNoCloseParent = Volta._closest(e.target,'.' + _class.noCloseLink, _class.link) || Volta._closest(e.target,'.' + _class.noCloseBlock, _class.noCloseBlock);
|
687
|
+
var isInput = e.target instanceof HTMLInputElement;
|
688
|
+
|
689
|
+
if(!targetIsPanel && !parentIsPanel && !parentIsLink && !isNoClose && !isInput && !isNoCloseParent) {
|
690
|
+
e.preventDefault();
|
691
|
+
e.stopPropagation();
|
692
|
+
}
|
693
|
+
|
694
|
+
if(isSwitchSlider || isParentSwitch || isNoClose || isInput || isNoCloseParent) {
|
695
|
+
return null;
|
696
|
+
}
|
697
|
+
|
698
|
+
var text;
|
699
|
+
if(parentIsPanel && Volta._hasClass(e.target, _class.label)) {
|
700
|
+
text = e.target.innerHTML;
|
701
|
+
} else if (parentIsPanel) {
|
702
|
+
var label = e.target.querySelector('.' + _class.label);
|
703
|
+
if(label) {
|
704
|
+
text = label.innerHTML;
|
705
|
+
}
|
706
|
+
}
|
707
|
+
|
708
|
+
this.close(text);
|
709
|
+
|
710
|
+
document.querySelector('body').removeEventListener('click', this._closeEventHandler );
|
711
|
+
},
|
712
|
+
open: function(event) {
|
713
|
+
if(event) {
|
714
|
+
event.preventDefault();
|
715
|
+
event.stopPropagation();
|
716
|
+
}
|
717
|
+
|
718
|
+
this.dropdown.classList.add(_class.expanded);
|
719
|
+
|
720
|
+
if(!this._suppress){
|
721
|
+
this._closeEventHandler = this._closeEvent.bind(this);
|
722
|
+
document.querySelector('body').addEventListener('click', this._closeEventHandler );
|
723
|
+
}
|
724
|
+
},
|
725
|
+
_setDropdownSelectionText: function(text) {
|
726
|
+
if(this.isSelectionVisible) {
|
727
|
+
this.selection.innerText = text;
|
728
|
+
} else {
|
729
|
+
this.btn.innerText = text;
|
730
|
+
this.btn.value = text;
|
731
|
+
}
|
732
|
+
},
|
733
|
+
_suppress: false
|
734
|
+
}
|
735
|
+
|
736
|
+
return {
|
737
|
+
create: create,
|
738
|
+
init: attachDropdownHandlers
|
739
|
+
}
|
740
|
+
|
741
|
+
/**
|
742
|
+
* @public
|
743
|
+
*
|
744
|
+
* @description Attach a listeners to dropdowns
|
745
|
+
*/
|
746
|
+
function attachDropdownHandlers() {
|
747
|
+
document.querySelectorAll('.' + _class.wrapper).forEach(attachHandler);
|
748
|
+
|
749
|
+
function attachHandler(dropdown) {
|
750
|
+
create(dropdown);
|
751
|
+
}
|
752
|
+
}
|
753
|
+
|
754
|
+
/**
|
755
|
+
* @private
|
756
|
+
*
|
757
|
+
* @description Create a dropdown element
|
758
|
+
* @param {HTMLElement} element
|
759
|
+
*/
|
760
|
+
function create(element){
|
761
|
+
var dropdown = Object.create(Dropdown.prototype, {})
|
762
|
+
dropdown.init(element);
|
763
|
+
return dropdown;
|
764
|
+
}
|
765
|
+
}();
|
766
|
+
/**
|
767
|
+
* Copyright (c) 2001-present, Vonage.
|
768
|
+
*
|
769
|
+
* Tabs (requires core)
|
770
|
+
*/
|
771
|
+
|
772
|
+
'use strict';
|
773
|
+
|
774
|
+
Volta.flash = function () {
|
775
|
+
var _class = {
|
776
|
+
flash: 'Vlt-flash',
|
777
|
+
trigger: 'Vlt-flash-trigger',
|
778
|
+
visible: 'Vlt-flash_visible'
|
779
|
+
}
|
780
|
+
|
781
|
+
var gap = 20,
|
782
|
+
openBottomFlashes = [],
|
783
|
+
openTopFlashes = [],
|
784
|
+
timeouts =[];
|
785
|
+
|
786
|
+
return {
|
787
|
+
closeAll: closeAll,
|
788
|
+
init: attachFlashHandlers,
|
789
|
+
show: show
|
790
|
+
}
|
791
|
+
|
792
|
+
/**
|
793
|
+
* @public
|
794
|
+
*
|
795
|
+
* @description Attach a click listener to each flash's trigger on the screen
|
796
|
+
* @param {HTMLElement} element
|
797
|
+
*/
|
798
|
+
function attachFlashHandlers() {
|
799
|
+
var triggers = document.querySelectorAll('.' + _class.trigger);
|
800
|
+
|
801
|
+
if(triggers.length === 0) {
|
802
|
+
return;
|
803
|
+
}
|
804
|
+
|
805
|
+
triggers.forEach(attachHandler);
|
806
|
+
|
807
|
+
function attachHandler(trigger) {
|
808
|
+
trigger.addEventListener('click', function() {
|
809
|
+
if(trigger.dataset.flash) {
|
810
|
+
var flash = document.querySelector('#' + trigger.dataset.flash);
|
811
|
+
show(flash);
|
812
|
+
} else {
|
813
|
+
console.warn("Volta: flash trigger is missing data-flash attribute");
|
814
|
+
}
|
815
|
+
});
|
816
|
+
}
|
817
|
+
}
|
818
|
+
|
819
|
+
/**
|
820
|
+
* @public
|
821
|
+
*
|
822
|
+
* @description Close all open flashes
|
823
|
+
*/
|
824
|
+
function closeAll() {
|
825
|
+
if(timeouts.length > 0) {
|
826
|
+
timeouts.forEach(function(timeout){
|
827
|
+
clearTimeout(timeout);
|
828
|
+
});
|
829
|
+
}
|
830
|
+
if(openBottomFlashes.length > 0) {
|
831
|
+
clearQueue(openBottomFlashes);
|
832
|
+
}
|
833
|
+
if(openTopFlashes.length > 0) {
|
834
|
+
clearQueue(openTopFlashes);
|
835
|
+
}
|
836
|
+
|
837
|
+
timeouts = [];
|
838
|
+
openBottomFlashes = [];
|
839
|
+
openTopFlashes = [];
|
840
|
+
|
841
|
+
function clearQueue(elementArr) {
|
842
|
+
elementArr.forEach(function(element){
|
843
|
+
_hide(element);
|
844
|
+
});
|
845
|
+
elementArr = [];
|
846
|
+
}
|
847
|
+
}
|
848
|
+
|
849
|
+
/**
|
850
|
+
* @public
|
851
|
+
*
|
852
|
+
* @description Show the flash
|
853
|
+
* @param {HTMLElement} element
|
854
|
+
*/
|
855
|
+
function show(elementOrId, time) {
|
856
|
+
if(!elementOrId || elementOrId.length == 0) {
|
857
|
+
return;
|
858
|
+
}
|
859
|
+
|
860
|
+
time = time || 5000;
|
861
|
+
|
862
|
+
var element = !elementOrId.classList ? document.querySelector('#' + elementOrId) : elementOrId;
|
863
|
+
var position = Volta._hasClass(element, 'Vlt-flash--bottom') ? 'bottom' : 'top';
|
864
|
+
var arr = position === 'bottom' ? openBottomFlashes : openTopFlashes;
|
865
|
+
|
866
|
+
if(arr.indexOf(element) !== -1) {
|
867
|
+
return;
|
868
|
+
}
|
869
|
+
|
870
|
+
_setFlashPosition(arr, element, position);
|
871
|
+
|
872
|
+
arr.push(element);
|
873
|
+
|
874
|
+
element.classList.add(_class.visible);
|
875
|
+
|
876
|
+
var hideTimeout = setTimeout(function(){
|
877
|
+
_hide(element, true);
|
878
|
+
Volta._removeFromArr(timeouts, hideTimeout);
|
879
|
+
}, time);
|
880
|
+
|
881
|
+
timeouts.push(hideTimeout);
|
882
|
+
}
|
883
|
+
|
884
|
+
/**
|
885
|
+
* @private
|
886
|
+
* @description Hide the flash
|
887
|
+
* @param {HTMLElement} element
|
888
|
+
*/
|
889
|
+
function _hide(element, shouldRemove) {
|
890
|
+
var position = Volta._hasClass(element, 'Vlt-flash--bottom') ? 'bottom' : 'top';
|
891
|
+
var arr = position === 'bottom' ? openBottomFlashes : openTopFlashes;
|
892
|
+
|
893
|
+
if(shouldRemove) {
|
894
|
+
Volta._removeFromArr(arr, element);
|
895
|
+
}
|
896
|
+
|
897
|
+
_updateFlashPositions(arr, element, position);
|
898
|
+
|
899
|
+
element.style[position] = '';
|
900
|
+
element.classList.remove(_class.visible);
|
901
|
+
}
|
902
|
+
|
903
|
+
/**
|
904
|
+
* @private
|
905
|
+
* @description Set the position of the flash
|
906
|
+
* @param {HTMLElement} element
|
907
|
+
*/
|
908
|
+
function _setFlashPosition(arr, element, position) {
|
909
|
+
var positionPx = arr.reduce(function(px, flash) {
|
910
|
+
return px + flash.clientHeight;
|
911
|
+
}, 0);
|
912
|
+
if(positionPx > 0) {
|
913
|
+
element.style[position] = (gap * arr.length) + gap + positionPx + 'px';
|
914
|
+
}
|
915
|
+
}
|
916
|
+
|
917
|
+
/**
|
918
|
+
* @private
|
919
|
+
* @description Update the position of all the visible flashes
|
920
|
+
* @param {Array} arr
|
921
|
+
* @param {HTMLElement} element
|
922
|
+
* @param {string} position
|
923
|
+
*/
|
924
|
+
function _updateFlashPositions(arr, element, position){
|
925
|
+
if(arr.length > 0) {
|
926
|
+
var elementHeight = element.clientHeight;
|
927
|
+
|
928
|
+
arr.forEach(function(flash) {
|
929
|
+
var newPosition;
|
930
|
+
|
931
|
+
if(position === 'bottom') {
|
932
|
+
newPosition = Number(flash.style.bottom.substring(0, flash.style.bottom.length - 2));
|
933
|
+
} else {
|
934
|
+
newPosition = flash.getBoundingClientRect()[position];
|
935
|
+
}
|
936
|
+
flash.style[position] = newPosition -elementHeight - gap + "px";
|
937
|
+
});
|
938
|
+
}
|
939
|
+
}
|
940
|
+
}();
|
941
|
+
/**
|
942
|
+
* Copyright (c) 2001-present, Vonage.
|
943
|
+
*
|
944
|
+
* Modals (requires core)
|
945
|
+
*/
|
946
|
+
|
947
|
+
'use strict';
|
948
|
+
|
949
|
+
Volta.modal = function () {
|
950
|
+
var _class = {
|
951
|
+
auto: 'Vlt-modal--auto',
|
952
|
+
bodyModalOpen: 'Vlt-body--modal-open',
|
953
|
+
cancel: 'Vlt-modal__cancel',
|
954
|
+
confirm: 'Vlt-modal__confirm',
|
955
|
+
content: 'Vlt-modal__content',
|
956
|
+
modal: 'Vlt-modal',
|
957
|
+
out: 'Vlt-modal--out',
|
958
|
+
panel: 'Vlt-modal__panel',
|
959
|
+
trigger: 'Vlt-modal-trigger',
|
960
|
+
visible: 'Vlt-modal_visible',
|
961
|
+
dismiss: 'Vlt-modal__dismiss',
|
962
|
+
}
|
963
|
+
|
964
|
+
var body,
|
965
|
+
dismissModalHandler,
|
966
|
+
cancelModalHandler,
|
967
|
+
confirmModalHandler,
|
968
|
+
escHandler,
|
969
|
+
clickHandler,
|
970
|
+
escAttached;
|
971
|
+
|
972
|
+
function Modal() {}
|
973
|
+
|
974
|
+
Modal.prototype = {
|
975
|
+
attachButtons: function() {
|
976
|
+
var _this = this;
|
977
|
+
_this.dismissBtn = _this.modal.querySelector('.' + _class.dismiss);
|
978
|
+
|
979
|
+
if(_this.dismissBtn) {
|
980
|
+
dismissModalHandler = dismissModal.bind(_this);
|
981
|
+
_this.dismissBtn.addEventListener('click', dismissModalHandler);
|
982
|
+
}
|
983
|
+
|
984
|
+
_this.cancelBtn = _this.modal.querySelector('.' + _class.cancel);
|
985
|
+
|
986
|
+
if(_this.cancelBtn) {
|
987
|
+
cancelModalHandler = cancelModal.bind(_this);
|
988
|
+
_this.cancelBtn.addEventListener('click', cancelModalHandler);
|
989
|
+
}
|
990
|
+
|
991
|
+
_this.confirmBtn = _this.modal.querySelector('.' + _class.confirm);
|
992
|
+
|
993
|
+
if(_this.confirmBtn) {
|
994
|
+
confirmModalHandler = confirmModal.bind(_this);
|
995
|
+
_this.confirmBtn.addEventListener('click', confirmModalHandler);
|
996
|
+
}
|
997
|
+
},
|
998
|
+
html: function(newHtml) {
|
999
|
+
this.modal.innerHTML = newHtml;
|
1000
|
+
return this;
|
1001
|
+
},
|
1002
|
+
init: function(elementOrId) {
|
1003
|
+
if(elementOrId.length) {
|
1004
|
+
this.modal = document.querySelector('#' + elementOrId);
|
1005
|
+
} else {
|
1006
|
+
this.modal = elementOrId;
|
1007
|
+
}
|
1008
|
+
|
1009
|
+
this._callback = Volta._getFunction(this.modal.dataset.callback);
|
1010
|
+
},
|
1011
|
+
open: function(e) {
|
1012
|
+
if(e && e.preventDefault) {
|
1013
|
+
e.preventDefault();
|
1014
|
+
e.stopPropagation();
|
1015
|
+
}
|
1016
|
+
|
1017
|
+
this.modal.classList.remove(_class.out);
|
1018
|
+
this.modal.classList.add(_class.visible);
|
1019
|
+
this.attachButtons();
|
1020
|
+
|
1021
|
+
disableScroll();
|
1022
|
+
|
1023
|
+
if(!escAttached && !this.modal.dataset.disableEsc || this.modal.dataset.disableEsc === "false") {
|
1024
|
+
escHandler = closeModalOnEscape.bind(this);
|
1025
|
+
body.addEventListener('keyup', escHandler, { once: true });
|
1026
|
+
escAttached = true;
|
1027
|
+
}
|
1028
|
+
|
1029
|
+
if(!this.modal.dataset.disableClick || this.modal.dataset.disableClick === "false") {
|
1030
|
+
clickHandler = closeModalOnClick.bind(this);
|
1031
|
+
this.modal.addEventListener('click', clickHandler, { once: true });
|
1032
|
+
}
|
1033
|
+
},
|
1034
|
+
dismiss: function(e, confirmed) {
|
1035
|
+
var _this = this;
|
1036
|
+
|
1037
|
+
if(e && e.preventDefault) {
|
1038
|
+
e.preventDefault();
|
1039
|
+
e.stopPropagation();
|
1040
|
+
}
|
1041
|
+
|
1042
|
+
enableScroll();
|
1043
|
+
|
1044
|
+
if(_this.modal){
|
1045
|
+
_this.modal.classList.remove(_class.visible);
|
1046
|
+
_this.modal.classList.add(_class.out);
|
1047
|
+
}
|
1048
|
+
|
1049
|
+
if(_this._callback) {
|
1050
|
+
_this._callback(confirmed);
|
1051
|
+
}
|
1052
|
+
|
1053
|
+
removeModal(_this);
|
1054
|
+
}
|
1055
|
+
}
|
1056
|
+
|
1057
|
+
return {
|
1058
|
+
create: create,
|
1059
|
+
init: attachModalHandlers
|
1060
|
+
}
|
1061
|
+
|
1062
|
+
/**
|
1063
|
+
* @public
|
1064
|
+
*
|
1065
|
+
* @description Attach a click listener to each modals trigger on the screen, which will open the modal
|
1066
|
+
*/
|
1067
|
+
function attachModalHandlers() {
|
1068
|
+
if(!body) {
|
1069
|
+
body = document.querySelector('body');
|
1070
|
+
}
|
1071
|
+
|
1072
|
+
var triggers = document.querySelectorAll('.' + _class.trigger);
|
1073
|
+
|
1074
|
+
if(triggers.length > 0) {
|
1075
|
+
triggers.forEach(attachTriggerHandler);
|
1076
|
+
}
|
1077
|
+
|
1078
|
+
//Not the recommended way to use modals
|
1079
|
+
var modals = document.querySelectorAll('.' + _class.modal);
|
1080
|
+
|
1081
|
+
if(modals.length > 0) {
|
1082
|
+
modals.forEach(attachModalHandler);
|
1083
|
+
}
|
1084
|
+
|
1085
|
+
function attachModalHandler(modal) {
|
1086
|
+
if(Volta._hasClass(modal, _class.auto)) {
|
1087
|
+
var trigger = document.querySelector('#' + modal.dataset.trigger);
|
1088
|
+
trigger.addEventListener('click', function() {
|
1089
|
+
create(modal).open();
|
1090
|
+
});
|
1091
|
+
}
|
1092
|
+
}
|
1093
|
+
|
1094
|
+
function attachTriggerHandler(trigger) {
|
1095
|
+
if(trigger.dataset.modal) {
|
1096
|
+
var modal = document.querySelector('#' + trigger.dataset.modal);
|
1097
|
+
|
1098
|
+
if(!modal) {
|
1099
|
+
console.warn('Volta: modal ' + trigger.dataset.modal + ' cannot be found');
|
1100
|
+
}
|
1101
|
+
|
1102
|
+
trigger.addEventListener('click', function() {
|
1103
|
+
create(modal).open();
|
1104
|
+
});
|
1105
|
+
}
|
1106
|
+
}
|
1107
|
+
}
|
1108
|
+
|
1109
|
+
/**
|
1110
|
+
* @private
|
1111
|
+
*
|
1112
|
+
* @description Close the modal, triggered by cancel button, passes false to callback function
|
1113
|
+
* @param {event} e
|
1114
|
+
*/
|
1115
|
+
function cancelModal(e) {
|
1116
|
+
return this.dismiss(e, false);
|
1117
|
+
}
|
1118
|
+
|
1119
|
+
/**
|
1120
|
+
* @private
|
1121
|
+
*
|
1122
|
+
* @description Close the modal, triggered by confirm button, passes true to callback function
|
1123
|
+
* @param {event} e
|
1124
|
+
*/
|
1125
|
+
function confirmModal(e) {
|
1126
|
+
return this.dismiss(e, true);
|
1127
|
+
}
|
1128
|
+
|
1129
|
+
/**
|
1130
|
+
* @private
|
1131
|
+
*
|
1132
|
+
* @description Close the modal, triggered by 'x' button, passes false to callback function
|
1133
|
+
* @param {event} e
|
1134
|
+
*/
|
1135
|
+
function dismissModal(e) {
|
1136
|
+
return this.dismiss(e, false);
|
1137
|
+
}
|
1138
|
+
|
1139
|
+
/** @private
|
1140
|
+
*
|
1141
|
+
* @description Close the modal, triggered by 'esc' key, passes false to callback function
|
1142
|
+
* @param {event} e
|
1143
|
+
*/
|
1144
|
+
function closeModalOnEscape(e){
|
1145
|
+
if(e && e.keyCode === 27) {
|
1146
|
+
this.dismiss(e, false);
|
1147
|
+
} else {
|
1148
|
+
body.addEventListener('click', escHandler, { once: true });
|
1149
|
+
}
|
1150
|
+
}
|
1151
|
+
|
1152
|
+
|
1153
|
+
/** @private
|
1154
|
+
*
|
1155
|
+
* @description Close the modal, triggered by 'body click, passes false to callback function
|
1156
|
+
* @param {event} e
|
1157
|
+
*/
|
1158
|
+
function closeModalOnClick(e){
|
1159
|
+
if(!Volta._hasClass(e.target, _class.trigger)
|
1160
|
+
&& !Volta._closest(e.target, '.' + _class.trigger, '.' + _class.trigger)
|
1161
|
+
&& !Volta._closest(e.target, '.' + _class.panel, '.' + _class.panel)) {
|
1162
|
+
this.dismiss(e, false);
|
1163
|
+
} else if(this.modal) {
|
1164
|
+
this.modal.addEventListener('click', clickHandler, { once: true });
|
1165
|
+
}
|
1166
|
+
}
|
1167
|
+
|
1168
|
+
/**
|
1169
|
+
* @public
|
1170
|
+
*
|
1171
|
+
* @description Create the modal object
|
1172
|
+
* @param {HTMLElement|string} elementOrId Reference to the modal element or the id
|
1173
|
+
*. @return {Object} A modal object
|
1174
|
+
*/
|
1175
|
+
function create(elementOrId) {
|
1176
|
+
if(!body) {
|
1177
|
+
body = document.querySelector('body');
|
1178
|
+
}
|
1179
|
+
var modal = Object.create(Modal.prototype, {})
|
1180
|
+
modal.init(elementOrId);
|
1181
|
+
return modal;
|
1182
|
+
}
|
1183
|
+
|
1184
|
+
/**
|
1185
|
+
* Private functions to disable body scroll when modal is open
|
1186
|
+
*/
|
1187
|
+
function disableScroll() {
|
1188
|
+
body.classList.add(_class.bodyModalOpen);
|
1189
|
+
body.addEventListener('touchmove', preventScroll);
|
1190
|
+
|
1191
|
+
if (body.querySelector('.Vlt-main')) {
|
1192
|
+
body.querySelector('.Vlt-main').addEventListener('touchmove', preventScroll);
|
1193
|
+
} else {
|
1194
|
+
body.addEventListener('touchmove', preventScroll);
|
1195
|
+
}
|
1196
|
+
|
1197
|
+
body.querySelector('.' + _class.content).addEventListener('touchmove', allowScroll);
|
1198
|
+
}
|
1199
|
+
|
1200
|
+
function enableScroll() {
|
1201
|
+
body.classList.remove(_class.bodyModalOpen);
|
1202
|
+
body.removeEventListener('touchmove', preventScroll);
|
1203
|
+
|
1204
|
+
if (body.querySelector('.Vlt-main')) {
|
1205
|
+
body.querySelector('.Vlt-main').removeEventListener('touchmove', preventScroll);
|
1206
|
+
} else {
|
1207
|
+
body.removeEventListener('touchmove', preventScroll);
|
1208
|
+
}
|
1209
|
+
|
1210
|
+
var modalContent = body.querySelector('.' + _class.content);
|
1211
|
+
if(modalContent) modalContent.removeEventListener('touchmove', allowScroll);
|
1212
|
+
}
|
1213
|
+
|
1214
|
+
function allowScroll(e) {
|
1215
|
+
e.stopPropagation();
|
1216
|
+
}
|
1217
|
+
|
1218
|
+
function preventScroll(e) {
|
1219
|
+
e.preventDefault();
|
1220
|
+
}
|
1221
|
+
|
1222
|
+
/**
|
1223
|
+
* @private
|
1224
|
+
*
|
1225
|
+
* @description Remove the modal after dismiss, makes sure to delete the modal properties so it can be garbage collected, and removes event listeners
|
1226
|
+
* @param {HTMLElement|string} elementOrId Reference to the modal element or the id
|
1227
|
+
*/
|
1228
|
+
function removeModal(modal) {
|
1229
|
+
delete modal.modal;
|
1230
|
+
|
1231
|
+
if(modal.dismissBtn) {
|
1232
|
+
modal.dismissBtn.removeEventListener('click', dismissModalHandler);
|
1233
|
+
}
|
1234
|
+
|
1235
|
+
if(modal.cancelBtn) {
|
1236
|
+
modal.cancelBtn.removeEventListener('click', cancelModalHandler);
|
1237
|
+
}
|
1238
|
+
|
1239
|
+
if(modal.confirmBtn) {
|
1240
|
+
modal.confirmBtn.removeEventListener('click', confirmModalHandler);
|
1241
|
+
}
|
1242
|
+
|
1243
|
+
if(clickHandler) {
|
1244
|
+
body.removeEventListener('click', clickHandler);
|
1245
|
+
}
|
1246
|
+
|
1247
|
+
if(escHandler) {
|
1248
|
+
body.removeEventListener('keyup', escHandler);
|
1249
|
+
escAttached = false;
|
1250
|
+
}
|
1251
|
+
}
|
1252
|
+
}();
|
1253
|
+
/**
|
1254
|
+
* Copyright (c) 2001-present, Vonage.
|
1255
|
+
*
|
1256
|
+
* Tabs (requires core)
|
1257
|
+
*/
|
1258
|
+
|
1259
|
+
'use strict';
|
1260
|
+
|
1261
|
+
Volta.tab = function () {
|
1262
|
+
var _class = {
|
1263
|
+
link: 'Vlt-tabs__link',
|
1264
|
+
linkJs: 'Vlt-js-tabs__link',
|
1265
|
+
linkActive: 'Vlt-tabs__link_active',
|
1266
|
+
linkDisabled: 'Vlt-tabs__link_disabled',
|
1267
|
+
linkJsActive: 'Vlt-js-tabs__link_active',
|
1268
|
+
panel: 'Vlt-tabs__panel',
|
1269
|
+
panelActive: 'Vlt-tabs__panel_active',
|
1270
|
+
panelJsActive: 'Vlt-js-tabs__panel_active',
|
1271
|
+
tabs: 'Vlt-tabs',
|
1272
|
+
}
|
1273
|
+
|
1274
|
+
function Tabs() { }
|
1275
|
+
|
1276
|
+
Tabs.prototype = {
|
1277
|
+
_keys: {
|
1278
|
+
left: 37,
|
1279
|
+
right: 39
|
1280
|
+
},
|
1281
|
+
|
1282
|
+
init: function (element, isWrapper) {
|
1283
|
+
var _this = this,
|
1284
|
+
tabsHeader,
|
1285
|
+
tabsContent;
|
1286
|
+
|
1287
|
+
if (isWrapper) {
|
1288
|
+
tabsHeader = element.children.item(0);
|
1289
|
+
tabsContent = element.children.item(1);
|
1290
|
+
} else {
|
1291
|
+
_this.isJs = true;
|
1292
|
+
tabsHeader = element;
|
1293
|
+
tabsContent = element.dataset.tabContent ?
|
1294
|
+
document.querySelector('#' + element.dataset.tabContent)
|
1295
|
+
: null;
|
1296
|
+
}
|
1297
|
+
|
1298
|
+
var linkClass = _this.isJs ? _class.linkJs : _class.link;
|
1299
|
+
_this._links = tabsHeader.querySelectorAll('.' + linkClass);
|
1300
|
+
_this._panels = tabsContent ? tabsContent.children : undefined;
|
1301
|
+
|
1302
|
+
this._deactivateElements();
|
1303
|
+
this._setActiveElements();
|
1304
|
+
|
1305
|
+
if (_this._panels && _this._panels.length === _this._links.length) {
|
1306
|
+
_this._links.forEach(function (link, index) {
|
1307
|
+
var link = link;
|
1308
|
+
|
1309
|
+
link.index = index;
|
1310
|
+
link.addEventListener('keyup', _this._keyUpEventListener.bind(_this));
|
1311
|
+
link.addEventListener('toggle', function () {
|
1312
|
+
_this.toggle(link);
|
1313
|
+
});
|
1314
|
+
link.addEventListener('click', function () {
|
1315
|
+
_this.toggle(link);
|
1316
|
+
});
|
1317
|
+
});
|
1318
|
+
} else if (_this._panels && _this._panels.length > 0) {
|
1319
|
+
console.log('Volta: Tabs, number of links and panels do not match');
|
1320
|
+
}
|
1321
|
+
},
|
1322
|
+
toggle: function (linkElement) {
|
1323
|
+
var linkActiveClass = this.isJs ? _class.linkJsActive : _class.linkActive;
|
1324
|
+
var panelActiveClass = this.isJs ? _class.panelJsActive : _class.panelActive;
|
1325
|
+
|
1326
|
+
if (!Volta._hasClass(linkElement, _class.linkDisabled) && (!this._activeLink || this._activeLink !== linkElement)) {
|
1327
|
+
if (this._activeLink) {
|
1328
|
+
this._activeLink.classList.remove(linkActiveClass);
|
1329
|
+
this._activePanel.classList.remove(panelActiveClass);
|
1330
|
+
}
|
1331
|
+
|
1332
|
+
this._deactivateElements();
|
1333
|
+
this._setActiveElements(linkElement);
|
1334
|
+
|
1335
|
+
this._activeLink.classList.add(linkActiveClass);
|
1336
|
+
this._activePanel.classList.add(panelActiveClass);
|
1337
|
+
|
1338
|
+
if (Volta.tooltip) {
|
1339
|
+
Volta.tooltip.init();
|
1340
|
+
}
|
1341
|
+
}
|
1342
|
+
},
|
1343
|
+
_deactivateElements: function () {
|
1344
|
+
this._links.forEach(function (link) {
|
1345
|
+
link.setAttribute('tabIndex', '-1');
|
1346
|
+
link.setAttribute('aria-selected', 'false');
|
1347
|
+
});
|
1348
|
+
Array.from(this._panels).forEach(function (panel) {
|
1349
|
+
panel.setAttribute('hidden', 'hidden');
|
1350
|
+
});
|
1351
|
+
},
|
1352
|
+
_setActiveElements: function (linkElement) {
|
1353
|
+
var linkActiveClass = this.isJs ? _class.linkJsActive : _class.linkActive;
|
1354
|
+
|
1355
|
+
if (!linkElement) {
|
1356
|
+
this._activeLink = this._links.item(linkActiveClass);
|
1357
|
+
} else {
|
1358
|
+
this._activeLink = linkElement;
|
1359
|
+
}
|
1360
|
+
|
1361
|
+
var tabIndex;
|
1362
|
+
var currentNode = 0;
|
1363
|
+
|
1364
|
+
while (!tabIndex && currentNode < this._links.length) {
|
1365
|
+
if (this._links.item(currentNode) === this._activeLink) {
|
1366
|
+
tabIndex = currentNode;
|
1367
|
+
break;
|
1368
|
+
}
|
1369
|
+
currentNode++;
|
1370
|
+
}
|
1371
|
+
|
1372
|
+
if (this._panels) {
|
1373
|
+
this._activePanel = this._panels.item(tabIndex);
|
1374
|
+
}
|
1375
|
+
|
1376
|
+
this._activeLink.setAttribute('tabindex', '0');
|
1377
|
+
this._activeLink.setAttribute('aria-selected', 'true');
|
1378
|
+
if (this._activePanel) {
|
1379
|
+
this._activePanel.removeAttribute('hidden');
|
1380
|
+
}
|
1381
|
+
},
|
1382
|
+
_keyUpEventListener: function (event) {
|
1383
|
+
var key = event.keyCode;
|
1384
|
+
|
1385
|
+
switch (key) {
|
1386
|
+
case this._keys.left:
|
1387
|
+
case this._keys.right:
|
1388
|
+
this._switchTab(event);
|
1389
|
+
break;
|
1390
|
+
}
|
1391
|
+
},
|
1392
|
+
_switchTab: function (event) {
|
1393
|
+
var nextTab;
|
1394
|
+
|
1395
|
+
if (this._keys.left === event.keyCode) {
|
1396
|
+
nextTab = this._findNextTab(-1);
|
1397
|
+
} else if (this._keys.right === event.keyCode) {
|
1398
|
+
nextTab = this._findNextTab(1);
|
1399
|
+
}
|
1400
|
+
this.toggle(nextTab);
|
1401
|
+
},
|
1402
|
+
_findNextTab: function (direction) {
|
1403
|
+
var tab, nextTab;
|
1404
|
+
var currentIndex = this._activeLink.index;
|
1405
|
+
for (var i = currentIndex + direction; !nextTab && (this._calculateIndex(i) !== currentIndex); i += direction) {
|
1406
|
+
tab = this._links.item(this._calculateIndex(i));
|
1407
|
+
if (!Volta._hasClass(tab, _class.linkDisabled)) {
|
1408
|
+
nextTab = tab;
|
1409
|
+
}
|
1410
|
+
}
|
1411
|
+
return nextTab;
|
1412
|
+
},
|
1413
|
+
_calculateIndex: function (i) {
|
1414
|
+
var length = this._links.length;
|
1415
|
+
return ((i % length) + length) % length;
|
1416
|
+
}
|
1417
|
+
}
|
1418
|
+
|
1419
|
+
return {
|
1420
|
+
create: create,
|
1421
|
+
init: attachTabHandlers
|
1422
|
+
}
|
1423
|
+
|
1424
|
+
/**
|
1425
|
+
* @public
|
1426
|
+
*
|
1427
|
+
* @description Attach a listener to the tab header
|
1428
|
+
*/
|
1429
|
+
function attachTabHandlers() {
|
1430
|
+
//traditional tabs
|
1431
|
+
document.querySelectorAll('.' + _class.tabs).forEach(create);
|
1432
|
+
|
1433
|
+
document.querySelectorAll('[data-tab-content]').forEach(create);
|
1434
|
+
}
|
1435
|
+
|
1436
|
+
/**
|
1437
|
+
* @public
|
1438
|
+
*
|
1439
|
+
* @description Create a tabs component
|
1440
|
+
* @param {HTMLElement} element
|
1441
|
+
*/
|
1442
|
+
function create(element) {
|
1443
|
+
var tabs = Object.create(Tabs.prototype, {})
|
1444
|
+
|
1445
|
+
if (Volta._hasClass(element, _class.tabs)) {
|
1446
|
+
tabs.init(element, true);
|
1447
|
+
} else {
|
1448
|
+
tabs.init(element);
|
1449
|
+
}
|
1450
|
+
|
1451
|
+
return tabs;
|
1452
|
+
}
|
1453
|
+
}();
|
1454
|
+
|
1455
|
+
/**
|
1456
|
+
* Copyright (c) 2001-present, Vonage.
|
1457
|
+
*
|
1458
|
+
* tables (requires core)
|
1459
|
+
*/
|
1460
|
+
|
1461
|
+
'use strict';
|
1462
|
+
|
1463
|
+
Volta.table = function () {
|
1464
|
+
var _class = {
|
1465
|
+
table: 'Vlt-table',
|
1466
|
+
tall: 'Vlt-table--tall',
|
1467
|
+
short: 'Vlt-table--short',
|
1468
|
+
trigger: 'Vlt-table__density',
|
1469
|
+
buttonActive: 'Vlt-btn_active'
|
1470
|
+
}
|
1471
|
+
|
1472
|
+
return {
|
1473
|
+
init: attachTableDensityHandlers
|
1474
|
+
}
|
1475
|
+
|
1476
|
+
/**
|
1477
|
+
* @public
|
1478
|
+
*
|
1479
|
+
* @description Attach a listener to the table density triggers
|
1480
|
+
*/
|
1481
|
+
function attachTableDensityHandlers() {
|
1482
|
+
var triggers = document.querySelectorAll('.' + _class.trigger);
|
1483
|
+
|
1484
|
+
if(triggers.length > 0) {
|
1485
|
+
triggers.forEach(attachTriggerHandler);
|
1486
|
+
}
|
1487
|
+
|
1488
|
+
function attachTriggerHandler(trigger) {
|
1489
|
+
if(trigger.dataset.table) {
|
1490
|
+
var table = document.querySelector('#' + trigger.dataset.table);
|
1491
|
+
|
1492
|
+
if(!table) {
|
1493
|
+
console.warn('Volta: table ' + trigger.dataset.table + ' cannot be found');
|
1494
|
+
return;
|
1495
|
+
}
|
1496
|
+
|
1497
|
+
var activeButton = trigger.querySelector('.' + _class.buttonActive);
|
1498
|
+
|
1499
|
+
trigger.querySelectorAll('.Vlt-btn').forEach( function(button) {
|
1500
|
+
button.addEventListener('click', function() {
|
1501
|
+
if (this.dataset.density) {
|
1502
|
+
console.log('in')
|
1503
|
+
if (this.dataset.density == 'short') {
|
1504
|
+
table.classList.add(_class.short)
|
1505
|
+
table.classList.remove(_class.tall)
|
1506
|
+
} else if (this.dataset.density == 'tall') {
|
1507
|
+
table.classList.add(_class.tall)
|
1508
|
+
table.classList.remove(_class.short)
|
1509
|
+
} else {
|
1510
|
+
table.classList.remove(_class.tall)
|
1511
|
+
table.classList.remove(_class.short)
|
1512
|
+
}
|
1513
|
+
|
1514
|
+
// update classes on buttons
|
1515
|
+
if(activeButton) {
|
1516
|
+
activeButton.classList.remove(_class.buttonActive);
|
1517
|
+
}
|
1518
|
+
activeButton = this;
|
1519
|
+
this.classList.add(_class.buttonActive);
|
1520
|
+
}
|
1521
|
+
})
|
1522
|
+
});
|
1523
|
+
}
|
1524
|
+
}
|
1525
|
+
}
|
1526
|
+
|
1527
|
+
}();
|
1528
|
+
/**
|
1529
|
+
* Copyright (c) 2001-present, Vonage.
|
1530
|
+
*
|
1531
|
+
* Tooltips (requires popper.js, tooltip.js)
|
1532
|
+
*/
|
1533
|
+
'use strict';
|
1534
|
+
|
1535
|
+
Volta.tooltip = function () {
|
1536
|
+
var _class = {
|
1537
|
+
bottom: 'Vlt-tooltip--bottom',
|
1538
|
+
left: 'Vlt-tooltip--left',
|
1539
|
+
tooltip: 'Vlt-tooltip',
|
1540
|
+
top: 'Vlt-tooltip--top',
|
1541
|
+
right: 'Vlt-tooltip--right'
|
1542
|
+
}
|
1543
|
+
|
1544
|
+
var currentTooltip = undefined,
|
1545
|
+
currentTooltipContent = undefined;
|
1546
|
+
|
1547
|
+
return {
|
1548
|
+
create: create,
|
1549
|
+
init: attachTooltipHandlers
|
1550
|
+
}
|
1551
|
+
|
1552
|
+
/**
|
1553
|
+
* @public
|
1554
|
+
*
|
1555
|
+
* @description Create a Tooltip instance for every Vlt-tooltip
|
1556
|
+
*/
|
1557
|
+
function attachTooltipHandlers() {
|
1558
|
+
document.querySelectorAll('.' + _class.tooltip).forEach(create);
|
1559
|
+
}
|
1560
|
+
|
1561
|
+
/**
|
1562
|
+
* @public
|
1563
|
+
*
|
1564
|
+
* @description Create a Tooltip instance
|
1565
|
+
* @param {HTMLElement} tooltip
|
1566
|
+
* @return {object} a Tooltip element
|
1567
|
+
*/
|
1568
|
+
function create(tooltip) {
|
1569
|
+
var placement;
|
1570
|
+
|
1571
|
+
if (Volta._hasClass(tooltip, _class.bottom)) {
|
1572
|
+
placement = 'bottom';
|
1573
|
+
} else if (Volta._hasClass(tooltip, _class.top)) {
|
1574
|
+
placement = 'top';
|
1575
|
+
} else if (Volta._hasClass(tooltip, _class.left)) {
|
1576
|
+
placement = 'left';
|
1577
|
+
} else if (Volta._hasClass(tooltip, _class.right)) {
|
1578
|
+
placement = 'right';
|
1579
|
+
}
|
1580
|
+
|
1581
|
+
var template =
|
1582
|
+
'<div class="Vlt-tooltip--js" role="tooltip">' +
|
1583
|
+
'<div class="tooltip-arrow Vlt-tooltip__arrow"></div>' +
|
1584
|
+
'<div class="tooltip-inner Vlt-tooltip__content"></div>' +
|
1585
|
+
'</div>';
|
1586
|
+
|
1587
|
+
var title = tooltip.title;
|
1588
|
+
//remove the title so deafult title does not show
|
1589
|
+
tooltip.title = "";
|
1590
|
+
|
1591
|
+
return new Tooltip(tooltip, {
|
1592
|
+
html: true,
|
1593
|
+
template: template,
|
1594
|
+
title: title,
|
1595
|
+
placement: placement
|
1596
|
+
});
|
1597
|
+
}
|
1598
|
+
}();
|
1599
|
+
/**
|
1600
|
+
* Copyright (c) 2001-present, Vonage.
|
1601
|
+
*
|
1602
|
+
* Menu Collapse (requires core, menu)
|
1603
|
+
*/
|
1604
|
+
|
1605
|
+
'use strict';
|
1606
|
+
|
1607
|
+
Volta.menuCollapse = function () {
|
1608
|
+
var _class = {
|
1609
|
+
animate: 'Vlt-sidenav--animate',
|
1610
|
+
collapsed: 'Vlt-sidenav--collapsed',
|
1611
|
+
visible: 'Vlt-sidenav_visible'
|
1612
|
+
}
|
1613
|
+
|
1614
|
+
var _id = {
|
1615
|
+
collapse: '#Vlt-sidenav-collapse-trigger'
|
1616
|
+
}
|
1617
|
+
|
1618
|
+
var menuCollapseString = "menuCollapse";
|
1619
|
+
|
1620
|
+
return {
|
1621
|
+
attachCloseHandler: attachCloseHandler,
|
1622
|
+
init: initialise
|
1623
|
+
}
|
1624
|
+
|
1625
|
+
/**
|
1626
|
+
* @private
|
1627
|
+
*
|
1628
|
+
* @description Attach listener to trigger for collapsing the menu
|
1629
|
+
*/
|
1630
|
+
function attachMenuCollapseHandler() {
|
1631
|
+
var collapseTrigger = document.querySelector(_id.collapse);
|
1632
|
+
|
1633
|
+
if(collapseTrigger) {
|
1634
|
+
collapseTrigger.addEventListener('click', function(e) {
|
1635
|
+
e.preventDefault();
|
1636
|
+
e.stopPropagation();
|
1637
|
+
|
1638
|
+
var hasCollapsedClass = Volta._hasClass(Volta.menu._element, _class.collapsed);
|
1639
|
+
var isMobile = Volta._hasClass(Volta.menu._element, _class.visible);
|
1640
|
+
|
1641
|
+
Volta.menu._element.classList.add(_class.animate);
|
1642
|
+
|
1643
|
+
if (isMobile) {
|
1644
|
+
Volta.menu._element.classList.remove(_class.visible);
|
1645
|
+
} else if (hasCollapsedClass) {
|
1646
|
+
unCollapseMenu(Volta.menu._element);
|
1647
|
+
} else {
|
1648
|
+
collapseMenu(Volta.menu._element);
|
1649
|
+
}
|
1650
|
+
});
|
1651
|
+
}
|
1652
|
+
}
|
1653
|
+
|
1654
|
+
/**
|
1655
|
+
* @public
|
1656
|
+
*
|
1657
|
+
* @description Attach listener to trigger for closing the menu
|
1658
|
+
*/
|
1659
|
+
function attachCloseHandler(expandedMenus) {
|
1660
|
+
if(document.querySelector('.' + _class.collapsed) && expandedMenus) {
|
1661
|
+
document.querySelector('body').addEventListener('click', closeMenu, { once: true });
|
1662
|
+
}
|
1663
|
+
|
1664
|
+
function closeMenu(e) {
|
1665
|
+
if(!Volta._hasClass(e.target, Volta.menu._class.link)
|
1666
|
+
&& !Volta._hasClass(e.target.parentElement, Volta.menu._class.link)) {
|
1667
|
+
e.preventDefault();
|
1668
|
+
e.stopPropagation();
|
1669
|
+
|
1670
|
+
Volta.menu.closeAll();
|
1671
|
+
} else {
|
1672
|
+
document.querySelector('body').addEventListener('click', closeMenu, { once: true });
|
1673
|
+
}
|
1674
|
+
}
|
1675
|
+
}
|
1676
|
+
|
1677
|
+
/**
|
1678
|
+
* @private
|
1679
|
+
*
|
1680
|
+
* @description Collapse the expanded menu
|
1681
|
+
*/
|
1682
|
+
function collapseMenu() {
|
1683
|
+
Volta.menu.closeAll();
|
1684
|
+
Volta.menu.selectActiveTab();
|
1685
|
+
|
1686
|
+
Volta.menu._element.classList.add(_class.collapsed);
|
1687
|
+
|
1688
|
+
document.querySelectorAll(Volta.menu._class.trigger).forEach(function(menuItem){
|
1689
|
+
menuItem.nextElementSibling.style = "top: " + menuItem.positionTop;
|
1690
|
+
});
|
1691
|
+
|
1692
|
+
if(localStorage) {
|
1693
|
+
localStorage.setItem(menuCollapseString, true);
|
1694
|
+
}
|
1695
|
+
|
1696
|
+
var sideTabs = Volta.menu._element.querySelector('.' + Volta.menu._class.sideTabs);
|
1697
|
+
|
1698
|
+
if(sideTabs) {
|
1699
|
+
sideTabs.querySelectorAll('.' + Volta.menu._class.sideTabsTrigger).forEach(function(trigger){
|
1700
|
+
trigger.classList.remove(Volta.menu._class.sideTabsTrigger);
|
1701
|
+
trigger.classList.add(Volta.menu._class.trigger);
|
1702
|
+
trigger.addEventListener('click', Volta.menu.showCollapsed);
|
1703
|
+
});
|
1704
|
+
|
1705
|
+
sideTabs.querySelectorAll('.' + Volta.menu._class.sideTabsLink).forEach(function(link){
|
1706
|
+
link.classList.remove(Volta.menu._class.sideTabsLink);
|
1707
|
+
link.classList.add(Volta.menu._class.link);
|
1708
|
+
});
|
1709
|
+
}
|
1710
|
+
|
1711
|
+
Volta.menu.styleActiveTrigger();
|
1712
|
+
}
|
1713
|
+
|
1714
|
+
/**
|
1715
|
+
* @public
|
1716
|
+
*
|
1717
|
+
* @description Initailise the menu collapsing
|
1718
|
+
*/
|
1719
|
+
function initialise() {
|
1720
|
+
if(!Volta.menu || !Volta.menu._element) return;
|
1721
|
+
|
1722
|
+
attachMenuCollapseHandler();
|
1723
|
+
|
1724
|
+
var menuCollapsedFlag = localStorage ? localStorage.getItem(menuCollapseString) : false;
|
1725
|
+
|
1726
|
+
if(menuCollapsedFlag) {
|
1727
|
+
Volta.menu._element.querySelectorAll('.' + Volta.menu._class.triggerActive).forEach(function(trigger) {
|
1728
|
+
trigger.classList.remove(Volta.menu._class.triggerActive);
|
1729
|
+
});
|
1730
|
+
collapseMenu();
|
1731
|
+
} else {
|
1732
|
+
Volta.menu.expand();
|
1733
|
+
}
|
1734
|
+
}
|
1735
|
+
|
1736
|
+
/**
|
1737
|
+
* @public
|
1738
|
+
*
|
1739
|
+
* @description Expand the collapsed menu
|
1740
|
+
*/
|
1741
|
+
function unCollapseMenu() {
|
1742
|
+
Volta.menu._element.classList.remove(_class.collapsed);
|
1743
|
+
|
1744
|
+
if(localStorage) {
|
1745
|
+
localStorage.removeItem(menuCollapseString);
|
1746
|
+
}
|
1747
|
+
|
1748
|
+
var sideTabs = Volta.menu._element.querySelector('.' + Volta.menu._class.sideTabs);
|
1749
|
+
|
1750
|
+
if(sideTabs) {
|
1751
|
+
sideTabs.querySelectorAll('.' + Volta.menu._class.trigger).forEach(function(trigger){
|
1752
|
+
trigger.classList.add(Volta.menu._class.sideTabsTrigger);
|
1753
|
+
trigger.classList.remove(Volta.menu._class.trigger);
|
1754
|
+
trigger.removeEventListener('click', Volta.menu.showCollapsed);
|
1755
|
+
});
|
1756
|
+
|
1757
|
+
sideTabs.querySelectorAll('.' + Volta.menu._class.link).forEach(function(link){
|
1758
|
+
link.classList.add(Volta.menu._class.sideTabsLink);
|
1759
|
+
link.classList.remove(Volta.menu._class.link);
|
1760
|
+
});
|
1761
|
+
}
|
1762
|
+
|
1763
|
+
Volta.menu.expand(true);
|
1764
|
+
}
|
1765
|
+
}();
|
1766
|
+
/**
|
1767
|
+
* Copyright (c) 2001-present, Vonage.
|
1768
|
+
*
|
1769
|
+
* Menu (requires core)
|
1770
|
+
*/
|
1771
|
+
|
1772
|
+
'use strict';
|
1773
|
+
|
1774
|
+
Volta.menu = function () {
|
1775
|
+
var _class = {
|
1776
|
+
mobile: 'Vlt-sidenav__mobile',
|
1777
|
+
mobileOpen: 'Vlt-body--mobile-menu-open',
|
1778
|
+
mobileTrigger: 'Vlt-sidenav__mobile-trigger',
|
1779
|
+
link: 'Vlt-sidemenu__link',
|
1780
|
+
linkActive: 'Vlt-sidemenu__link_active',
|
1781
|
+
sideMenu: 'Vlt-sidemenu',
|
1782
|
+
sideTabs: 'Vlt-sidetabs',
|
1783
|
+
sideTabsLinkActive: 'Vlt-js-tabs__link_active',
|
1784
|
+
sideTabsPanel: 'Vlt-js-tabs__panel',
|
1785
|
+
sideTabsPanelActive: 'Vlt-js-tabs__panel_active',
|
1786
|
+
sideTabsLink: 'Vlt-sidetabs__link',
|
1787
|
+
sideTabsTrigger: 'Vlt-sidetabs__trigger',
|
1788
|
+
trigger: 'Vlt-sidemenu__trigger',
|
1789
|
+
triggerActive: 'Vlt-sidemenu__trigger_active',
|
1790
|
+
triggerCurrent: 'Vlt-sidemenu__trigger_current',
|
1791
|
+
triggerEnabled: '.Vlt-tabs__link:not(.Vlt-tabs__link_disabled)',
|
1792
|
+
visible: 'Vlt-sidenav_visible'
|
1793
|
+
}
|
1794
|
+
|
1795
|
+
var _id = {
|
1796
|
+
menu: '#Vlt-sidenav',
|
1797
|
+
mobileTrigger: '#Vlt-sidenav-mobile-trigger'
|
1798
|
+
}
|
1799
|
+
|
1800
|
+
var expandedMenus = [],
|
1801
|
+
mobileMenuTriggeredTwice;
|
1802
|
+
|
1803
|
+
return {
|
1804
|
+
_class: _class,
|
1805
|
+
_element: undefined,
|
1806
|
+
|
1807
|
+
closeAll: removeAllMenuItemsFromSelectedArr,
|
1808
|
+
init: initialise,
|
1809
|
+
expand: expandActiveMenu,
|
1810
|
+
showCollapsed: expandMenu,
|
1811
|
+
_triggerHandler: attachTriggerHandlers,
|
1812
|
+
selectActiveTab: selectActiveTab,
|
1813
|
+
styleActiveTrigger: styleActiveTrigger
|
1814
|
+
}
|
1815
|
+
|
1816
|
+
/**
|
1817
|
+
* @private
|
1818
|
+
*
|
1819
|
+
* @description Adds the parents of the active menu to the exoanded menus array
|
1820
|
+
* @param {HTMLElement} element The active menu
|
1821
|
+
*/
|
1822
|
+
function addExpandedParentMenuToArr(element){
|
1823
|
+
var nestedMenuUl = Volta._closest(element, 'ul', '.' + _class.sideMenu);
|
1824
|
+
var nestedMenuTrigger = nestedMenuUl.previousElementSibling;
|
1825
|
+
|
1826
|
+
if(nestedMenuTrigger && Volta._hasClass(nestedMenuTrigger, _class.trigger)) {
|
1827
|
+
if(!Volta._hasClass(nestedMenuTrigger, _class.triggerActive)) {
|
1828
|
+
nestedMenuTrigger.classList.add(_class.triggerActive);
|
1829
|
+
}
|
1830
|
+
|
1831
|
+
expandedMenus.push(nestedMenuTrigger);
|
1832
|
+
addExpandedParentMenuToArr(nestedMenuTrigger);
|
1833
|
+
}
|
1834
|
+
}
|
1835
|
+
|
1836
|
+
/**
|
1837
|
+
* @private
|
1838
|
+
*
|
1839
|
+
* @description Attach the listener for the mobile menu trigger
|
1840
|
+
*/
|
1841
|
+
function attachMobileTriggerHandler() {
|
1842
|
+
var mobileMenuTrigger = document.querySelector(_id.mobileTrigger);
|
1843
|
+
|
1844
|
+
if(mobileMenuTrigger) {
|
1845
|
+
mobileMenuTrigger.addEventListener('click', function(e){
|
1846
|
+
if(mobileMenuTriggeredTwice) {
|
1847
|
+
mobileMenuTriggeredTwice = false;
|
1848
|
+
e.stopPropagation();
|
1849
|
+
return;
|
1850
|
+
}
|
1851
|
+
if(!Volta._hasClass(Volta.menu._element, _class.visible)) {
|
1852
|
+
Volta.menu._element.classList.add(_class.visible);
|
1853
|
+
document.body.classList.add(_class.mobileOpen);
|
1854
|
+
|
1855
|
+
//stop propagation otherwise will immediately call handler
|
1856
|
+
e.stopPropagation();
|
1857
|
+
addMobileMenuCollapseListeners();
|
1858
|
+
}
|
1859
|
+
});
|
1860
|
+
}
|
1861
|
+
}
|
1862
|
+
|
1863
|
+
/**
|
1864
|
+
* @private
|
1865
|
+
*
|
1866
|
+
* @description Attach the listeners for closing the expanded mobile menu
|
1867
|
+
*/
|
1868
|
+
function addMobileMenuCollapseListeners() {
|
1869
|
+
document.querySelector('body').addEventListener('click', closeMenu, { once: true });
|
1870
|
+
document.querySelector('body').addEventListener('touchstart', closeMenu, { once: true });
|
1871
|
+
}
|
1872
|
+
|
1873
|
+
/**
|
1874
|
+
* @public
|
1875
|
+
*
|
1876
|
+
* @description Attach the listeners to the trigger elements of the menu
|
1877
|
+
*/
|
1878
|
+
function attachTriggerHandlers() {
|
1879
|
+
attachMobileTriggerHandler();
|
1880
|
+
Volta.menu._element.querySelectorAll('.' + _class.trigger).forEach(attachHandler);
|
1881
|
+
|
1882
|
+
function attachHandler(triggerElem) {
|
1883
|
+
triggerElem.addEventListener('click', expandMenu);
|
1884
|
+
}
|
1885
|
+
}
|
1886
|
+
|
1887
|
+
/**
|
1888
|
+
* @private
|
1889
|
+
*
|
1890
|
+
* @description Checks if the passed in menu is nested
|
1891
|
+
* @param {HTMLElement} menuItem
|
1892
|
+
* @return {boolean} If the menu item is nested returns true, otherwise false
|
1893
|
+
*/
|
1894
|
+
function checkMenuItemIsNested(menuItem) {
|
1895
|
+
return isNestedDescendant(menuItem);
|
1896
|
+
}
|
1897
|
+
|
1898
|
+
/**
|
1899
|
+
* @private
|
1900
|
+
*
|
1901
|
+
* @description Recursive function to check if the passed in menu is nested
|
1902
|
+
* @param {HTMLElement} menuItem
|
1903
|
+
* @param {Boolean} isAncestor
|
1904
|
+
* @return {boolean} If the menu item is nested returns true, otherwise false
|
1905
|
+
*/
|
1906
|
+
function isNestedDescendant(menuItem, isAncestor) {
|
1907
|
+
var isNested = false;
|
1908
|
+
var ancestor = isAncestor ? menuItem.parentElement : menuItem.parentElement.parentElement;
|
1909
|
+
var ancestorSibling = ancestor.previousElementSibling;
|
1910
|
+
|
1911
|
+
if(ancestorSibling) {
|
1912
|
+
isNested = Volta._hasClass(ancestorSibling, _class.trigger);
|
1913
|
+
}
|
1914
|
+
|
1915
|
+
if(ancestorSibling && !isNested) {
|
1916
|
+
return isNestedDescendant(ancestor, true);
|
1917
|
+
}
|
1918
|
+
|
1919
|
+
return isNested;
|
1920
|
+
}
|
1921
|
+
|
1922
|
+
/**
|
1923
|
+
* @private
|
1924
|
+
*
|
1925
|
+
* @description Attach the listeners to the trigger elements of the menu
|
1926
|
+
* @param {HTMLElement} menuItem
|
1927
|
+
* @return {boolean} If the menu item is nested returns true, otherwise false
|
1928
|
+
*/
|
1929
|
+
function closeMenu(e) {
|
1930
|
+
if(!Volta._hasClass(e.target, _class.sideMenu) && !Volta._closest(e.target, '.' + _class.sideMenu) &&
|
1931
|
+
!Volta._hasClass(e.target, _class.sideTabs) && !Volta._closest(e.target, '.' + _class.sideTabs)) {
|
1932
|
+
Volta.menu._element.classList.remove(_class.visible);
|
1933
|
+
|
1934
|
+
document.body.classList.remove(_class.mobileOpen);
|
1935
|
+
|
1936
|
+
var isMobileMenu = Volta._closest(e.target, '.' + _class.mobile);
|
1937
|
+
if(Volta._hasClass(e.target, _class.mobileTrigger) || isMobileMenu) {
|
1938
|
+
mobileMenuTriggeredTwice = true;
|
1939
|
+
}
|
1940
|
+
} else {
|
1941
|
+
addMobileMenuCollapseListeners();
|
1942
|
+
}
|
1943
|
+
}
|
1944
|
+
|
1945
|
+
/**
|
1946
|
+
* @private
|
1947
|
+
*
|
1948
|
+
* @description Expand the nested menu
|
1949
|
+
* @param {event} e
|
1950
|
+
*/
|
1951
|
+
function expandMenu(e) {
|
1952
|
+
e.preventDefault();
|
1953
|
+
e.stopPropagation();
|
1954
|
+
|
1955
|
+
var _this = this;
|
1956
|
+
|
1957
|
+
var isNestedMenu = checkMenuItemIsNested(_this);
|
1958
|
+
|
1959
|
+
if (expandedMenus.indexOf(_this) >= 0 && isNestedMenu) {
|
1960
|
+
removeMenuFromSelectedArr(_this);
|
1961
|
+
} else if(expandedMenus.indexOf(_this) >= 0) {
|
1962
|
+
removeAllMenuItemsFromSelectedArr();
|
1963
|
+
} else {
|
1964
|
+
if(!isNestedMenu) {
|
1965
|
+
removeAllMenuItemsFromSelectedArr();
|
1966
|
+
} else {
|
1967
|
+
removeSiblingFromSelectedArr(_this);
|
1968
|
+
}
|
1969
|
+
expandedMenus.push(_this);
|
1970
|
+
_this.classList.add(_class.triggerActive);
|
1971
|
+
}
|
1972
|
+
|
1973
|
+
if(Volta.menuCollapse) {
|
1974
|
+
Volta.menuCollapse.attachCloseHandler(expandedMenus);
|
1975
|
+
}
|
1976
|
+
}
|
1977
|
+
|
1978
|
+
/**
|
1979
|
+
* @public
|
1980
|
+
*
|
1981
|
+
* @description Expand the active menu - typically used on page load
|
1982
|
+
* @param {boolean} isUserForced Whether the action has been trigger by the user
|
1983
|
+
*/
|
1984
|
+
function expandActiveMenu(isUserForced) {
|
1985
|
+
var activeMenuItem = Volta.menu._element.querySelector('.' + _class.linkActive);
|
1986
|
+
|
1987
|
+
selectActiveTab(activeMenuItem);
|
1988
|
+
|
1989
|
+
if(activeMenuItem) {
|
1990
|
+
var activeTriggerUl = Volta._closest(activeMenuItem, 'ul', '.' + _class.sideMenu);
|
1991
|
+
var activeTrigger = activeTriggerUl ? activeTriggerUl.previousElementSibling : null;
|
1992
|
+
if(activeTrigger) {
|
1993
|
+
var isNestedMenu = checkMenuItemIsNested(activeTrigger);
|
1994
|
+
if(isNestedMenu) {
|
1995
|
+
addExpandedParentMenuToArr(activeTrigger);
|
1996
|
+
}
|
1997
|
+
|
1998
|
+
if(!Volta._hasClass(activeTrigger, _class.triggerActive)) {
|
1999
|
+
activeTrigger.classList.add(_class.triggerActive);
|
2000
|
+
//console.log("HEY!!!");
|
2001
|
+
}
|
2002
|
+
|
2003
|
+
expandedMenus.push(activeTrigger);
|
2004
|
+
}
|
2005
|
+
styleActiveTrigger(activeMenuItem);
|
2006
|
+
}
|
2007
|
+
}
|
2008
|
+
|
2009
|
+
/**
|
2010
|
+
* @public
|
2011
|
+
*
|
2012
|
+
* @description Initialise the menu
|
2013
|
+
* @param {boolean} menuCollapse Whether the collapse module has been included
|
2014
|
+
*/
|
2015
|
+
function initialise(menuCollapse) {
|
2016
|
+
expandedMenus = [];
|
2017
|
+
Volta.menu._element = document.querySelector(_id.menu);
|
2018
|
+
|
2019
|
+
if(Volta.menu._element) {
|
2020
|
+
if(!Volta.menuCollapse) {
|
2021
|
+
expandActiveMenu();
|
2022
|
+
} else if(menuCollapse) {
|
2023
|
+
Volta.menuCollapse.init();
|
2024
|
+
}
|
2025
|
+
|
2026
|
+
attachTriggerHandlers();
|
2027
|
+
}
|
2028
|
+
}
|
2029
|
+
|
2030
|
+
/**
|
2031
|
+
* @public
|
2032
|
+
*
|
2033
|
+
* @description Clear the selected menus array, and close all of the nested menus
|
2034
|
+
*/
|
2035
|
+
function removeAllMenuItemsFromSelectedArr(){
|
2036
|
+
expandedMenus.forEach(function(menuItem){
|
2037
|
+
menuItem.classList.remove(_class.triggerActive);
|
2038
|
+
});
|
2039
|
+
expandedMenus = [];
|
2040
|
+
}
|
2041
|
+
|
2042
|
+
/**
|
2043
|
+
* @private
|
2044
|
+
*
|
2045
|
+
* @description Remove a specific menu item from the selected array and close
|
2046
|
+
*/
|
2047
|
+
function removeMenuFromSelectedArr(menuItem) {
|
2048
|
+
var menuIndex = expandedMenus.indexOf(menuItem);
|
2049
|
+
menuItem.classList.remove(_class.triggerActive);
|
2050
|
+
expandedMenus.splice(menuIndex, 1);
|
2051
|
+
}
|
2052
|
+
|
2053
|
+
/**
|
2054
|
+
* @private
|
2055
|
+
*
|
2056
|
+
* @description Remove sibling menu item from the selected array and close
|
2057
|
+
*/
|
2058
|
+
function removeSiblingFromSelectedArr(menuItem) {
|
2059
|
+
var ancestors = menuItem.parentElement.parentElement.children;
|
2060
|
+
var openSibling;
|
2061
|
+
var count = ancestors.length - 1;
|
2062
|
+
|
2063
|
+
while(openSibling === undefined && count >= 0) {
|
2064
|
+
var siblingIndex = expandedMenus.indexOf(ancestors[count].children[0]);
|
2065
|
+
if(siblingIndex >= 0) {
|
2066
|
+
openSibling = expandedMenus[siblingIndex];
|
2067
|
+
}
|
2068
|
+
count--;
|
2069
|
+
}
|
2070
|
+
|
2071
|
+
if(openSibling) {
|
2072
|
+
removeMenuFromSelectedArr(openSibling);
|
2073
|
+
}
|
2074
|
+
}
|
2075
|
+
|
2076
|
+
/**
|
2077
|
+
* @public
|
2078
|
+
*
|
2079
|
+
* @description Select the active side tab
|
2080
|
+
* @param {activeMenuItem} Element(optional) The active menu item
|
2081
|
+
*/
|
2082
|
+
function selectActiveTab(activeMenuItem) {
|
2083
|
+
activeMenuItem = activeMenuItem || Volta.menu._element.querySelector('.' + _class.linkActive);
|
2084
|
+
var navTabs = document.querySelector(_id.menu + ' .' + _class.sideTabs);
|
2085
|
+
|
2086
|
+
if(!navTabs || !activeMenuItem) {
|
2087
|
+
return null;
|
2088
|
+
}
|
2089
|
+
|
2090
|
+
var sideMenus = Volta.menu._element.querySelectorAll('.' + _class.sideMenu);
|
2091
|
+
var menuTab = Volta._closest(activeMenuItem, '.' + _class.sideTabsPanel, '.' + _class.sideMenu);
|
2092
|
+
|
2093
|
+
var tabIndex;
|
2094
|
+
var currentNode = 0;
|
2095
|
+
|
2096
|
+
while(!tabIndex && currentNode < sideMenus.length) {
|
2097
|
+
if(sideMenus.item(currentNode) === menuTab) {
|
2098
|
+
tabIndex = currentNode;
|
2099
|
+
break;
|
2100
|
+
}
|
2101
|
+
currentNode++;
|
2102
|
+
}
|
2103
|
+
var sideTabs = Volta.menu._element.querySelectorAll('.' + _class.sideTabsLink);
|
2104
|
+
sideTabs[tabIndex].click();
|
2105
|
+
}
|
2106
|
+
|
2107
|
+
/**
|
2108
|
+
* @public
|
2109
|
+
*
|
2110
|
+
* @description Adds a class to the top level active trigger
|
2111
|
+
* @param {activeMenuItem} Element(optional) The active menu item
|
2112
|
+
*/
|
2113
|
+
function styleActiveTrigger(activeMenuItem) {
|
2114
|
+
activeMenuItem = activeMenuItem || Volta.menu._element.querySelector('.' + _class.linkActive);
|
2115
|
+
|
2116
|
+
if(activeMenuItem) {
|
2117
|
+
var topLevelTrigger = getTopLevelTrigger(activeMenuItem);
|
2118
|
+
|
2119
|
+
if(topLevelTrigger) {
|
2120
|
+
topLevelTrigger.classList.add(_class.triggerCurrent);
|
2121
|
+
}
|
2122
|
+
}
|
2123
|
+
|
2124
|
+
function getTopLevelTrigger(activeMenuItem) {
|
2125
|
+
var element = activeMenuItem;
|
2126
|
+
var trigger = null;
|
2127
|
+
|
2128
|
+
while (element) {
|
2129
|
+
if(element.matches('ul') && Volta._hasClass(element, _class.sideMenu)) {
|
2130
|
+
break;
|
2131
|
+
}
|
2132
|
+
|
2133
|
+
if (element.matches('ul')) {
|
2134
|
+
trigger = element;
|
2135
|
+
}
|
2136
|
+
|
2137
|
+
element = element.parentElement;
|
2138
|
+
}
|
2139
|
+
|
2140
|
+
return trigger ? trigger.previousElementSibling : null;
|
2141
|
+
}
|
2142
|
+
}
|
2143
|
+
}();
|
2144
|
+
|
2145
|
+
export default Volta;
|