lcms-engine 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{spec/dummy/.env.docker → .env.docker} +0 -0
- data/.env.template +34 -0
- data/.gitignore +0 -1
- data/CHANGELOG.md +25 -0
- data/Dockerfile +1 -0
- data/Gemfile +0 -1
- data/Gemfile.lock +682 -0
- data/README.md +5 -11
- data/app/assets/javascripts/lcms/engine/admin/application.js +2 -11
- data/app/assets/javascripts/lcms/engine/application.js +1 -44
- data/app/assets/javascripts/lcms/engine/application_lti.js +1 -29
- data/app/assets/javascripts/lcms/engine/initializers/foundation.js +5 -0
- data/app/assets/stylesheets/lcms/engine/admin.scss +0 -1
- data/app/assets/stylesheets/lcms/engine/application.scss +6 -61
- data/app/assets/stylesheets/lcms/engine/base/_colors.scss +2 -2
- data/app/assets/stylesheets/lcms/engine/components/lesson/_icons.scss +0 -25
- data/app/assets/stylesheets/lcms/engine/layout/_footer.scss +2 -0
- data/app/assets/stylesheets/lcms/engine/layout/_header.scss +1 -210
- data/app/assets/stylesheets/lcms/engine/pdf.scss +3 -27
- data/app/assets/stylesheets/lcms/engine/pdf_plain.scss +3 -11
- data/app/assets/stylesheets/lcms/engine/print/_typography.scss +0 -5
- data/app/assets/stylesheets/lcms/engine/utils/_variables.scss +4 -4
- data/app/controllers/concerns/lcms/engine/reimportable.rb +9 -0
- data/app/controllers/lcms/engine/admin/admin_controller.rb +2 -0
- data/app/controllers/lcms/engine/admin/documents_controller.rb +7 -17
- data/app/controllers/lcms/engine/admin/materials_controller.rb +16 -19
- data/app/controllers/lcms/engine/admin/resources_controller.rb +77 -41
- data/app/controllers/lcms/engine/surveys_controller.rb +3 -14
- data/app/forms/lcms/engine/material_form.rb +1 -0
- data/app/helpers/lcms/engine/application_helper.rb +6 -2
- data/app/helpers/lcms/engine/resource_helper.rb +0 -17
- data/app/presenters/lcms/engine/content_presenter.rb +1 -1
- data/app/presenters/lcms/engine/document_presenter.rb +3 -5
- data/app/views/devise/confirmations/new.html.erb +1 -1
- data/app/views/devise/passwords/edit.html.erb +1 -1
- data/app/views/devise/passwords/new.html.erb +1 -1
- data/app/views/devise/registrations/new.html.erb +1 -1
- data/app/views/devise/sessions/new.html.erb +2 -2
- data/app/views/layouts/lcms/engine/admin.html.erb +1 -3
- data/app/views/layouts/lcms/engine/application.html.erb +0 -6
- data/app/views/layouts/lcms/engine/cg_pdf.erb +0 -38
- data/app/views/layouts/lcms/engine/lti.html.erb +0 -1
- data/app/views/lcms/engine/admin/curriculums/edit.html.erb +3 -0
- data/app/views/lcms/engine/admin/materials/index.html.erb +1 -1
- data/app/views/lcms/engine/admin/resource_bulk_edits/new.html.erb +3 -3
- data/app/views/lcms/engine/admin/shared/_header.html.erb +1 -8
- data/app/views/lcms/engine/documents/_content.html.erb +0 -1
- data/app/views/lcms/engine/documents/_sticky_header.html.erb +1 -1
- data/app/views/lcms/engine/documents/_sticky_site_menu.html.erb +0 -1
- data/app/views/lcms/engine/resources/_download.html.erb +2 -2
- data/app/views/lcms/engine/resources/_unit_bundles.html.erb +2 -2
- data/app/views/lcms/engine/resources/show.html.erb +2 -2
- data/app/views/lcms/engine/shared/_footer.html.erb +1 -3
- data/app/views/lcms/engine/shared/_header.html.erb +2 -36
- data/app/views/lcms/engine/surveys/show.html.erb +1 -1
- data/app/views/lcms/engine/welcome/index.html.erb +1 -80
- data/config/locales/admin/en.yml +1 -0
- data/config/routes.rb +2 -36
- data/db/migrate/20200422130652_add_reimported_at_to_documents.rb +1 -1
- data/db/migrate/20200429130353_drop_pages.rb +13 -0
- data/docs/env-variables.md +87 -0
- data/docs/google-cloud-platform-setup.md +106 -0
- data/lcms-engine.gemspec +50 -59
- data/lib/doc_template/document.rb +2 -2
- data/lib/doc_template/tables/activity.rb +1 -2
- data/lib/doc_template/tables/base.rb +4 -0
- data/lib/doc_template/tables/section.rb +1 -2
- data/lib/doc_template/xpath_functions.rb +3 -1
- data/lib/lcms/engine/engine.rb +0 -8
- data/lib/lcms/engine/version.rb +1 -1
- data/lib/lt/lcms/metadata/context.rb +5 -7
- data/spec/controllers/admin/admin_controller_spec.rb +1 -1
- data/spec/controllers/admin/documents_controller_spec.rb +38 -6
- data/spec/controllers/admin/materials_controller_spec.rb +64 -0
- data/spec/controllers/admin/resources_controller_spec.rb +72 -0
- data/spec/dummy/config/lcms-admin.yml +3 -3
- data/spec/dummy/db/schema.rb +29 -37
- data/spec/features/welcome_spec.rb +1 -1
- data/spec/fixtures/tables/activity-metadata-3activities.html +1 -0
- data/spec/fixtures/tables/document-metadata-2paragpraphs.html +97 -0
- data/spec/fixtures/tables/document-metadata-2spans.html +96 -0
- data/spec/fixtures/tables/document-metadata.html +96 -0
- data/spec/lib/doc_template/tables/activity_spec.rb +28 -0
- data/spec/lib/doc_template/tables/metadata_spec.rb +40 -0
- data/spec/lib/doc_template/tables/shared_examples/remove_table.rb +11 -0
- data/spec/rails_helper.rb +1 -0
- data/spec/support/fixture_helper.rb +16 -0
- data/vendor/assets/javascripts/selectize.min.js +4 -0
- data/vendor/assets/stylesheets/selectize.scss +333 -0
- data/yarn.lock +634 -452
- metadata +274 -494
- data/app/assets/fonts/lcms/engine/caponi/CaponiSlab-Medium-Web.eot +0 -0
- data/app/assets/fonts/lcms/engine/caponi/CaponiSlab-Medium-Web.svg +0 -689
- data/app/assets/fonts/lcms/engine/caponi/CaponiSlab-Medium-Web.ttf +0 -0
- data/app/assets/fonts/lcms/engine/caponi/CaponiSlab-Medium-Web.woff +0 -0
- data/app/assets/fonts/lcms/engine/caponi/CaponiSlab-Regular-Web.eot +0 -0
- data/app/assets/fonts/lcms/engine/caponi/CaponiSlab-Regular-Web.svg +0 -697
- data/app/assets/fonts/lcms/engine/caponi/CaponiSlab-Regular-Web.ttf +0 -0
- data/app/assets/fonts/lcms/engine/caponi/CaponiSlab-Regular-Web.woff +0 -0
- data/app/assets/fonts/lcms/engine/caponi/CaponiSlab-RegularItalic-Web.eot +0 -0
- data/app/assets/fonts/lcms/engine/caponi/CaponiSlab-RegularItalic-Web.svg +0 -768
- data/app/assets/fonts/lcms/engine/caponi/CaponiSlab-RegularItalic-Web.ttf +0 -0
- data/app/assets/fonts/lcms/engine/caponi/CaponiSlab-RegularItalic-Web.woff +0 -0
- data/app/assets/fonts/lcms/engine/caponi/CaponiSlab-Semibold-Web.eot +0 -0
- data/app/assets/fonts/lcms/engine/caponi/CaponiSlab-Semibold-Web.svg +0 -685
- data/app/assets/fonts/lcms/engine/caponi/CaponiSlab-Semibold-Web.ttf +0 -0
- data/app/assets/fonts/lcms/engine/caponi/CaponiSlab-Semibold-Web.woff +0 -0
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansCond-Bold.eot +0 -0
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansCond-Bold.svg +0 -5603
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansCond-Bold.woff +0 -0
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansCond-Light.eot +0 -0
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansCond-Light.svg +0 -5763
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansCond-Light.woff +0 -0
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansCond-Medium.eot +0 -0
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansCond-Medium.otf +0 -0
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansCond-Medium.svg +0 -5400
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansCond-Medium.woff +0 -0
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansPro-Bold.eot +0 -0
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansPro-Bold.html +0 -15
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansPro-Bold.otf +0 -0
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansPro-Bold.svg +0 -13061
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansPro-Bold.woff +0 -0
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansPro-Light.eot +0 -0
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansPro-Light.html +0 -15
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansPro-Light.otf +0 -0
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansPro-Light.svg +0 -13075
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansPro-Light.woff +0 -0
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansPro-LightItalic.eot +0 -0
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansPro-LightItalic.otf +0 -0
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansPro-LightItalic.svg +0 -13142
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansPro-LightItalic.woff +0 -0
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansPro-Medium.eot +0 -0
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansPro-Medium.ttf +0 -0
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansPro-Medium.woff +0 -0
- data/app/assets/fonts/lcms/engine/centro/PFCentroSansPro-Medium.woff2 +0 -0
- data/app/assets/fonts/lcms/engine/cursive/Sriracha-Regular.ttf +0 -0
- data/app/assets/fonts/lcms/engine/icons/ubicons.eot +0 -0
- data/app/assets/fonts/lcms/engine/icons/ubicons.svg +0 -50
- data/app/assets/fonts/lcms/engine/icons/ubicons.ttf +0 -0
- data/app/assets/fonts/lcms/engine/icons/ubicons.woff +0 -0
- data/app/assets/fonts/lcms/engine/ub/UBIcons.eot +0 -0
- data/app/assets/fonts/lcms/engine/ub/UBIcons.svg +0 -18
- data/app/assets/fonts/lcms/engine/ub/UBIcons.ttf +0 -0
- data/app/assets/fonts/lcms/engine/ub/UBIcons.woff +0 -0
- data/app/assets/images/lcms/engine/lessons/ld_p1.png +0 -0
- data/app/assets/images/lcms/engine/lessons/ld_p2.png +0 -0
- data/app/assets/images/lcms/engine/lessons/ld_p3.png +0 -0
- data/app/assets/images/lcms/engine/lessons/tens.png +0 -0
- data/app/assets/images/lcms/engine/lessons/wp.svg +0 -30
- data/app/assets/images/lcms/engine/tile-wide.png +0 -0
- data/app/assets/images/lcms/engine/tile.png +0 -0
- data/app/assets/javascripts/lcms/engine/components.js +0 -7
- data/app/assets/javascripts/lcms/engine/components/.gitkeep +0 -0
- data/app/assets/javascripts/lcms/engine/components/curriculum-map/CurriculumMap.js.jsx +0 -31
- data/app/assets/javascripts/lcms/engine/components/curriculum-map/CurriculumMapLesson.js.jsx +0 -18
- data/app/assets/javascripts/lcms/engine/components/curriculum-map/CurriculumMapModule.js.jsx +0 -59
- data/app/assets/javascripts/lcms/engine/components/curriculum-map/CurriculumMapUnit.js.jsx +0 -56
- data/app/assets/javascripts/lcms/engine/components/curriculum-map/ResourceHover.js.jsx +0 -27
- data/app/assets/javascripts/lcms/engine/components/curriculum-map/ResourcePreview.js.jsx +0 -29
- data/app/assets/javascripts/lcms/engine/components/enhance-instruction/EnhanceInstructionCards.js.jsx +0 -13
- data/app/assets/javascripts/lcms/engine/components/enhance-instruction/EnhanceInstructionPage.js.jsx +0 -139
- data/app/assets/javascripts/lcms/engine/components/enhance-instruction/GenericResourceCard.js.jsx +0 -20
- data/app/assets/javascripts/lcms/engine/components/explore-curriculum/ExploreCurriculumCardItem.js.jsx +0 -152
- data/app/assets/javascripts/lcms/engine/components/explore-curriculum/ExploreCurriculumGradeMap.js.jsx +0 -44
- data/app/assets/javascripts/lcms/engine/components/explore-curriculum/ExploreCurriculumHeader.js.jsx +0 -10
- data/app/assets/javascripts/lcms/engine/components/explore-curriculum/ExploreCurriculumItem.js.jsx +0 -77
- data/app/assets/javascripts/lcms/engine/components/explore-curriculum/ExploreCurriculumModuleMap.js.jsx +0 -59
- data/app/assets/javascripts/lcms/engine/components/explore-curriculum/ExploreCurriculumOpr.js.jsx +0 -62
- data/app/assets/javascripts/lcms/engine/components/explore-curriculum/ExploreCurriculumPage.js.jsx +0 -258
- data/app/assets/javascripts/lcms/engine/components/explore-curriculum/ExploreCurriculumUnitMap.js.jsx +0 -50
- data/app/assets/javascripts/lcms/engine/components/filterbar/FilterBarResponsive.js.jsx +0 -62
- data/app/assets/javascripts/lcms/engine/components/filterbar/Filterbar.js.jsx +0 -258
- data/app/assets/javascripts/lcms/engine/components/filterbar/FilterbarFacet.js.jsx +0 -12
- data/app/assets/javascripts/lcms/engine/components/filterbar/FilterbarGrade.js.jsx +0 -14
- data/app/assets/javascripts/lcms/engine/components/filterbar/FilterbarSearch.js.jsx +0 -48
- data/app/assets/javascripts/lcms/engine/components/filterbar/FilterbarSubject.js.jsx +0 -12
- data/app/assets/javascripts/lcms/engine/components/find-lessons/FindLessonsCards.js.jsx +0 -11
- data/app/assets/javascripts/lcms/engine/components/find-lessons/FindLessonsCardsEmpty.js.jsx +0 -17
- data/app/assets/javascripts/lcms/engine/components/find-lessons/FindLessonsPage.js.jsx +0 -58
- data/app/assets/javascripts/lcms/engine/components/helpers/FreshdeskBtn.js.jsx +0 -9
- data/app/assets/javascripts/lcms/engine/components/helpers/MediaTime.js.jsx +0 -6
- data/app/assets/javascripts/lcms/engine/components/helpers/SearchResultsHeader.js.jsx +0 -41
- data/app/assets/javascripts/lcms/engine/components/helpers/TimeToTeach.js.jsx +0 -29
- data/app/assets/javascripts/lcms/engine/components/instruction-card/InstructionCard.js.jsx +0 -57
- data/app/assets/javascripts/lcms/engine/components/lesson-card/LessonCard.js.jsx +0 -45
- data/app/assets/javascripts/lcms/engine/components/materials/CollapsedMaterial.js.jsx +0 -40
- data/app/assets/javascripts/lcms/engine/components/materials/DocumentMaterialsList.js.jsx +0 -33
- data/app/assets/javascripts/lcms/engine/components/materials/ExpandedMaterial.js.jsx +0 -37
- data/app/assets/javascripts/lcms/engine/components/materials/MaterialsContainer.js.jsx +0 -92
- data/app/assets/javascripts/lcms/engine/components/materials/MaterialsList.js.jsx +0 -19
- data/app/assets/javascripts/lcms/engine/components/modals/DownloadModal.js.jsx +0 -68
- data/app/assets/javascripts/lcms/engine/components/related-instruction/RelatedInstruction.js.jsx +0 -72
- data/app/assets/javascripts/lcms/engine/components/search-dropdown/SearchDropdown.js.jsx +0 -159
- data/app/assets/javascripts/lcms/engine/components/search-dropdown/SearchDropdownResult.js.jsx +0 -12
- data/app/assets/javascripts/lcms/engine/components/search-dropdown/SearchDropdownResults.js.jsx +0 -36
- data/app/assets/javascripts/lcms/engine/components/search/SearchPage.js.jsx +0 -44
- data/app/assets/javascripts/lcms/engine/components/search/SearchResult.js.jsx +0 -22
- data/app/assets/javascripts/lcms/engine/components/search/SearchResults.js.jsx +0 -17
- data/app/assets/javascripts/lcms/engine/components/search/SearchResultsEmpty.js.jsx +0 -25
- data/app/assets/javascripts/lcms/engine/components/search/searchPageWrapper.js.jsx +0 -77
- data/app/assets/javascripts/lcms/engine/components/select-activity/SelectActivityConfirmationModal.js.jsx +0 -107
- data/app/assets/javascripts/lcms/engine/components/select-activity/SelectActivityToggle.js.jsx +0 -39
- data/app/assets/javascripts/lcms/engine/components/stores/ExcludesStore.js.jsx +0 -11
- data/app/assets/javascripts/lcms/engine/components/tabs/SimpleTab.js.jsx +0 -130
- data/app/assets/javascripts/lcms/engine/components/utils/UrlHistory.js.jsx +0 -113
- data/app/assets/javascripts/lcms/engine/components/utils/colorcodecss.js.jsx +0 -4
- data/app/assets/javascripts/lcms/engine/components/utils/converttobem.js.jsx +0 -3
- data/app/assets/javascripts/lcms/engine/components/utils/filterbarupdate.js.jsx +0 -5
- data/app/assets/javascripts/lcms/engine/components/utils/heaptrackpd.js.jsx +0 -5
- data/app/assets/javascripts/lcms/engine/components/utils/regexpescape.js.jsx +0 -5
- data/app/assets/javascripts/lcms/engine/components/utils/scalenumber.js.jsx +0 -8
- data/app/assets/javascripts/lcms/engine/initializers/about_people.js +0 -8
- data/app/assets/javascripts/lcms/engine/initializers/analytics.js +0 -10
- data/app/assets/javascripts/lcms/engine/initializers/bundles.js +0 -12
- data/app/assets/javascripts/lcms/engine/initializers/events.js +0 -3
- data/app/assets/javascripts/lcms/engine/initializers/freshdesk.js +0 -18
- data/app/assets/javascripts/lcms/engine/initializers/header_dropdown.js +0 -44
- data/app/assets/javascripts/lcms/engine/initializers/heap_analytics.js +0 -78
- data/app/assets/javascripts/lcms/engine/initializers/leadership.js +0 -22
- data/app/assets/javascripts/lcms/engine/initializers/lessons.js +0 -299
- data/app/assets/javascripts/lcms/engine/initializers/loadasync.js +0 -30
- data/app/assets/javascripts/lcms/engine/initializers/pdf_preview.js +0 -15
- data/app/assets/javascripts/lcms/engine/initializers/resource_details.js +0 -21
- data/app/assets/javascripts/lcms/engine/initializers/sidebar/SideBar.js.jsx +0 -86
- data/app/assets/javascripts/lcms/engine/initializers/sidebar/SidebarCGMenu.js.jsx +0 -37
- data/app/assets/javascripts/lcms/engine/initializers/sidebar/SidebarDocMenu.js.jsx +0 -75
- data/app/assets/javascripts/lcms/engine/initializers/sidebar/SidebarMobile.js.jsx +0 -43
- data/app/assets/javascripts/lcms/engine/initializers/sidebar/SidebarSticky.js.jsx +0 -43
- data/app/assets/javascripts/lcms/engine/initializers/sidebar/TopScroll.js.jsx +0 -21
- data/app/assets/javascripts/lcms/engine/initializers/social_sharing.js +0 -29
- data/app/assets/javascripts/lcms/engine/initializers/soundcloud.js +0 -52
- data/app/assets/javascripts/lcms/engine/initializers/subscribe_placeholder.js +0 -12
- data/app/assets/javascripts/lcms/engine/initializers/survey.js +0 -31
- data/app/assets/stylesheets/lcms/engine/base/_cg-colors.scss +0 -48
- data/app/assets/stylesheets/lcms/engine/base/_fonts.scss +0 -103
- data/app/assets/stylesheets/lcms/engine/base/_icons.scss +0 -342
- data/app/assets/stylesheets/lcms/engine/components/_buttons.scss +0 -200
- data/app/assets/stylesheets/lcms/engine/components/_cards.scss +0 -36
- data/app/assets/stylesheets/lcms/engine/components/_cg-base.scss +0 -22
- data/app/assets/stylesheets/lcms/engine/components/_curriculum-cards.scss +0 -237
- data/app/assets/stylesheets/lcms/engine/components/_curriculum-map.scss +0 -214
- data/app/assets/stylesheets/lcms/engine/components/_download-modal.scss +0 -56
- data/app/assets/stylesheets/lcms/engine/components/_filterbar-modal.scss +0 -20
- data/app/assets/stylesheets/lcms/engine/components/_filterbar.scss +0 -184
- data/app/assets/stylesheets/lcms/engine/components/_generic-resource.scss +0 -58
- data/app/assets/stylesheets/lcms/engine/components/_inputs.scss +0 -12
- data/app/assets/stylesheets/lcms/engine/components/_instruction-cards.scss +0 -160
- data/app/assets/stylesheets/lcms/engine/components/_lesson-base.scss +0 -31
- data/app/assets/stylesheets/lcms/engine/components/_lesson-cards.scss +0 -119
- data/app/assets/stylesheets/lcms/engine/components/_ls-post.scss +0 -38
- data/app/assets/stylesheets/lcms/engine/components/_material-base.scss +0 -6
- data/app/assets/stylesheets/lcms/engine/components/_media-resources.scss +0 -6
- data/app/assets/stylesheets/lcms/engine/components/_media.scss +0 -95
- data/app/assets/stylesheets/lcms/engine/components/_pagination.scss +0 -84
- data/app/assets/stylesheets/lcms/engine/components/_panel-dsc.scss +0 -37
- data/app/assets/stylesheets/lcms/engine/components/_panel.scss +0 -7
- data/app/assets/stylesheets/lcms/engine/components/_related-instruction.scss +0 -31
- data/app/assets/stylesheets/lcms/engine/components/_resource.scss +0 -217
- data/app/assets/stylesheets/lcms/engine/components/_search-dropdown.scss +0 -23
- data/app/assets/stylesheets/lcms/engine/components/_search-header.scss +0 -45
- data/app/assets/stylesheets/lcms/engine/components/_search.scss +0 -57
- data/app/assets/stylesheets/lcms/engine/components/_sidebar.scss +0 -159
- data/app/assets/stylesheets/lcms/engine/components/_simple-tab.scss +0 -57
- data/app/assets/stylesheets/lcms/engine/components/_social-sharing.scss +0 -20
- data/app/assets/stylesheets/lcms/engine/components/_titles.scss +0 -33
- data/app/assets/stylesheets/lcms/engine/components/_top-scroll-button.scss +0 -28
- data/app/assets/stylesheets/lcms/engine/components/_unit-bundles.scss +0 -14
- data/app/assets/stylesheets/lcms/engine/components/cg/_annotations.scss +0 -48
- data/app/assets/stylesheets/lcms/engine/components/cg/_colorscheme.scss +0 -60
- data/app/assets/stylesheets/lcms/engine/components/cg/_contents-modal.scss +0 -20
- data/app/assets/stylesheets/lcms/engine/components/cg/_elements.scss +0 -11
- data/app/assets/stylesheets/lcms/engine/components/cg/_faq.scss +0 -35
- data/app/assets/stylesheets/lcms/engine/components/cg/_footnote.scss +0 -20
- data/app/assets/stylesheets/lcms/engine/components/cg/_hacks.scss +0 -11
- data/app/assets/stylesheets/lcms/engine/components/cg/_icons.scss +0 -30
- data/app/assets/stylesheets/lcms/engine/components/cg/_keywords.scss +0 -5
- data/app/assets/stylesheets/lcms/engine/components/cg/_links.scss +0 -3
- data/app/assets/stylesheets/lcms/engine/components/cg/_quotes.scss +0 -18
- data/app/assets/stylesheets/lcms/engine/components/cg/_standards.scss +0 -23
- data/app/assets/stylesheets/lcms/engine/components/cg/_table.scss +0 -50
- data/app/assets/stylesheets/lcms/engine/components/cg/_task.scss +0 -43
- data/app/assets/stylesheets/lcms/engine/components/cg/_video.scss +0 -10
- data/app/assets/stylesheets/lcms/engine/components/support/_helpdesk.scss +0 -25
- data/app/assets/stylesheets/lcms/engine/freshdesk/base/_colors.scss +0 -25
- data/app/assets/stylesheets/lcms/engine/freshdesk/base/_typography.scss +0 -19
- data/app/assets/stylesheets/lcms/engine/freshdesk/components/_block.scss +0 -5
- data/app/assets/stylesheets/lcms/engine/freshdesk/components/_buttons.scss +0 -5
- data/app/assets/stylesheets/lcms/engine/freshdesk/components/_help-center.scss +0 -59
- data/app/assets/stylesheets/lcms/engine/freshdesk/components/_tabs.scss +0 -33
- data/app/assets/stylesheets/lcms/engine/freshdesk/freshdesk.scss +0 -42
- data/app/assets/stylesheets/lcms/engine/freshdesk/layout/_footer.scss +0 -44
- data/app/assets/stylesheets/lcms/engine/freshdesk/layout/_header.scss +0 -49
- data/app/assets/stylesheets/lcms/engine/freshdesk/layout/_page.scss +0 -40
- data/app/assets/stylesheets/lcms/engine/freshdesk/layout/footer.liquid +0 -14
- data/app/assets/stylesheets/lcms/engine/freshdesk/layout/header.liquid +0 -41
- data/app/assets/stylesheets/lcms/engine/freshdesk/layout/page.liquid +0 -22
- data/app/assets/stylesheets/lcms/engine/freshdesk/pages/_portal-home.scss +0 -18
- data/app/assets/stylesheets/lcms/engine/freshdesk/pages/portal.home.liquid +0 -74
- data/app/assets/stylesheets/lcms/engine/freshdesk/themes/_settings.scss +0 -19
- data/app/assets/stylesheets/lcms/engine/freshdesk/utils/_breakpoint.scss +0 -288
- data/app/assets/stylesheets/lcms/engine/freshdesk/utils/_helpers.scss +0 -22
- data/app/assets/stylesheets/lcms/engine/freshdesk/utils/_unit.scss +0 -95
- data/app/assets/stylesheets/lcms/engine/freshdesk/utils/_value.scss +0 -138
- data/app/assets/stylesheets/lcms/engine/layout/_connect.scss +0 -63
- data/app/assets/stylesheets/lcms/engine/layout/_header-search-form.scss +0 -30
- data/app/assets/stylesheets/lcms/engine/layout/_sticky-header.scss +0 -179
- data/app/assets/stylesheets/lcms/engine/layout/_sticky-navigation.scss +0 -124
- data/app/assets/stylesheets/lcms/engine/layout/_subscribe.scss +0 -68
- data/app/assets/stylesheets/lcms/engine/pages/_about-people.scss +0 -115
- data/app/assets/stylesheets/lcms/engine/pages/_about.scss +0 -61
- data/app/assets/stylesheets/lcms/engine/pages/_content-guide.scss +0 -205
- data/app/assets/stylesheets/lcms/engine/pages/_enhance-instruction.scss +0 -19
- data/app/assets/stylesheets/lcms/engine/pages/_explore-curriculum.scss +0 -46
- data/app/assets/stylesheets/lcms/engine/pages/_find-lessons.scss +0 -1
- data/app/assets/stylesheets/lcms/engine/pages/_home.scss +0 -237
- data/app/assets/stylesheets/lcms/engine/pages/_leadership.scss +0 -263
- data/app/assets/stylesheets/lcms/engine/pages/_lesson-document.scss +0 -138
- data/app/assets/stylesheets/lcms/engine/pages/_unsupported.scss +0 -18
- data/app/assets/stylesheets/lcms/engine/print/_b64-fonts.scss.erb +0 -65
- data/app/assets/stylesheets/lcms/engine/print/_cg-base.scss +0 -4
- data/app/assets/stylesheets/lcms/engine/print/_hacks.scss +0 -6
- data/app/assets/stylesheets/lcms/engine/print/cg/_base-typography.scss +0 -21
- data/app/assets/stylesheets/lcms/engine/print/cg/_breaks.scss +0 -7
- data/app/assets/stylesheets/lcms/engine/print/cg/_elements-typography.scss +0 -14
- data/app/assets/stylesheets/lcms/engine/vendors/swiper.css +0 -547
- data/app/controllers/concerns/lcms/engine/analytics_tracking.rb +0 -51
- data/app/controllers/concerns/lcms/engine/heap_notifyable.rb +0 -20
- data/app/controllers/lcms/engine/admin/configurable_admin.rb +0 -56
- data/app/controllers/lcms/engine/admin/google_oauth2_controller.rb +0 -15
- data/app/controllers/lcms/engine/admin/pages_controller.rb +0 -54
- data/app/controllers/lcms/engine/analytics_exclusion_controller.rb +0 -14
- data/app/controllers/lcms/engine/downloads_controller.rb +0 -50
- data/app/controllers/lcms/engine/enhance_instruction_controller.rb +0 -18
- data/app/controllers/lcms/engine/explore_curriculum_controller.rb +0 -28
- data/app/controllers/lcms/engine/find_lessons_controller.rb +0 -15
- data/app/controllers/lcms/engine/pages_controller.rb +0 -26
- data/app/controllers/lcms/engine/search_controller.rb +0 -15
- data/app/controllers/lcms/engine/sessions_controller.rb +0 -19
- data/app/models/lcms/engine/page.rb +0 -13
- data/app/services/lcms/engine/generate_thumbnails.rb +0 -54
- data/app/services/lcms/engine/svg_social_thumbnail.rb +0 -223
- data/app/views/layouts/lcms/engine/ld_docx.html.erb +0 -16
- data/app/views/lcms/engine/admin/pages/_form.html.erb +0 -8
- data/app/views/lcms/engine/admin/pages/edit.html.erb +0 -9
- data/app/views/lcms/engine/admin/pages/index.html.erb +0 -25
- data/app/views/lcms/engine/admin/pages/new.html.erb +0 -5
- data/app/views/lcms/engine/documents/_helpdesk.html.erb +0 -9
- data/app/views/lcms/engine/pages/_about_people_staff.html.erb +0 -27
- data/app/views/lcms/engine/pages/_leadership_in_action.html.erb +0 -25
- data/app/views/lcms/engine/pages/_leadership_why_i_lead.html.erb +0 -34
- data/app/views/lcms/engine/pages/about.html.erb +0 -87
- data/app/views/lcms/engine/pages/about_people.html.erb +0 -27
- data/app/views/lcms/engine/pages/forthcoming.html.erb +0 -9
- data/app/views/lcms/engine/pages/leadership.html.erb +0 -82
- data/app/views/lcms/engine/pages/not_found.html.erb +0 -9
- data/app/views/lcms/engine/pages/privacy.html.erb +0 -9
- data/app/views/lcms/engine/pages/show.html.erb +0 -8
- data/app/views/lcms/engine/pages/show_slug.html.erb +0 -0
- data/app/views/lcms/engine/pages/tos.html.erb +0 -9
- data/app/views/lcms/engine/shared/_connect.html.erb +0 -60
- data/app/views/lcms/engine/shared/_freshdesk.html.erb +0 -22
- data/app/views/lcms/engine/shared/_google_analytics.html.erb +0 -9
- data/app/views/lcms/engine/shared/_heap_analytics.html.erb +0 -7
- data/app/views/lcms/engine/shared/_open_graph_meta.html.erb +0 -15
- data/app/views/lcms/engine/shared/_open_graph_meta_js.html.erb +0 -39
- data/app/views/lcms/engine/shared/_search_form.html.erb +0 -10
- data/app/views/lcms/engine/shared/_social_sharing_menu.html.erb +0 -34
- data/app/views/lcms/engine/shared/_subscribe.html.erb +0 -30
- data/app/views/lcms/engine/shared/_unsupported.html.erb +0 -3
- data/app/views/lcms/engine/shared/social_thumbnail.svg.erb +0 -54
- data/config/initializers/heap.rb +0 -3
- data/lib/tasks/thumbnails.rake +0 -59
- data/spec/controllers/admin/pages_controller_spec.rb +0 -19
- data/spec/controllers/enhance_instruction_controller_spec.rb +0 -15
- data/spec/controllers/explore_curriculum_controller_spec.rb +0 -29
- data/spec/controllers/find_lessons_controller_spec.rb +0 -50
- data/spec/controllers/pages_controller_spec.rb +0 -32
- data/spec/controllers/search_controller_spec.rb +0 -16
- data/spec/factories/pages.rb +0 -21
- data/spec/features/admin/pages_spec.rb +0 -79
- data/spec/features/pages/page_not_found_spec.rb +0 -26
- data/spec/features/pages/page_titles_spec.rb +0 -86
- data/spec/support/heap.rb +0 -3
- data/vendor/assets/javascripts/foundation.initialize.js +0 -115
- data/vendor/assets/javascripts/foundation.magellanex.js +0 -335
- data/vendor/assets/javascripts/freshwidget.js +0 -1
- data/vendor/assets/javascripts/jquery.easytabs.js +0 -704
- data/vendor/assets/javascripts/jquery.hashchange.js +0 -9
- data/vendor/assets/javascripts/modernizr-custom.js +0 -3
- data/vendor/assets/javascripts/smoothscrolling.js +0 -22
- data/vendor/assets/javascripts/swiper.jquery.js +0 -3777
- data/vendor/assets/javascripts/tabs.js +0 -6
@@ -1,25 +0,0 @@
|
|
1
|
-
function SearchResultsEmpty(props) {
|
2
|
-
const contact = "Contact Us";
|
3
|
-
return (
|
4
|
-
<div className='o-search-results__empty'>
|
5
|
-
<h2>Sorry, No Results were found for "{props.searchTerm}"</h2>
|
6
|
-
<br/>
|
7
|
-
<h3 className='u-text--large'>Suggestions</h3>
|
8
|
-
<ul>
|
9
|
-
<li>Check your spelling</li>
|
10
|
-
<li>Try using fewer filters</li>
|
11
|
-
<li>Try more general Terms</li>
|
12
|
-
</ul>
|
13
|
-
|
14
|
-
<hr />
|
15
|
-
|
16
|
-
<h3 className='u-text--large'>Or, Maybe We Can Help</h3>
|
17
|
-
|
18
|
-
<ul>
|
19
|
-
<li><a href={Routes.lcms_engine_explore_curriculum_index_path()}>Explore Our Curriculum</a></li>
|
20
|
-
<li><a href={Routes.lcms_engine_find_lessons_path()}>Find Lessons in our Library</a></li>
|
21
|
-
<li><FreshdeskBtn text={contact} /></li>
|
22
|
-
</ul>
|
23
|
-
</div>
|
24
|
-
);
|
25
|
-
}
|
@@ -1,77 +0,0 @@
|
|
1
|
-
// eslint-disable-next-line no-unused-vars
|
2
|
-
function searchPageWrapper(WrappedComponent) {
|
3
|
-
return class extends React.Component {
|
4
|
-
constructor(props) {
|
5
|
-
super(props);
|
6
|
-
|
7
|
-
this.state = this.buildStateFromProps(props);
|
8
|
-
}
|
9
|
-
|
10
|
-
buildStateFromProps(props) {
|
11
|
-
return {
|
12
|
-
data: props.results,
|
13
|
-
per_page: props.pagination.per_page,
|
14
|
-
order: props.pagination.order,
|
15
|
-
current_page: props.pagination.current_page,
|
16
|
-
total_pages: props.pagination.total_pages,
|
17
|
-
num_items: props.pagination.num_items,
|
18
|
-
total_hits: props.pagination.total_hits,
|
19
|
-
filterbar: props.filterbar,
|
20
|
-
};
|
21
|
-
}
|
22
|
-
|
23
|
-
fetch(newState) {
|
24
|
-
const url = Routes.lcms_engine_search_path({
|
25
|
-
per_page: newState.per_page,
|
26
|
-
order: newState.order,
|
27
|
-
page: newState.current_page,
|
28
|
-
...newState.filterbar,
|
29
|
-
});
|
30
|
-
return $.getJSON(url).then(response => {
|
31
|
-
if (window.ga) {
|
32
|
-
ga('send', 'pageview', url);
|
33
|
-
}
|
34
|
-
this.setState(this.buildStateFromProps(response));
|
35
|
-
});
|
36
|
-
}
|
37
|
-
|
38
|
-
handlePageClick(data) {
|
39
|
-
let selected = data.selected;
|
40
|
-
const newState = _.assign({}, this.state, { current_page: selected + 1 });
|
41
|
-
this.fetch(newState);
|
42
|
-
}
|
43
|
-
|
44
|
-
componentWillUpdate(nextProps, nextState) {
|
45
|
-
urlHistory.updatePaginationParams(nextState);
|
46
|
-
}
|
47
|
-
|
48
|
-
pagination() {
|
49
|
-
return (<PaginationBoxView previousLabel={<i className="fa-2x ub-angle-left"></i>}
|
50
|
-
nextLabel={<i className="fa-2x ub-angle-right"></i>}
|
51
|
-
breakLabel={<li className="o-pagination__break">...</li>}
|
52
|
-
pageNum={this.state.total_pages}
|
53
|
-
initialSelected={this.state.current_page - 1}
|
54
|
-
forceSelected={this.state.current_page - 1}
|
55
|
-
marginPagesDisplayed={2}
|
56
|
-
pageRangeDisplayed={5}
|
57
|
-
clickCallback={this.handlePageClick.bind(this)}
|
58
|
-
containerClassName={'o-pagination o-page__wrap--row-nest'}
|
59
|
-
itemClassName={'o-pagination__item'}
|
60
|
-
nextClassName={'o-pagination__item--next'}
|
61
|
-
previousClassName={'o-pagination__item--prev'}
|
62
|
-
pagesClassName={'o-pagination__item--middle'}
|
63
|
-
subContainerClassName={'o-pagination__pages'}
|
64
|
-
activeClassName={'o-pagination__page--active'} />);
|
65
|
-
}
|
66
|
-
|
67
|
-
render() {
|
68
|
-
return(
|
69
|
-
<WrappedComponent { ...this.state }
|
70
|
-
// eslint-disable-next-line no-undef
|
71
|
-
handleFilterBar={ handleFilterbarUpdate.bind(this) }
|
72
|
-
pagination={ this.pagination() }
|
73
|
-
/>
|
74
|
-
);
|
75
|
-
}
|
76
|
-
};
|
77
|
-
}
|
@@ -1,107 +0,0 @@
|
|
1
|
-
// eslint-disable-next-line no-unused-vars
|
2
|
-
class SelectActivityConfirmationModal extends React.Component {
|
3
|
-
constructor(props) {
|
4
|
-
super(props);
|
5
|
-
|
6
|
-
this.heapTracked = false;
|
7
|
-
this.expanded = false;
|
8
|
-
this.track = this.track.bind(this);
|
9
|
-
|
10
|
-
this.textLengthFull = this.props.text.length;
|
11
|
-
}
|
12
|
-
|
13
|
-
clickKeep() {
|
14
|
-
this.track('Kept');
|
15
|
-
this.$modal.close();
|
16
|
-
}
|
17
|
-
|
18
|
-
clickRemove() {
|
19
|
-
this.track('Deselected');
|
20
|
-
this.props.callback();
|
21
|
-
this.$modal.close();
|
22
|
-
|
23
|
-
let header = document.querySelector('.sticky.is-stuck');
|
24
|
-
let offset = header ? header.clientHeight : 0;
|
25
|
-
$('html, body').animate({
|
26
|
-
scrollTop: $(document.getElementById(this.props.item.id)).offset().top - offset - 10
|
27
|
-
}, 'fast');
|
28
|
-
}
|
29
|
-
|
30
|
-
closeModal() {
|
31
|
-
this.heapTracked || this.track('Close');
|
32
|
-
this.heapTracked = false; // restore state
|
33
|
-
}
|
34
|
-
|
35
|
-
componentDidMount() {
|
36
|
-
if (!this.body) return;
|
37
|
-
|
38
|
-
const $body = $(this.body);
|
39
|
-
|
40
|
-
$body.on('open.zf.reveal', () => {
|
41
|
-
let innerText = this.text.querySelector('.js-text');
|
42
|
-
if (!innerText) return;
|
43
|
-
|
44
|
-
if (this.text.scrollHeight > this.text.clientHeight) {
|
45
|
-
let chunks = this.props.text.trim().split(/\s+/);
|
46
|
-
while (this.text.scrollHeight > this.text.clientHeight) {
|
47
|
-
chunks.splice(chunks.length - 1, 1);
|
48
|
-
innerText.textContent = chunks.join(' ');
|
49
|
-
}
|
50
|
-
innerText.classList.remove('js-text');
|
51
|
-
this.textLengthShort = innerText.textContent.length;
|
52
|
-
} else {
|
53
|
-
this.text.textContent = this.props.text;
|
54
|
-
}
|
55
|
-
});
|
56
|
-
|
57
|
-
$body.on('closed.zf.reveal', this.closeModal.bind(this));
|
58
|
-
|
59
|
-
if (this.props.item.isOptional) {
|
60
|
-
this.props.callback();
|
61
|
-
} else {
|
62
|
-
this.$modal = new Foundation.Reveal($body);
|
63
|
-
this.$modal.$element.on('click', '.js-confirm', this.clickRemove.bind(this));
|
64
|
-
this.$modal.$element.on('click', '.js-expand', this.expandText.bind(this));
|
65
|
-
this.$modal.$element.on('click', '.js-keep', this.clickKeep.bind(this));
|
66
|
-
}
|
67
|
-
}
|
68
|
-
|
69
|
-
expandText() {
|
70
|
-
setTimeout(() => {
|
71
|
-
this.text.classList.add('o-ld-selection-modal__content--expanded');
|
72
|
-
this.text.textContent = this.props.text;
|
73
|
-
this.expanded = true;
|
74
|
-
this.track('Learn More');
|
75
|
-
this.heapTracked = false; // ^^ is not a final event
|
76
|
-
});
|
77
|
-
}
|
78
|
-
|
79
|
-
render() {
|
80
|
-
const modalId = `confirm-${this.props.item.id}`;
|
81
|
-
|
82
|
-
return (
|
83
|
-
<div className="o-ld-selection-modal reveal" data-reveal id={modalId} ref={x => this.body = x}>
|
84
|
-
<h1 className="o-ld-selection-modal__title">Before removing, consider the activity's purpose:</h1>
|
85
|
-
<div className="u-hr-small" />
|
86
|
-
<p className="o-ld-selection-modal__content" ref={x => this.text = x}>
|
87
|
-
<span className="js-text">{this.props.text}</span>
|
88
|
-
<span className="u-margin-left--xs js-ellipsis">
|
89
|
-
...
|
90
|
-
<a className="cs-txt-link--dark-gold js-expand u-margin-left--xs" href="javascript:">Read More</a>
|
91
|
-
</span>
|
92
|
-
</p>
|
93
|
-
<div className="u-text--right">
|
94
|
-
<button className="js-confirm o-btn o-btn--xs-full o-btn--bordered-yellow u-color--base u-margin-right--base" type="button">Remove Activity</button>
|
95
|
-
<button className="js-keep o-btn o-btn--yellow o-btn--xs-full" type="button">Keep Activity</button>
|
96
|
-
</div>
|
97
|
-
</div>
|
98
|
-
);
|
99
|
-
}
|
100
|
-
|
101
|
-
track(event, extras = {}) {
|
102
|
-
if (!this.props.heapEnabled) return;
|
103
|
-
this.heapTracked = true;
|
104
|
-
const data = _.extend(extras, { textLengthShort: this.textLengthShort, textLengthFull: this.props.text.length });
|
105
|
-
heapTrack(`Activity ${event}`, { id: this.props.item.id, learnMore: this.expanded, ...data });
|
106
|
-
}
|
107
|
-
}
|
data/app/assets/javascripts/lcms/engine/components/select-activity/SelectActivityToggle.js.jsx
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
// eslint-disable-next-line no-unused-vars
|
2
|
-
class SelectActivityToggle extends React.Component {
|
3
|
-
constructor(props) {
|
4
|
-
super(props);
|
5
|
-
|
6
|
-
this.toggle = this.toggle.bind(this);
|
7
|
-
this.modalText = [
|
8
|
-
this.props.preface ? this.props.preface.textContent : null,
|
9
|
-
this.props.meta ? this.props.meta.textContent : null,
|
10
|
-
].filter(x => !!x).join(' ');
|
11
|
-
}
|
12
|
-
|
13
|
-
render() {
|
14
|
-
return (
|
15
|
-
<div className="o-ld-selection">
|
16
|
-
<div className="o-ld-selection__switch" onClick={this.toggle}></div>
|
17
|
-
<span className="o-ld-selection__label" onClick={this.toggle}>Use Activity</span>
|
18
|
-
{ this.props.item.active && <SelectActivityConfirmationModal text={this.modalText} { ...this.props } /> }
|
19
|
-
</div>
|
20
|
-
);
|
21
|
-
}
|
22
|
-
|
23
|
-
toggle() {
|
24
|
-
const item = this.props.item;
|
25
|
-
if (item.active && this.modalText) {
|
26
|
-
if (item.isOptional) {
|
27
|
-
heapTrack('Optional Activity Enabled', { id: item.id});
|
28
|
-
this.props.callback();
|
29
|
-
} else {
|
30
|
-
heapTrack('Click to Deselect Activity', { id: item.id });
|
31
|
-
$(document.getElementById(`confirm-${item.id}`)).foundation('open');
|
32
|
-
}
|
33
|
-
} else {
|
34
|
-
const event = item.isOptional ? 'Optional Activity Disabled' : 'Activity Selected';
|
35
|
-
heapTrack(event, { id: item.id });
|
36
|
-
this.props.callback();
|
37
|
-
}
|
38
|
-
}
|
39
|
-
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
/* eslint-disable no-unused-vars, no-undef */
|
2
|
-
let excludesStore = _.extend({}, EventEmitter.prototype, {
|
3
|
-
updateMaterialsList: function(excludes) {
|
4
|
-
this.excludes = excludes;
|
5
|
-
this.emit('upd_materials');
|
6
|
-
},
|
7
|
-
|
8
|
-
getState: function() {
|
9
|
-
return this.excludes || [];
|
10
|
-
}
|
11
|
-
});
|
@@ -1,130 +0,0 @@
|
|
1
|
-
// copy with just changes css classes from https://github.com/pedronauck/react-simpletabs
|
2
|
-
// eslint-disable-next-line no-undef
|
3
|
-
const Tabs = createReactClass({
|
4
|
-
displayName: 'Tabs',
|
5
|
-
propTypes: {
|
6
|
-
className: PropTypes.oneOfType([
|
7
|
-
PropTypes.array,
|
8
|
-
PropTypes.string,
|
9
|
-
PropTypes.object
|
10
|
-
]),
|
11
|
-
tabActive: PropTypes.number,
|
12
|
-
onMount: PropTypes.func,
|
13
|
-
onBeforeChange: PropTypes.func,
|
14
|
-
onAfterChange: PropTypes.func,
|
15
|
-
children: PropTypes.oneOfType([
|
16
|
-
PropTypes.array,
|
17
|
-
PropTypes.element
|
18
|
-
]).isRequired
|
19
|
-
},
|
20
|
-
getDefaultProps () {
|
21
|
-
return { tabActive: 1 };
|
22
|
-
},
|
23
|
-
getInitialState () {
|
24
|
-
return {
|
25
|
-
tabActive: this.props.tabActive
|
26
|
-
};
|
27
|
-
},
|
28
|
-
componentDidMount() {
|
29
|
-
const index = this.state.tabActive;
|
30
|
-
const $selectedPanel = this.refs['o-tab__panel'];
|
31
|
-
const $selectedMenu = this.refs[`o-tab-menu-${index}`];
|
32
|
-
|
33
|
-
if (this.props.onMount) {
|
34
|
-
this.props.onMount(index, $selectedPanel, $selectedMenu);
|
35
|
-
}
|
36
|
-
},
|
37
|
-
componentWillReceiveProps: function(newProps){
|
38
|
-
if(newProps.tabActive && newProps.tabActive !== this.props.tabActive){
|
39
|
-
this.setState({ tabActive: newProps.tabActive });
|
40
|
-
}
|
41
|
-
},
|
42
|
-
render () {
|
43
|
-
const className = classNames('o-tab', this.props.className);
|
44
|
-
return (
|
45
|
-
<div className={className}>
|
46
|
-
{this._getMenuItems()}
|
47
|
-
{this._getSelectedPanel()}
|
48
|
-
</div>
|
49
|
-
);
|
50
|
-
},
|
51
|
-
setActive(index, e) {
|
52
|
-
e.preventDefault();
|
53
|
-
|
54
|
-
const onAfterChange = this.props.onAfterChange;
|
55
|
-
const onBeforeChange = this.props.onBeforeChange;
|
56
|
-
const $selectedPanel = this.refs['o-tab__panel'];
|
57
|
-
const $selectedTabMenu = this.refs[`o-tab-menu-${index}`];
|
58
|
-
|
59
|
-
if (onBeforeChange) {
|
60
|
-
const cancel = onBeforeChange(index, $selectedPanel, $selectedTabMenu);
|
61
|
-
if(cancel === false){ return; }
|
62
|
-
}
|
63
|
-
|
64
|
-
this.setState({ tabActive: index }, () => {
|
65
|
-
if (onAfterChange) {
|
66
|
-
onAfterChange(index, $selectedPanel, $selectedTabMenu);
|
67
|
-
}
|
68
|
-
});
|
69
|
-
},
|
70
|
-
_getMenuItems () {
|
71
|
-
if (!this.props.children) {
|
72
|
-
throw new Error('Tabs must contain at least one Tabs.Panel');
|
73
|
-
}
|
74
|
-
|
75
|
-
if (!Array.isArray(this.props.children)) {
|
76
|
-
this.props.children = [this.props.children];
|
77
|
-
}
|
78
|
-
|
79
|
-
const $menuItems = this.props.children
|
80
|
-
.map($panel => typeof $panel === 'function' ? $panel() : $panel)
|
81
|
-
.filter($panel => $panel)
|
82
|
-
.map(($panel, index) => {
|
83
|
-
const ref = `o-tab-menu-${index + 1}`;
|
84
|
-
const title = $panel.props.title;
|
85
|
-
const classes = classNames(
|
86
|
-
'o-tab-menu__item',
|
87
|
-
{ 'o-tab-menu__item--active': this.state.tabActive === (index + 1) }
|
88
|
-
);
|
89
|
-
|
90
|
-
return (
|
91
|
-
<li ref={ref} key={index} className={classes}>
|
92
|
-
<a onClick={this.setActive.bind(this, index + 1)} className="u-preserve-style">
|
93
|
-
{title}
|
94
|
-
</a>
|
95
|
-
</li>
|
96
|
-
);
|
97
|
-
});
|
98
|
-
|
99
|
-
return (
|
100
|
-
<nav className="o-tab__navigation">
|
101
|
-
<ul className="o-tab-menu">{$menuItems}</ul>
|
102
|
-
</nav>
|
103
|
-
);
|
104
|
-
},
|
105
|
-
_getSelectedPanel () {
|
106
|
-
const index = this.state.tabActive - 1;
|
107
|
-
const $panel = this.props.children[index];
|
108
|
-
|
109
|
-
return (
|
110
|
-
<div ref="o-tab__panel" className="o-tab__panel">
|
111
|
-
{$panel}
|
112
|
-
</div>
|
113
|
-
);
|
114
|
-
}
|
115
|
-
});
|
116
|
-
|
117
|
-
// eslint-disable-next-line no-undef
|
118
|
-
Tabs.Panel = createReactClass({
|
119
|
-
displayName: 'Panel',
|
120
|
-
propTypes: {
|
121
|
-
title: PropTypes.string.isRequired,
|
122
|
-
children: PropTypes.oneOfType([
|
123
|
-
PropTypes.array,
|
124
|
-
PropTypes.element
|
125
|
-
]).isRequired
|
126
|
-
},
|
127
|
-
render () {
|
128
|
-
return <div>{this.props.children}</div>;
|
129
|
-
}
|
130
|
-
});
|
@@ -1,113 +0,0 @@
|
|
1
|
-
window.urlHistory = (function() {
|
2
|
-
|
3
|
-
let state = {};
|
4
|
-
|
5
|
-
let hasStateBeenConstructedFromTheUrl = false;
|
6
|
-
|
7
|
-
let update = function(newState, options) {
|
8
|
-
// options:
|
9
|
-
// skipKey: function which returns if a key should be skiped or not
|
10
|
-
// replace: if true uses replaceState instead the default pushState
|
11
|
-
|
12
|
-
// Initialize state from the query string.
|
13
|
-
if (!hasStateBeenConstructedFromTheUrl) {
|
14
|
-
let qs = window.location.search.slice(1); // Remove leading '?'.
|
15
|
-
let pairs = qs.split('&');
|
16
|
-
|
17
|
-
_.forEach(pairs, function(pair) {
|
18
|
-
pair = pair.split('=');
|
19
|
-
let key = pair[0];
|
20
|
-
let values = decodeURIComponent(pair[1] || '').split(',');
|
21
|
-
|
22
|
-
if( state[key] ) {
|
23
|
-
// This is an array encoded as repetitive query string values.
|
24
|
-
// param=1¶m=2¶m=3
|
25
|
-
if(_.isArray(state[key])) {
|
26
|
-
state[key] = _.union(state[key], values);
|
27
|
-
} else {
|
28
|
-
state[key] = _.union([state[key]], values);
|
29
|
-
}
|
30
|
-
} else {
|
31
|
-
if (values.length > 1) {
|
32
|
-
// This is an array encoded by commas.
|
33
|
-
state[key] = values;
|
34
|
-
}
|
35
|
-
else {
|
36
|
-
// This isn't an array at all.
|
37
|
-
state[key] = values[0];
|
38
|
-
}
|
39
|
-
}
|
40
|
-
});
|
41
|
-
|
42
|
-
hasStateBeenConstructedFromTheUrl = true;
|
43
|
-
}
|
44
|
-
|
45
|
-
let query = [];
|
46
|
-
let mergedState = _.extend(state, newState);
|
47
|
-
let opts = options || {};
|
48
|
-
|
49
|
-
state = {};
|
50
|
-
_.forEach(mergedState, (val, k) => {
|
51
|
-
if (opts.skipKey && opts.skipKey(k, val)) { return; }
|
52
|
-
|
53
|
-
if (val) {
|
54
|
-
let urlVal = (_.isArray(val) && val.length) ? val.join(',') : val.toString();
|
55
|
-
if (urlVal.length) {
|
56
|
-
query.push( k + '=' + urlVal);
|
57
|
-
state[k] = val;
|
58
|
-
}
|
59
|
-
}
|
60
|
-
});
|
61
|
-
query = query.join('&');
|
62
|
-
let path = query ? '?' + query : window.location.pathname;
|
63
|
-
|
64
|
-
if (opts.replace) {
|
65
|
-
window.history.replaceState(params(path), null, path);
|
66
|
-
} else {
|
67
|
-
window.history.pushState(params(path), null, path);
|
68
|
-
}
|
69
|
-
};
|
70
|
-
|
71
|
-
let params = function(url) {
|
72
|
-
// Make pushState play nice with Turbolinks.
|
73
|
-
// Ref https://github.com/turbolinks/turbolinks-classic/issues/363
|
74
|
-
return { turbolinks: true, url: url };
|
75
|
-
};
|
76
|
-
|
77
|
-
let querystringToJSON = function () {
|
78
|
-
const pairs = location.search.slice(1).split('&');
|
79
|
-
|
80
|
-
let result = {};
|
81
|
-
pairs.forEach(function(pair) {
|
82
|
-
pair = pair.split('=');
|
83
|
-
let val = decodeURIComponent(pair[1] || '');
|
84
|
-
if (val.indexOf(',') > -1 ) val = val.split(',');
|
85
|
-
result[pair[0]] = val;
|
86
|
-
});
|
87
|
-
|
88
|
-
return JSON.parse(JSON.stringify(result));
|
89
|
-
};
|
90
|
-
|
91
|
-
const updatePaginationParams = function(newState) {
|
92
|
-
let params = {};
|
93
|
-
|
94
|
-
params.page = (newState.current_page === 1) ? null : newState.current_page;
|
95
|
-
params.per_page = (newState.per_page === 20) ? null : newState.per_page;
|
96
|
-
params.tab = newState.activeTab;
|
97
|
-
|
98
|
-
update(params);
|
99
|
-
};
|
100
|
-
|
101
|
-
const emptyState = function () {
|
102
|
-
state = {};
|
103
|
-
hasStateBeenConstructedFromTheUrl = false;
|
104
|
-
};
|
105
|
-
|
106
|
-
return {
|
107
|
-
state: state,
|
108
|
-
update: update,
|
109
|
-
updatePaginationParams: updatePaginationParams,
|
110
|
-
querystringToJSON: querystringToJSON,
|
111
|
-
emptyState: emptyState,
|
112
|
-
};
|
113
|
-
})();
|