From 9299447590bc5fa9496a2832515e715cb71431d9 Mon Sep 17 00:00:00 2001 From: Chris Chudzicki Date: Mon, 23 Jan 2023 13:42:45 -0500 Subject: [PATCH 1/5] change TS config to target ES6 modules (#1044) tldr: Changing `module` config changes the syntax used to import/export in the compiled code. The new value, "ES6", means that the code compiled by TS will include import/export statements. That code is then further compiled by Webpack, which removes the imports/exports during concatenation. Using ES6 import/exports in the typescript output improves Webpack's tree-shaking. (Or really...enables it. I believe webpack does not treeshake unless the input uses ES6 import/export syntax.) Related: TS has several sort of settings related to the syntax used in output: - `lib`: determines the default/builtin type definitions that are included when typechecking your code. - `target`: Spcecies environment in which your code is going to run, and controls how Typescript downlevels your code. > "The `target` setting changes which JS features are downleveled and which are left intact. For example, an arrow function `() => this` will be turned into an equivalent function expression if target is ES5 or lower." `target` determines the default value of `lib`. If `target` is ES5, you probably want `lib` to be ES5, too, unless you're doing further transpilation with another tool (like babel). - `module`: Determines the syntax used for exports. - `moduleResolution` determines how module identifiers ("some/thing" in like `import x from "some/thing"`) are interpretted. --- tsconfig.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 7e4228c80..93488af54 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,7 @@ "dom" ], "jsx": "react", - "module": "commonjs", + "module": "ES6", "moduleResolution": "node", "typeRoots": [ "node_modules/@types", @@ -41,6 +41,9 @@ ], "ts-node": { "files": true, - "swc": true + "swc": true, + "compilerOptions": { + "module": "commonjs" + }, } } From 5a5c3ccbc57574d39d7f4d6085b9a9e3a7513329 Mon Sep 17 00:00:00 2001 From: Carey P Gumaer Date: Mon, 23 Jan 2023 16:00:55 -0500 Subject: [PATCH 2/5] add pre-commit config (#1048) --- .pre-commit-config.yaml | 15 +++++++++ .secrets.baseline | 67 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 .pre-commit-config.yaml create mode 100644 .secrets.baseline diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..f9145d2f3 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,15 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: git@github.com:Yelp/detect-secrets + rev: v1.3.0 + hooks: + - id: detect-secrets + args: + - --baseline + - .secrets.baseline + - --exclude-files + - README.md + - --exclude-files + - .yarn/releases/yarn-3.1.0.cjs + exclude: .*_test.*|yarn\.lock diff --git a/.secrets.baseline b/.secrets.baseline new file mode 100644 index 000000000..4b62bc9b0 --- /dev/null +++ b/.secrets.baseline @@ -0,0 +1,67 @@ +{ + "custom_plugin_paths": [], + "exclude": { + "files": null, + "lines": null + }, + "generated_at": "2020-08-17T20:01:57Z", + "plugins_used": [ + { + "name": "AWSKeyDetector" + }, + { + "name": "ArtifactoryDetector" + }, + { + "base64_limit": 4.5, + "name": "Base64HighEntropyString" + }, + { + "name": "BasicAuthDetector" + }, + { + "name": "CloudantDetector" + }, + { + "hex_limit": 3, + "name": "HexHighEntropyString" + }, + { + "name": "IbmCloudIamDetector" + }, + { + "name": "IbmCosHmacDetector" + }, + { + "name": "JwtTokenDetector" + }, + { + "keyword_exclude": null, + "name": "KeywordDetector" + }, + { + "name": "MailchimpDetector" + }, + { + "name": "PrivateKeyDetector" + }, + { + "name": "SlackDetector" + }, + { + "name": "SoftlayerDetector" + }, + { + "name": "StripeDetector" + }, + { + "name": "TwilioKeyDetector" + } + ], + "results": {}, + "version": "0.14.2", + "word_list": { + "file": null, + "hash": null + } +} From fa5a438009e495048c9c80092a768ea8b7f1db7a Mon Sep 17 00:00:00 2001 From: Abdurrehman <93309234+MAbdurrehman12@users.noreply.github.com> Date: Wed, 25 Jan 2023 19:02:35 +0500 Subject: [PATCH 3/5] refactor: old course theme removed (#1051) * refactor: old course theme removed * removed some old course theme files from base theme --- .github/workflows/deploy.yml | 29 +-- base-theme/assets/webpack/webpack.common.ts | 3 +- .../layouts/partials/content_header.html | 28 --- .../layouts/partials/resource_body.html | 30 --- .../layouts/partials/resource_title.html | 4 - course/assets/course.ts | 38 ---- course/assets/css/course-content.scss | 24 --- course/assets/css/course-home.scss | 88 --------- course/assets/css/course-info.scss | 182 ------------------ course/assets/css/course-nav.scss | 75 -------- course/assets/css/course-resources.scss | 35 ---- course/assets/css/course.scss | 78 -------- course/assets/css/drawer.scss | 8 - course/assets/css/instructor-insights.scss | 63 ------ course/assets/css/resource-page.scss | 9 - course/assets/css/tables.scss | 63 ------ course/assets/css/video-transcript.scss | 59 ------ course/assets/css/video.scss | 146 -------------- course/assets/css/videojs_player.scss | 162 ---------------- course/assets/instructor-insights.js | 1 - course/assets/js/course_expander.test.ts | 81 -------- course/assets/js/course_expander.ts | 44 ----- course/assets/js/course_info_toggle.ts | 65 ------- course/assets/js/div_toggle.js | 17 -- course/assets/js/navigation.js | 52 ----- course/assets/js/quiz_multiple_choice.js | 60 ------ course/assets/js/responsive_tables.ts | 45 ----- course/assets/js/video-download-button.js | 83 -------- course/assets/js/video_fullscreen_toggle.js | 23 --- course/assets/js/video_playback_speed.js | 85 -------- course/assets/js/video_transcript_track.js | 34 ---- .../content/learning_resource_types/_index.md | 5 - course/go.mod | 3 - .../layouts/_default/baseof.coursedata.json | 1 - course/layouts/_default/baseof.html | 71 ------- .../layouts/_default/section.coursedata.json | 3 - course/layouts/home.html | 113 ----------- course/layouts/index.contentmap.json | 5 - course/layouts/index.coursedata.json | 39 ---- .../learning_resource_types/taxonomy.html | 51 ----- .../layouts/learning_resource_types/term.html | 8 - course/layouts/lists/single.html | 18 -- course/layouts/pages/instructor_insights.html | 3 - course/layouts/pages/section.html | 3 - course/layouts/pages/single.coursedata.json | 3 - course/layouts/pages/single.html | 3 - .../layouts/partials/archived_versions.html | 14 -- course/layouts/partials/course-image-url.html | 8 - course/layouts/partials/course_banner.html | 11 -- course/layouts/partials/course_content.html | 8 - course/layouts/partials/course_content.json | 4 - course/layouts/partials/course_info.html | 70 ------- .../layouts/partials/desktop_course_info.html | 5 - course/layouts/partials/desktop_nav.html | 5 - course/layouts/partials/extrahead.html | 10 - course/layouts/partials/get_departments.html | 7 - course/layouts/partials/get_instructors.html | 20 -- .../partials/get_resource_download_link.html | 10 - .../partials/get_resource_thumbnail_src.html | 14 -- .../partials/hierarchical_select_as_map.html | 14 -- .../partials/learning_resource_type.html | 36 ---- .../partials/learning_resource_types.html | 17 -- .../layouts/partials/mobile_course_info.html | 8 - .../layouts/partials/mobile_course_nav.html | 6 - .../layouts/partials/mobile_nav_toggle.html | 12 -- course/layouts/partials/nav.html | 8 - course/layouts/partials/nav_item.html | 37 ---- course/layouts/partials/nav_url.html | 1 - course/layouts/partials/navigation_js.html | 5 - .../layouts/partials/no_resources_found.html | 3 - .../open_learning_library_versions.html | 15 -- course/layouts/partials/other_versions.html | 15 -- .../partials/partial_collapse_list.html | 58 ------ .../partials/quiz_multiple_choice_choice.html | 13 -- .../quiz_multiple_choice_solution.html | 18 -- course/layouts/partials/resource_list.html | 24 --- .../layouts/partials/resource_list_item.html | 32 --- .../partials/responsive_tables_js.html | 5 - course/layouts/partials/see_all.html | 6 - course/layouts/partials/title.html | 17 -- course/layouts/partials/topic.html | 57 ------ course/layouts/partials/topics.html | 20 -- course/layouts/partials/topics_oneline.html | 12 -- .../layouts/partials/video-gallery-item.html | 16 -- .../layouts/partials/video-gallery-page.html | 13 -- .../layouts/partials/video-gallery-page.json | 25 --- course/layouts/partials/video-gallery.html | 9 - .../layouts/resources/single.coursedata.json | 19 -- course/layouts/resources/single.html | 4 - course/layouts/shortcodes/quiz_choice.html | 5 - course/layouts/shortcodes/quiz_choices.html | 2 - .../shortcodes/quiz_multiple_choice.html | 2 - course/layouts/shortcodes/quiz_solution.html | 4 - course/layouts/shortcodes/resource_file.html | 4 - course/layouts/shortcodes/video-gallery.html | 1 - course/layouts/shortcodes/youtube.html | 4 - course/layouts/video_galleries/list.html | 3 - .../video_galleries/single.coursedata.json | 3 - course/layouts/video_galleries/single.html | 3 - tsconfig.json | 3 - www/layouts/resources/single.html | 4 +- 101 files changed, 4 insertions(+), 2788 deletions(-) delete mode 100644 base-theme/layouts/partials/content_header.html delete mode 100644 base-theme/layouts/partials/resource_body.html delete mode 100644 base-theme/layouts/partials/resource_title.html delete mode 100644 course/assets/course.ts delete mode 100644 course/assets/css/course-content.scss delete mode 100644 course/assets/css/course-home.scss delete mode 100644 course/assets/css/course-info.scss delete mode 100644 course/assets/css/course-nav.scss delete mode 100644 course/assets/css/course-resources.scss delete mode 100644 course/assets/css/course.scss delete mode 100644 course/assets/css/drawer.scss delete mode 100644 course/assets/css/instructor-insights.scss delete mode 100644 course/assets/css/resource-page.scss delete mode 100644 course/assets/css/tables.scss delete mode 100644 course/assets/css/video-transcript.scss delete mode 100644 course/assets/css/video.scss delete mode 100644 course/assets/css/videojs_player.scss delete mode 100644 course/assets/instructor-insights.js delete mode 100644 course/assets/js/course_expander.test.ts delete mode 100644 course/assets/js/course_expander.ts delete mode 100644 course/assets/js/course_info_toggle.ts delete mode 100644 course/assets/js/div_toggle.js delete mode 100644 course/assets/js/navigation.js delete mode 100644 course/assets/js/quiz_multiple_choice.js delete mode 100644 course/assets/js/responsive_tables.ts delete mode 100644 course/assets/js/video-download-button.js delete mode 100644 course/assets/js/video_fullscreen_toggle.js delete mode 100644 course/assets/js/video_playback_speed.js delete mode 100644 course/assets/js/video_transcript_track.js delete mode 100644 course/content/learning_resource_types/_index.md delete mode 100644 course/go.mod delete mode 100644 course/layouts/_default/baseof.coursedata.json delete mode 100644 course/layouts/_default/baseof.html delete mode 100644 course/layouts/_default/section.coursedata.json delete mode 100644 course/layouts/home.html delete mode 100644 course/layouts/index.contentmap.json delete mode 100644 course/layouts/index.coursedata.json delete mode 100644 course/layouts/learning_resource_types/taxonomy.html delete mode 100644 course/layouts/learning_resource_types/term.html delete mode 100644 course/layouts/lists/single.html delete mode 100644 course/layouts/pages/instructor_insights.html delete mode 100644 course/layouts/pages/section.html delete mode 100644 course/layouts/pages/single.coursedata.json delete mode 100644 course/layouts/pages/single.html delete mode 100644 course/layouts/partials/archived_versions.html delete mode 100644 course/layouts/partials/course-image-url.html delete mode 100644 course/layouts/partials/course_banner.html delete mode 100644 course/layouts/partials/course_content.html delete mode 100644 course/layouts/partials/course_content.json delete mode 100644 course/layouts/partials/course_info.html delete mode 100644 course/layouts/partials/desktop_course_info.html delete mode 100644 course/layouts/partials/desktop_nav.html delete mode 100644 course/layouts/partials/extrahead.html delete mode 100644 course/layouts/partials/get_departments.html delete mode 100644 course/layouts/partials/get_instructors.html delete mode 100644 course/layouts/partials/get_resource_download_link.html delete mode 100644 course/layouts/partials/get_resource_thumbnail_src.html delete mode 100644 course/layouts/partials/hierarchical_select_as_map.html delete mode 100644 course/layouts/partials/learning_resource_type.html delete mode 100644 course/layouts/partials/learning_resource_types.html delete mode 100644 course/layouts/partials/mobile_course_info.html delete mode 100644 course/layouts/partials/mobile_course_nav.html delete mode 100644 course/layouts/partials/mobile_nav_toggle.html delete mode 100644 course/layouts/partials/nav.html delete mode 100644 course/layouts/partials/nav_item.html delete mode 100644 course/layouts/partials/nav_url.html delete mode 100644 course/layouts/partials/navigation_js.html delete mode 100644 course/layouts/partials/no_resources_found.html delete mode 100644 course/layouts/partials/open_learning_library_versions.html delete mode 100644 course/layouts/partials/other_versions.html delete mode 100644 course/layouts/partials/partial_collapse_list.html delete mode 100644 course/layouts/partials/quiz_multiple_choice_choice.html delete mode 100644 course/layouts/partials/quiz_multiple_choice_solution.html delete mode 100644 course/layouts/partials/resource_list.html delete mode 100644 course/layouts/partials/resource_list_item.html delete mode 100644 course/layouts/partials/responsive_tables_js.html delete mode 100644 course/layouts/partials/see_all.html delete mode 100644 course/layouts/partials/title.html delete mode 100644 course/layouts/partials/topic.html delete mode 100644 course/layouts/partials/topics.html delete mode 100644 course/layouts/partials/topics_oneline.html delete mode 100644 course/layouts/partials/video-gallery-item.html delete mode 100644 course/layouts/partials/video-gallery-page.html delete mode 100644 course/layouts/partials/video-gallery-page.json delete mode 100644 course/layouts/partials/video-gallery.html delete mode 100644 course/layouts/resources/single.coursedata.json delete mode 100644 course/layouts/resources/single.html delete mode 100644 course/layouts/shortcodes/quiz_choice.html delete mode 100644 course/layouts/shortcodes/quiz_choices.html delete mode 100644 course/layouts/shortcodes/quiz_multiple_choice.html delete mode 100644 course/layouts/shortcodes/quiz_solution.html delete mode 100644 course/layouts/shortcodes/resource_file.html delete mode 100644 course/layouts/shortcodes/video-gallery.html delete mode 100644 course/layouts/shortcodes/youtube.html delete mode 100644 course/layouts/video_galleries/list.html delete mode 100644 course/layouts/video_galleries/single.coursedata.json delete mode 100644 course/layouts/video_galleries/single.html diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bc68c673d..d40f3cba9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -47,9 +47,6 @@ jobs: - name: Run webpack build run: npm run build:webpack -- --output-path=../ocw-www/public/static/ - - name: Copy webpack build to course - run: mkdir -p ../ocw-course/public-v1/ && cp -r ../ocw-www/public/static/ ../ocw-course/public-v1/ - - name: Copy webpack build to course v2 run: mkdir -p ../ocw-course/public-v2/ && cp -r ../ocw-www/public/static/ ../ocw-course/public-v2/ @@ -61,15 +58,6 @@ jobs: OCW_COURSE_STARTER_SLUG: ${{ secrets.OCW_COURSE_STARTER_SLUG }} STATIC_API_BASE_URL: ${{ secrets.STATIC_API_BASE_URL }} RESOURCE_BASE_URL: ${{ secrets.RESOURCE_BASE_URL }} - - - name: Run the course hugo build - run: (cd ../ocw-course; hugo --config $GITHUB_WORKSPACE/ocw-hugo-projects/ocw-course/config.yaml --destination public-v1 --themesDir ../ocw-hugo-themes) - env: - OCW_STUDIO_BASE_URL: ${{ secrets.OCW_STUDIO_BASE_URL }} - SEARCH_API_URL: ${{ secrets.SEARCH_API_URL }} - OCW_COURSE_STARTER_SLUG: ${{ secrets.OCW_COURSE_STARTER_SLUG }} - STATIC_API_BASE_URL: ${{ secrets.STATIC_API_BASE_URL }} - RESOURCE_BASE_URL: ${{ secrets.RESOURCE_BASE_URL }} - name: Run the course v2 hugo build run: (cd ../ocw-course; hugo --config $GITHUB_WORKSPACE/ocw-hugo-projects/ocw-course-v2/config.yaml --destination public-v2 --themesDir ../ocw-hugo-themes) @@ -94,21 +82,6 @@ jobs: env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} - - - name: Deploy Course Preview to Netlify - uses: nwtgck/actions-netlify@v1.1 - if: ${{ github.event_name == 'pull_request' }} - with: - publish-dir: '../ocw-course/public-v1' - github-token: ${{ secrets.GITHUB_TOKEN }} - deploy-message: "Deploy from GitHub Actions" - enable-pull-request-comment: false - enable-commit-comment: false - overwrites-pull-request-comment: false - alias: ocw-hugo-themes-course-pr-${{ github.event.number }} - env: - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} - name: Deploy v2 Course Preview to Netlify uses: nwtgck/actions-netlify@v1.1 @@ -128,7 +101,7 @@ jobs: - name: Set comment body id: set-comment-body run: | - body=$(echo 'Netlify Deployments:
www: https://ocw-hugo-themes-www-pr-${{ github.event.number }}--ocw-next.netlify.app/
Course v1: https://ocw-hugo-themes-course-pr-${{ github.event.number }}--ocw-next.netlify.app/
Course v2: https://ocw-hugo-themes-course-v2-pr-${{ github.event.number }}--ocw-next.netlify.app/') + body=$(echo 'Netlify Deployments:
www: https://ocw-hugo-themes-www-pr-${{ github.event.number }}--ocw-next.netlify.app/
Course v2: https://ocw-hugo-themes-course-v2-pr-${{ github.event.number }}--ocw-next.netlify.app/') echo ::set-output name=body::$body - name: Find Comment diff --git a/base-theme/assets/webpack/webpack.common.ts b/base-theme/assets/webpack/webpack.common.ts index 8f22b79ac..447ff8387 100644 --- a/base-theme/assets/webpack/webpack.common.ts +++ b/base-theme/assets/webpack/webpack.common.ts @@ -20,9 +20,8 @@ const config: webpack.Configuration = { }, entry: { main: fromRoot("./base-theme/assets/index.ts"), - course: fromRoot("./course/assets/course.ts"), course_v2: fromRoot("./course-v2/assets/course-v2.ts"), - instructor_insights: fromRoot("./course/assets/instructor-insights.js"), + instructor_insights: fromRoot("./course-v2/assets/instructor-insights.js"), www: fromRoot("./www/assets/www.tsx"), fields: fromRoot("./fields/assets/fields.js") }, diff --git a/base-theme/layouts/partials/content_header.html b/base-theme/layouts/partials/content_header.html deleted file mode 100644 index eb184814f..000000000 --- a/base-theme/layouts/partials/content_header.html +++ /dev/null @@ -1,28 +0,0 @@ -{{ $shouldCollapseTitle := gt (len .Title) 75 }} -
-
- {{ with .Params.parent_title }} -

{{ . }}

- {{ end }} -

{{ .Title }}

-
-
- {{ if $shouldCollapseTitle }} -
- -
- {{ end }} -
-
diff --git a/base-theme/layouts/partials/resource_body.html b/base-theme/layouts/partials/resource_body.html deleted file mode 100644 index 6e3645e6b..000000000 --- a/base-theme/layouts/partials/resource_body.html +++ /dev/null @@ -1,30 +0,0 @@ -
- {{- if ne .Params.resourcetype "Video" }} - {{- if .Content -}} -
-
Description:
-
{{ .Content }}
-
- {{- end -}} - {{- if .Params.learning_resource_types -}} -
-
Resource Type:
-
{{ delimit (.Params.learning_resource_types | default slice) ", " }}
-
- {{- end -}} - {{- if .Params.file -}} - - {{- end -}} - {{- else -}} - {{ partial "video.html" . }} - {{- end -}} - {{ if eq .Params.file_type "application/pdf" }} - {{ partial "pdf_viewer.html" . }} - {{ else if eq .Params.resourcetype "Image" }} - {{ partial "image_page.html" . }} - {{ end }} -
\ No newline at end of file diff --git a/base-theme/layouts/partials/resource_title.html b/base-theme/layouts/partials/resource_title.html deleted file mode 100644 index 779702f26..000000000 --- a/base-theme/layouts/partials/resource_title.html +++ /dev/null @@ -1,4 +0,0 @@ -
- {{ partial "content_header.html" . }} - {{ partial "mobile_nav_toggle.html" . }} -
diff --git a/course/assets/course.ts b/course/assets/course.ts deleted file mode 100644 index 501e7df6d..000000000 --- a/course/assets/course.ts +++ /dev/null @@ -1,38 +0,0 @@ -import "../../node_modules/nanogallery2/src/css/nanogallery2.css" - -import "offcanvas-bootstrap/dist/js/bootstrap.offcanvas.js" -import "nanogallery2/src/jquery.nanogallery2.core.js" - -import "./css/course.scss" - -import { - initDesktopCourseInfoToggle, - closeToggleButton -} from "./js/course_info_toggle" -import { initDivToggle } from "./js/div_toggle" -import { initCourseInfoExpander } from "./js/course_expander" -import { initVideoTranscriptTrack } from "./js/video_transcript_track" -import { initPlayBackSpeedButton } from "./js/video_playback_speed" -import { initVideoFullscreenToggle } from "./js/video_fullscreen_toggle" -import { initDownloadButton } from "./js/video-download-button" -import { - clearSolution, - checkAnswer, - showSolution -} from "./js/quiz_multiple_choice" - -import "videojs-youtube" - -$(function() { - initDesktopCourseInfoToggle() - initCourseInfoExpander(document) - initDownloadButton() - initPlayBackSpeedButton() - initVideoTranscriptTrack() - initDivToggle() - clearSolution() - checkAnswer() - showSolution() - initVideoFullscreenToggle() - closeToggleButton() -}) diff --git a/course/assets/css/course-content.scss b/course/assets/css/course-content.scss deleted file mode 100644 index a91404c61..000000000 --- a/course/assets/css/course-content.scss +++ /dev/null @@ -1,24 +0,0 @@ -#course-title.collapse:not(.show) { - display: block; - height: 5.7em; - overflow: hidden; -} - -#course-title.collapsing { - height: 5.7em; -} - -th, -td { - > p:empty { - display: none; - } -} - -td { - h3 { - font-weight: normal !important; - font-style: italic !important; - font-family: arial, helvetica, sans-serif !important; - } -} diff --git a/course/assets/css/course-home.scss b/course/assets/css/course-home.scss deleted file mode 100644 index 650e04218..000000000 --- a/course/assets/css/course-home.scss +++ /dev/null @@ -1,88 +0,0 @@ -.course-home-page { - .container-fluid { - max-width: $max-content-width; - } - - .desktop-nav { - padding-top: 60px; - padding-left: 90px; - } - - .image-with-caption { - border: 1px solid $medium-gray; - border-radius: 10px; - - img { - border-top-left-radius: 10px; - border-top-right-radius: 10px; - width: 100%; - } - - .caption { - border-top: 1px solid $medium-gray; - - p { - margin-bottom: 0; - } - } - - #course-image-description.collapse:not(.show) { - display: block; - /* height = lineheight * no of lines to display */ - height: 5.3em; - overflow: hidden; - } - - #course-image-description.collapsing { - height: 5.3em; - } - } - - h4.course-info-title, - h4.course-description-title { - color: $highlight-red; - text-transform: uppercase; - font-size: $font-normal; - } - - .course-home-section { - padding: 20px 40px 0px 40px; - - @include media-breakpoint-down(md) { - padding: 30px; - } - - &.in-panel { - padding: 0; - } - - a { - text-decoration: none; - } - - .course-feature-icon { - color: #ff8924; - } - - .other-version-list { - a { - text-decoration: underline; - color: $blue; - } - - li { - padding-bottom: 4px; - } - } - } - - .collapse-btn-section { - a.collapsed span:after { - content: "keyboard_arrow_down"; - } - - a:not(.collapsed) span:after { - content: "keyboard_arrow_up"; - } - } -} diff --git a/course/assets/css/course-info.scss b/course/assets/css/course-info.scss deleted file mode 100644 index 6c8ba4fa9..000000000 --- a/course/assets/css/course-info.scss +++ /dev/null @@ -1,182 +0,0 @@ -.course-info { - overflow: hidden; - $collapsedHeight: 200px; - $opaqueLayerHeight: 30px; - - // This media query is not defined gloabally as it - // is targeted/specific to a particular use case only - // Hiding horizontal scroll on screens where content already fits in - @media (min-width: 1270px) { - overflow-x: hidden !important; - } - - &.collapsed { - table { - display: block; - position: relative; - height: $collapsedHeight; - margin-bottom: 0 !important; - } - - .opaque-layer { - position: absolute; - bottom: 0; - height: $opaqueLayerHeight; - width: 100%; - background: linear-gradient(to bottom, transparent, white); - z-index: 1; - } - } - - table { - tr { - td:nth-child(1) { - color: $dark-gray; - } - } - } - - .course-info-expander { - .material-icons { - margin-left: 48px; - } - } - - #course-info.collapse:not(.show) { - display: block; - /* height = lineheight * no of lines to display */ - height: 12.5em; - overflow: hidden; - } - - #course-info.collapsing { - height: 12.5em; - } -} - -.partial-collapse-overlay { - position: absolute; - width: 100%; - height: 100%; - top: 0; - z-index: 1; - background-size: cover; - @include media-breakpoint-up(lg) { - background: linear-gradient(transparent, transparent, $white) no-repeat - center; - } - @include media-breakpoint-down(md) { - background: linear-gradient(transparent, transparent, $light-gray) no-repeat - center; - } -} - -.partial-collapse.collapse.show ~ .partial-collapse-overlay, -.partial-collapse.collapsing ~ .partial-collapse-overlay { - display: none; -} - -.partial-collapse-toggle-link { - position: absolute; - width: 100%; - height: 100%; - pointer-events: all; - z-index: 2; -} - -.partial-collapse-icon-container { - position: absolute; - height: $partial-collapse-height; - width: 100%; - pointer-events: none; -} - -.partial-collapse-icon { - position: absolute; - top: 50%; - transform: translateY(-50%); - right: 0; - pointer-events: all; -} - -.partial-collapse-icon > i:after { - content: "expand_more"; -} - -.partial-collapse-toggle-link[aria-expanded="true"] - > .partial-collapse-icon-container - > .partial-collapse-icon - > i:after { - content: "expand_less" !important; -} - -.partial-collapse.collapse:not(.show) { - display: block; - height: $partial-collapse-height; - overflow: hidden; -} - -.partial-collapse.collapsing { - height: $partial-collapse-height; -} - -.partial-collapse.collapse.show > ul > li > a.partial-collapse-link { - position: relative; - z-index: 3; -} - -.topic-toggle { - position: absolute; - height: 26px; - top: 50%; - transform: translateY(-50%); - left: 0; - pointer-events: all; -} - -.topic-toggle > i:after { - content: "chevron_right"; -} - -.topic-toggle[aria-expanded="true"] > i:after { - content: "expand_more" !important; -} - -.course-description { - .description { - p:last-child { - margin-bottom: 0; - } - } - - &.collapsed { - .description { - max-height: 6rem; - overflow: hidden; - } - } - - .expand-link { - display: flex; - align-items: center; - border: 0; - padding: 0; - background-color: white; - color: $blue; - - .material-icons { - color: black; - } - } - - #course-description.collapse:not(.show) { - display: block; - /* height = lineheight * no of lines to display */ - height: 4.5em; - overflow: hidden; - } - - #course-description.collapsing { - height: 4.5em; - } -} diff --git a/course/assets/css/course-nav.scss b/course/assets/css/course-nav.scss deleted file mode 100644 index b0031772a..000000000 --- a/course/assets/css/course-nav.scss +++ /dev/null @@ -1,75 +0,0 @@ -.course-nav { - a { - text-decoration: none; - font-size: $font-sm; - - &.active { - font-weight: 600; - color: $highlight-red !important; - } - } -} - -.desktop-nav { - @include media-breakpoint-up(xl) { - max-width: $desktop-nav-max-width; - } -} - -.mobile-course-nav-toggle { - *:not(i) { - font-size: $font-normal; - } - - i { - font-size: $font-lg; - } -} - -.course-info-toggle { - position: absolute; - right: 0; - z-index: 10; - width: 38px; - - .toggle { - writing-mode: vertical-lr; - transform: rotate(180deg); - } -} - -.course-nav-list-item { - @include media-breakpoint-up(lg) { - padding-right: 2rem; - } - - &:first-child { - .course-nav-parent { - padding-top: 0 !important; - } - } -} - -.course-nav-list-item-child { - font-size: $font-xs; -} - -.course-nav-section-toggle { - margin-left: 20px; -} - -.course-nav-section-toggle > i:after { - content: "add"; -} - -.course-nav-section-toggle[aria-expanded="true"] > i:after { - content: "remove" !important; -} - -.course-nav-child-nav { - list-style: none; -} - -.course-nav-child-nav > li { - padding-right: 0 !important; -} diff --git a/course/assets/css/course-resources.scss b/course/assets/css/course-resources.scss deleted file mode 100644 index b711c877b..000000000 --- a/course/assets/css/course-resources.scss +++ /dev/null @@ -1,35 +0,0 @@ -h4 { - color: $highlight-red !important; -} - -.resource-thumbnail { - height: 38px; - width: 32px; -} - -.see-all-resources-icon { - display: inline-flex; - vertical-align: top; - margin-left: 5px; -} - -.resource-download { - padding: 3px; - border: solid 0.5px $medium-gray; - border-radius: 20px; - margin-left: -12px; - margin-top: 13px; - background-color: $white; -} - -.resource-download:hover { - background-color: $light-gray; -} - -.resource-list-title { - text-decoration: none; -} - -.resource-list-title:hover { - text-decoration: underline; -} diff --git a/course/assets/css/course.scss b/course/assets/css/course.scss deleted file mode 100644 index e06a09556..000000000 --- a/course/assets/css/course.scss +++ /dev/null @@ -1,78 +0,0 @@ -@import "../../../base-theme/assets/css/imports/reset"; -@import "../../../base-theme/assets/css/bootstrap-overrides"; -@import "../../../base-theme/assets/css/breakpoints"; -@import "../../../base-theme/assets/css/variables"; -@import "~bootstrap/scss/bootstrap"; -@import "~offcanvas-bootstrap/src/sass/bootstrap.offcanvas"; - -@import "course-nav"; -@import "course-info"; -@import "course-home"; -@import "drawer"; -@import "tables"; -@import "video"; -@import "videojs_player"; -@import "resource-page"; -@import "video-transcript"; -@import "course-content"; -@import "course-resources"; - -#course-banner { - color: $white; - background-color: $blue; - - a { - text-decoration: none; - } -} - -#main-content article.content { - a:link { - color: $course-content-link-unclicked; - } - - a:visited, - a:hover, - a:active { - color: $course-content-link-hover-clicked; - } -} - -div[class^="toggle"]:not(.toggle-visible), -span[class^="toggle"]:not(.toggle-visible) { - display: none; -} - -div[class^="reveal"], -.multiple-choice-check-button, -.multiple-choice-show-button { - color: #115f83; - cursor: pointer; -} - -.correctness-icon-correct { - color: green; -} - -.correctness-icon-wrong { - color: red; -} - -.correctness-icon { - position: relative; - top: 6px; -} - -.multiple-choice-radio { - margin-top: 11px; - margin-bottom: 11px; -} - -.multiple_choice_buttons { - margin: 10px; -} - -pre { - padding: 10px; - border: 1px solid $medium-gray; -} diff --git a/course/assets/css/drawer.scss b/course/assets/css/drawer.scss deleted file mode 100644 index b0ab10378..000000000 --- a/course/assets/css/drawer.scss +++ /dev/null @@ -1,8 +0,0 @@ -.drawer { - background: white; - max-width: 50% !important; - - @include media-breakpoint-down(xs) { - max-width: 75% !important; - } -} diff --git a/course/assets/css/instructor-insights.scss b/course/assets/css/instructor-insights.scss deleted file mode 100644 index a2dc1cc94..000000000 --- a/course/assets/css/instructor-insights.scss +++ /dev/null @@ -1,63 +0,0 @@ -@import "../../../base-theme/assets/css/variables.scss"; -#course-content-section { - h2 { - margin-bottom: 1.25rem !important; - } - - h3 { - font-size: $font-normal !important; - } - - p { - margin-bottom: 1.25rem; - } - - .quotewrapper { - margin: 0; - line-height: 1.75em; - } - - .quotewrapper blockquote, - figcaption { - font-family: "Helvetica-Oblique", "Helvetica", sans-serif; - font-style: italic; - margin: 0; - } - - .quotewrapper blockquote.quote { - font-size: 1.5em; - font-weight: bold; - color: $medium-gray; - } - - .quotewrapper .sigwrapper { - display: flex; - } - - .quotewrapper figcaption.sig { - margin-left: auto; - text-transform: uppercase; - order: 2; - font-size: 1.25em; - } - - .approx-students { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - background-color: $highlight-red; - border-radius: 50%; - h1 { - margin-top: 0.75rem; - margin-bottom: 0; - } - - h1, - h2 { - color: $white !important; - text-transform: none !important; - user-select: none; - } - } -} diff --git a/course/assets/css/resource-page.scss b/course/assets/css/resource-page.scss deleted file mode 100644 index 8494ba2bd..000000000 --- a/course/assets/css/resource-page.scss +++ /dev/null @@ -1,9 +0,0 @@ -.resource-page { - .row { - min-height: 60px; - - display: flex; - flex-direction: row; - align-items: center; - } -} diff --git a/course/assets/css/tables.scss b/course/assets/css/tables.scss deleted file mode 100644 index 78cd387ca..000000000 --- a/course/assets/css/tables.scss +++ /dev/null @@ -1,63 +0,0 @@ -/* - responsive table css based on: - https://css-tricks.com/responsive-data-tables/ - https://elvery.net/demo/responsive-tables/#no-more-tables -*/ -@mixin mobile-table { - // Force table to not be like tables anymore - table, - thead, - tbody, - th, - td, - tr { - display: block; - } - - // Hide table headers (but not display: none;, for accessibility) - thead tr { - position: absolute; - top: -9999px; - left: -9999px; - } - - tr { - border: 1px solid #ccc; - } - - td { - border: none; - border-bottom: 1px solid #eee; - } - - td:before { - /* - The data-title attribute is written in using the table's headings - See responsive_tables.js for more info - */ - content: attr(data-title); - font-weight: bold; - } -} - -#main-content table:not(#course-info-table) { - thead th, - td { - vertical-align: middle !important; - } - - tr { - td:empty { - display: none; - } - } - - @media only screen and (max-width: 760px), - (min-device-width: 768px) and (max-device-width: 1024px) { - @include mobile-table; - } -} - -.mobile-table { - @include mobile-table; -} diff --git a/course/assets/css/video-transcript.scss b/course/assets/css/video-transcript.scss deleted file mode 100644 index bd8dae863..000000000 --- a/course/assets/css/video-transcript.scss +++ /dev/null @@ -1,59 +0,0 @@ -.transcript { - width: 100%; - margin: auto; - font-family: Arial, sans-serif; -} - -.transcript-body { - height: 200px; - overflow-y: scroll; -} - -.transcript-line { - position: relative; - padding: 5px; - cursor: pointer; - line-height: 1.3; -} - -.transcript-timestamp { - position: absolute; - display: inline-block; - width: 75px; - margin-left: 20px; -} - -.transcript-text { - display: block; - margin-left: 95px; -} - -.transcript-text:empty { - height: 20px; -} - -.transcript-line:hover { - background-color: $medium-gray; -} - -.transcript-line.is-active { - font-weight: bold; - color: $orange; -} - -.transcript-tab-header { - padding: 5px 15px 5px; - margin-bottom: 5px; -} - -.transcript-tab-section-toggle { - i:after { - content: "keyboard_arrow_down"; - } -} - -.transcript-tab-section-toggle[aria-expanded="true"] { - i:after { - content: "keyboard_arrow_up" !important; - } -} diff --git a/course/assets/css/video.scss b/course/assets/css/video.scss deleted file mode 100644 index 1e74b37e7..000000000 --- a/course/assets/css/video.scss +++ /dev/null @@ -1,146 +0,0 @@ -.video-gallery-card { - a { - user-select: none; - text-decoration: none; - - .inner-container { - display: flex; - justify-content: space-between; - background-color: white; - color: black; - padding: 10px; - margin: 0; - text-align: left; - width: 100%; - cursor: pointer; - - .left-col { - display: flex; - justify-content: center; - align-items: center; - position: relative; - margin-right: 10px; - - img.thumbnail { - border-radius: 5px; - - @include media-breakpoint-down(md) { - border-radius: 0px; - } - } - - img.youtube-logo-overlay { - position: absolute; - opacity: 0.3; - left: 0; - top: 0; - transform: scale(0.62); - width: 100%; - height: 100%; - } - } - - .right-col { - position: relative; - margin-left: 10px; - width: 100%; - - .video-title { - position: absolute; - top: 50%; - transform: translateY(-50%); - - @media (max-width: 350px) { - font-size: small; - } - - @media (max-width: 250px) { - font-size: x-small; - } - } - } - } - } -} - -.embedded-video-container { - // this padding will be applied when video is embedded - padding-bottom: 44px; - background-color: $light-gray; -} - -.video-page { - .video-container { - height: 0; - padding-bottom: 56% !important; - margin-bottom: 44px; - position: relative; - max-width: 100%; - } - - .video-container iframe { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - } -} - -.video-buttons-container { - background-color: $light-gray; - overflow: hidden; - margin-bottom: 35px; -} - -.video-download-container { - float: right; - padding-top: 25px; - padding-bottom: 25px; - padding-right: 25px; -} - -.video-download-button { - float: right; - font-size: $font-sm; - color: white; -} - -a.video-download-button:visited { - color: white; -} - -.video-page-link-section { - padding: 5px 15px 5px; - display: inline-flex; -} - -.video-page-link { - text-decoration: none; - color: $black !important; - font-weight: 600; - cursor: pointer; -} - -.video-page-link:hover { - text-decoration: none !important; -} - -#main-content a.download-file.video-download-button:link { - color: white; -} - -#main-content a.download-file.video-download-button:visited { - color: white; -} - -@include media-breakpoint-down(md) { - .video-download-container { - padding-top: 15px; - padding-bottom: 15px; - padding-right: 15px; - } - .video-download-container:first-child { - padding-bottom: 0px; - } -} diff --git a/course/assets/css/videojs_player.scss b/course/assets/css/videojs_player.scss deleted file mode 100644 index 156e0276d..000000000 --- a/course/assets/css/videojs_player.scss +++ /dev/null @@ -1,162 +0,0 @@ -// color variables -$control-item-color: $dark-gray; -$control-item-bg-color: $light-gray; -$slider-color: $pink; - -.vjs-ocw.video-js { - .ytp-chrome-top-buttons { - display: none; - } - .vjs-big-play-button { - font-size: 4em; - } - - button { - font-size: 1.5em; - } - - .vjs-control-bar { - height: 4.4em; - background-color: $control-item-bg-color; - color: $control-item-color; - transition: visibility 2s, opacity 0.1s; - bottom: auto; - display: flex; - } - - .vjs-menu-content { - background-color: $control-item-bg-color !important; - } - - .vjs-volume-bar { - margin: 2.1em 0.45em; - } - - .vjs-control { - min-width: 3.5em; - } - - .vjs-volume-panel { - min-width: 50px; - } - - .vjs-volume-level { - background-color: $control-item-color; - } - - .vjs-progress-control { - position: absolute; - bottom: 37px; - left: 0; - right: 0; - width: 100%; - height: 10px; - - .vjs-progress-holder { - margin-left: 18px; - margin-right: 18px; - color: $slider-color; - font-size: 1.5em; - } - - .vjs-play-progress, - .vjs-slider-bar { - background-color: $slider-color; - } - - .vjs-progress-holder, - .vjs-play-progress, - .vjs-load-progress, - .vjs-load-progress div { - border-radius: 6px; - } - } - - .vjs-time-control { - font-size: 1.4em; - padding-right: 0.3em; - padding-left: 0.3em; - @include media-breakpoint-down(xs) { - display: none !important; - } - } - - .vjs-duration, - .vjs-time-divider, - .vjs-current-time { - display: block; - } - - .vjs-time-divider { - min-width: 1em; - } - - .vjs-remaining-time, - .vjs-picture-in-picture-control { - display: none; - } - - .vjs-fullscreen-control { - position: absolute; - bottom: 0; - right: 0; - } - - .vjs-subs-caps-button { - position: absolute; - right: 25px; - bottom: 0; - } - - .vjs-quality-selector { - position: absolute; - right: 100px; - - .vjs-icon-placeholder::before { - font-family: "Material Icons"; - content: "\e8b8"; - } - } - - .vjs-download-button { - .vjs-icon-placeholder::before { - font-family: "Material Icons"; - content: "\e258"; - } - .vjs-icon-placeholder::after { - font-family: "Material Icons"; - content: "\e5c5"; - margin-left: 15px; - } - } - - .vjs-menu-button-popup { - .vjs-menu { - width: 15em; - } - } - .playback-button-position { - position: absolute; - right: -1rem; - - .vjs-menu-content { - right: 100px; - margin: 10px; - box-shadow: 5px 5px 10px; - } - } - - .download-button-position { - position: absolute; - right: 8rem; - - .vjs-menu-content { - box-shadow: 5px 5px 10px; - margin: 10px; - - li { - text-transform: capitalize; - } - } - } -} diff --git a/course/assets/instructor-insights.js b/course/assets/instructor-insights.js deleted file mode 100644 index 879771e68..000000000 --- a/course/assets/instructor-insights.js +++ /dev/null @@ -1 +0,0 @@ -import "./css/instructor-insights.scss" diff --git a/course/assets/js/course_expander.test.ts b/course/assets/js/course_expander.test.ts deleted file mode 100644 index 798728845..000000000 --- a/course/assets/js/course_expander.test.ts +++ /dev/null @@ -1,81 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-nocheck -import { JSDOM } from "jsdom" - -import { initCourseInfoExpander } from "./course_expander" - -describe("initCourseInfoExpander", () => { - let html - - beforeEach(() => { - html = ` - - ` - }) - - const assertExpanded = (button, expanded) => { - const container = button.closest(".expand-container") - expect(button.getAttribute("aria-expanded")).toBe(String(expanded)) - expect(button.classList.contains("expanded")).toBe(expanded) - expect(container.classList.contains("collapsed")).toBe(!expanded) - const readmore = button.querySelector(".read-more-text") - if (readmore) { - expect(readmore.textContent).toBe(expanded ? "Show Less" : "Read More") - } - const arrow = button.querySelector(".expander-arrow") - if (arrow) { - expect(arrow.textContent).toBe( - expanded ? "keyboard_arrow_down" : "keyboard_arrow_right" - ) - } - } - - const toggleButton = (button, isMouseClick, window) => { - if (isMouseClick) { - button.click() - } else { - const event = new window.KeyboardEvent("keypress", { - key: "Enter", - bubbles: true - }) - button.dispatchEvent(event) - } - } - - // - ;[true, false].forEach(isReadMore => { - [true, false].forEach(isMouseClick => { - it(`toggles the ${isReadMore ? "read more" : "course info"} link by ${ - isMouseClick ? "click" : "enter" - }`, () => { - const { window } = new JSDOM(html) - const document = window.document - initCourseInfoExpander(document) - const buttonSelectors = [".read-more", ".course-info-link"] - const selector = isReadMore ? ".read-more" : ".course-info-link" - const button = document.querySelector(selector) - const otherButton = document.querySelector( - buttonSelectors.find(_selector => _selector !== selector) - ) - assertExpanded(button, false) - assertExpanded(otherButton, false) - toggleButton(button, isMouseClick, window) - assertExpanded(button, true) - assertExpanded(otherButton, false) - toggleButton(button, isMouseClick, window) - assertExpanded(button, false) - assertExpanded(otherButton, false) - }) - }) - }) -}) diff --git a/course/assets/js/course_expander.ts b/course/assets/js/course_expander.ts deleted file mode 100644 index b6e8b2b68..000000000 --- a/course/assets/js/course_expander.ts +++ /dev/null @@ -1,44 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-nocheck -const toggleExpand = (button, container) => { - const expanded = button.classList.contains("expanded") - const readmoreText = button.querySelector(".read-more-text") - const arrow = button.querySelector(".expander-arrow") - if (expanded) { - button.classList.remove("expanded") - button.setAttribute("aria-expanded", "false") - container.classList.add("collapsed") - if (arrow) { - arrow.textContent = "keyboard_arrow_right" - } - } else { - button.classList.add("expanded") - button.setAttribute("aria-expanded", "true") - container.classList.remove("collapsed") - if (arrow) { - arrow.textContent = "keyboard_arrow_down" - } - } - - if (readmoreText) { - readmoreText.textContent = expanded ? "Read More" : "Show Less" - } -} - -const initCourseInfoExpander = document => { - for (const expanderButton of document.querySelectorAll(".expand-link")) { - const container = expanderButton.closest(".expand-container") - expanderButton.addEventListener("click", event => { - event.preventDefault() - toggleExpand(expanderButton, container) - }) - expanderButton.addEventListener("keypress", event => { - if (event.key === "Enter") { - event.preventDefault() - toggleExpand(expanderButton, container) - } - }) - } -} - -export { initCourseInfoExpander } diff --git a/course/assets/js/course_info_toggle.ts b/course/assets/js/course_info_toggle.ts deleted file mode 100644 index a60620751..000000000 --- a/course/assets/js/course_info_toggle.ts +++ /dev/null @@ -1,65 +0,0 @@ -export const initDesktopCourseInfoToggle = () => { - const HIDE_COURSE_INFO_TEXT = "HIDE COURSE INFO" - const SHOW_COURSE_INFO_TEXT = "SHOW COURSE INFO" - const toggleElement = document.getElementById("desktop-course-info-toggle") - - if (toggleElement) { - toggleElement.addEventListener("click", () => { - const mainContent = document.getElementById("main-content") - const desktopCourseInfo = document.getElementById("desktop-course-info") - const desktopCourseInfoToggle = document.getElementById( - "desktop-course-info-toggle" - ) - if (!(desktopCourseInfoToggle && desktopCourseInfo && mainContent)) { - return - } - desktopCourseInfo.classList.toggle("d-none") - mainContent.classList.toggle("col-xl-8") - mainContent.classList.toggle("col-lg-8") - if (desktopCourseInfoToggle.innerText === HIDE_COURSE_INFO_TEXT) { - desktopCourseInfoToggle.getElementsByTagName("span")[0].innerHTML = - SHOW_COURSE_INFO_TEXT - } else { - desktopCourseInfoToggle.getElementsByTagName("span")[0].innerHTML = - HIDE_COURSE_INFO_TEXT - } - calculateTableResponsiveness() - }) - } -} - -function calculateTableResponsiveness() { - const tables = document.querySelectorAll("#main-content table") - const main = document.getElementById("main-content") - if (!main) { - throw new Error("Expected element to exist.") - } - const mainContentWidth = main.clientWidth - - tables.forEach(table => { - if (table.clientWidth > mainContentWidth) { - table.classList.add("mobile-table") - } else { - table.classList.remove("mobile-table") - } - }) -} - -export function closeToggleButton() { - const tables = document.querySelectorAll("#main-content table") - const main = document.getElementById("main-content") - const toggleElement = document.getElementById("desktop-course-info-toggle") - if (!(main && toggleElement)) { - return - } - const mainContentWidth = main.clientWidth - - tables.forEach(table => { - if ( - table.clientWidth > mainContentWidth && - toggleElement.innerText === "HIDE COURSE INFO" - ) { - toggleElement.click() - } - }) -} diff --git a/course/assets/js/div_toggle.js b/course/assets/js/div_toggle.js deleted file mode 100644 index cc03a2c11..000000000 --- a/course/assets/js/div_toggle.js +++ /dev/null @@ -1,17 +0,0 @@ -export const initDivToggle = () => { - const revealElements = document.querySelectorAll("[class*=reveal]") - for (const reveal of Array.from(revealElements)) { - for (const elementClass of Array.from(reveal.classList)) { - if (elementClass.match(/^reveal/)) { - reveal.addEventListener("click", () => { - const revealId = elementClass.replace("reveal", "") - - const hideables = document.getElementsByClassName(`toggle${revealId}`) - for (const hidable of Array.from(hideables)) { - hidable.classList.toggle("toggle-visible") - } - }) - } - } - } -} diff --git a/course/assets/js/navigation.js b/course/assets/js/navigation.js deleted file mode 100644 index 193bf3e20..000000000 --- a/course/assets/js/navigation.js +++ /dev/null @@ -1,52 +0,0 @@ -// @ts-expect-error TODO -function expandNav(navItemEl, collapseEl) { - collapseEl.classList.add("show") - navItemEl - .querySelector(".course-nav-section-toggle, video-tab-toggle-section") - .setAttribute("aria-expanded", "true") -} - -function courseNav() { - document - .querySelectorAll(".course-nav, .transcript-header") - .forEach(navEl => { - // set .active on the currently active link - navEl.querySelectorAll(".nav-link").forEach(navLinkEl => { - const navLink = navLinkEl.getAttribute("href") ? - navLinkEl.getAttribute("href") : - "" - if ( - // @ts-expect-error TODO - navLink.replace(/\/$/, "") === - window.location.pathname.replace(/\/$/, "") - ) { - navLinkEl.classList.add("active") - // @ts-expect-error TODO - const uuid = navLinkEl.dataset.uuid - const navItemEl = navLinkEl.closest(".course-nav-list-item") - const collapseEl = navItemEl?.querySelector(".collapse") - const sectionToggles = Array.prototype.filter.call( - document.querySelectorAll(".course-nav-section-toggle"), - node => { - return node.dataset.uuid === uuid - } - ) - // if this is a parent item, expand its children - if (navItemEl && collapseEl && sectionToggles.length > 0) { - expandNav(navItemEl, collapseEl) - } - } - }) - - const activeEl = navEl.querySelector("a.nav-link.active") - - // iterate through nav items, find any that are parents of the active link, expanded if needed - navEl.querySelectorAll(".course-nav-list-item").forEach(navItemEl => { - const collapseEl = navItemEl.querySelector(".collapse") - if (collapseEl && collapseEl.contains(activeEl)) { - expandNav(navItemEl, collapseEl) - } - }) - }) -} -courseNav() diff --git a/course/assets/js/quiz_multiple_choice.js b/course/assets/js/quiz_multiple_choice.js deleted file mode 100644 index d27bfeabe..000000000 --- a/course/assets/js/quiz_multiple_choice.js +++ /dev/null @@ -1,60 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-nocheck -export const clearSolution = () => { - const radioElements = document.getElementsByClassName("multiple-choice-radio") - for (const radio of radioElements) { - radio.addEventListener("click", () => { - Array.from( - radio.closest("fieldset").getElementsByClassName("correctness-icon") - ).forEach(solution => { - solution.classList.remove("toggle-visible") - }) - }) - } -} - -export const checkAnswer = () => { - Array.from( - document.getElementsByClassName("multiple-choice-check-button") - ).forEach(button => { - button.addEventListener("click", () => { - Array.from( - button - .closest(".multiple-choice-question") - .getElementsByClassName("multiple-choice-radio") - ).forEach(input => { - if (input.checked) { - input - .closest("div") - .getElementsByClassName("correctness-icon")[0] - .classList.add("toggle-visible") - } - }) - }) - }) -} - -export const showSolution = () => { - Array.from( - document.getElementsByClassName("multiple-choice-show-button") - ).forEach(button => { - button.addEventListener("click", () => { - const solutionShown = button - .closest(".multiple-choice-question") - .getElementsByClassName("multiple-choice-solution")[0] - .classList.toggle("toggle-visible") - - if (solutionShown) { - button - .closest(".multiple-choice-question") - .getElementsByClassName("correctness-icon-correct")[0] - .classList.add("toggle-visible") - } else { - button - .closest(".multiple-choice-question") - .getElementsByClassName("correctness-icon-correct")[0] - .classList.remove("toggle-visible") - } - }) - }) -} diff --git a/course/assets/js/responsive_tables.ts b/course/assets/js/responsive_tables.ts deleted file mode 100644 index 8e3b2b6f4..000000000 --- a/course/assets/js/responsive_tables.ts +++ /dev/null @@ -1,45 +0,0 @@ -function initResponsiveTables() { - const tables = document.querySelectorAll("#main-content table") - - const observer = new ResizeObserver(() => calculateOverlap()) - const mainContent = document.getElementById("main-content") - if (!mainContent) return - if (!window.ResizeObserver) return - observer.observe(mainContent) - tables.forEach(table => { - const headings = table.getElementsByTagName("th") - const rows = table.querySelectorAll("table tr") - // set data-title attribute on table cells - rows.forEach(row => { - const cells = row.querySelectorAll("td") - cells.forEach((cell, i) => { - if (headings.length >= i + 1) { - cells[i].dataset["title"] = headings[i].innerText.trim().concat(": ") - } - }) - }) - }) -} - -function calculateOverlap() { - const tables = document.querySelectorAll("#main-content table") - - tables.forEach(table => { - if (table.classList.contains("mobile-table")) return - const courseInfo = document.getElementById("desktop-course-info") - if (!courseInfo) return - const rect1 = table.getBoundingClientRect() - const rect2 = courseInfo.getBoundingClientRect() - const overlap = !( - rect1.right < rect2.left || - rect1.left > rect2.right || - rect1.bottom < rect2.top || - rect1.top > rect2.bottom - ) - if (overlap) { - table.classList.add("mobile-table") - } - }) -} - -initResponsiveTables() diff --git a/course/assets/js/video-download-button.js b/course/assets/js/video-download-button.js deleted file mode 100644 index 4281abde0..000000000 --- a/course/assets/js/video-download-button.js +++ /dev/null @@ -1,83 +0,0 @@ -//@ts-nocheck -import videojs from "video.js" - -function _createDownloadMenuItems() { - const MenuItems = videojs.getComponent("MenuItem") - const DownloadMenuItems = videojs.extend(MenuItems, { - constructor: function(player, options) { - options.selectable = false - MenuItems.call(this, player, options) - }, - handleClick: function() { - window.open(this.options_.link, "_black").focus() - } - }) - MenuItems.registerComponent("DownloadMenuItems", DownloadMenuItems) -} - -function _createDownloadbutton() { - const MenuButton = videojs.getComponent("MenuButton") - const DownloadMenuButton = videojs.extend(MenuButton, { - constructor: function(player, options) { - this.label = document.createElement("span") - this.values = options.values - options.label = "download options" - - MenuButton.call(this, player, options) - this.$("button").classList.add("vjs-download-button") - this.el().setAttribute("aria-label", "download button") - this.el().classList.add("download-button-position") - this.controlText("download button") - }, - createItems: function() { - const menuItems = [] - const DownloadMenuItems = videojs.getComponent("DownloadMenuItems") - this.values - .filter(item => item[1]) - .map(item => { - menuItems.push( - new DownloadMenuItems(this.player_, { - label: item[0], - link: item[1] - }) - ) - }) - return menuItems - } - }) - MenuButton.registerComponent("DownloadMenuButton", DownloadMenuButton) -} - -export function initDownloadButton() { - _createDownloadMenuItems() - _createDownloadbutton() - - const DownloadMenuButton = videojs.getComponent("DownloadMenuButton") - - if (document.querySelector(".video-container")) { - const videoPlayers = document.querySelectorAll(".vjs-ocw") - for (const videoPlayer of Array.from(videoPlayers)) { - const player = videojs(videoPlayer.id) - const videoDownloadLink = - videoPlayer.getAttribute("data-downloadlink") ?? false - const transcriptDownloadLink = - videoPlayer.getAttribute("data-transcriptLink") ?? false - const options = [ - ["Download video", videoDownloadLink], - ["Download transcript", transcriptDownloadLink] - ] - player.ready(() => { - const downloadButton = new DownloadMenuButton(player, { - values: options - }) - player.controlBar.downloadButton = player.controlBar.el_.insertBefore( - downloadButton.el_, - player.controlBar.getChild("fullscreenToggle").el_ - ) - player.controlBar.downloadButton.dispose = function() { - this.parentNode.removeChild(this) - } - }) - } - } -} diff --git a/course/assets/js/video_fullscreen_toggle.js b/course/assets/js/video_fullscreen_toggle.js deleted file mode 100644 index ecf9ed2ad..000000000 --- a/course/assets/js/video_fullscreen_toggle.js +++ /dev/null @@ -1,23 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-nocheck - -export const initVideoFullscreenToggle = () => { - // this fixes the issue of control bar going to the top on fullscreen - $(document).on( - "mozfullscreenchange webkitfullscreenchange fullscreenchange", - function() { - const fullscreenElement = - document.fullscreenElement || - document.mozFullScreenElement || - document.webkitFullscreenElement || - document.msFullscreenElement - if (fullscreenElement) { - // entering full screen - $(".vjs-control-bar").css("bottom", 0) - } else { - // exiting full screen - $(".vjs-control-bar").css("bottom", "auto") - } - } - ) -} diff --git a/course/assets/js/video_playback_speed.js b/course/assets/js/video_playback_speed.js deleted file mode 100644 index 918a17d23..000000000 --- a/course/assets/js/video_playback_speed.js +++ /dev/null @@ -1,85 +0,0 @@ -//@ts-nocheck -import videojs from "video.js" - -function _initMenuItems() { - const MenuItems = videojs.getComponent("MenuItem") - const SettingMenuItems = videojs.extend(MenuItems, { - constructor: function(player, options) { - options.selectable = true - MenuItems.call(this, player, options) - player.on("onPlaybackRateChange", videojs.bind(this, this.update)) - }, - handleClick: function() { - this.player_.tech_.ytPlayer.setPlaybackRate(this.options_.label) - this.player_.currentPlaybackRate = this.options_.label - this.player_.trigger("onPlaybackRateChange") - }, - update: function() { - const selection = this.player_.currentPlaybackRate - this.selected(this.options_.label === selection) - } - }) - MenuItems.registerComponent("SettingMenuItems", SettingMenuItems) -} - -function _initMenuButton() { - const MenuButton = videojs.getComponent("MenuButton") - const SettingMenuButton = videojs.extend(MenuButton, { - constructor: function(player, options) { - this.label = document.createElement("span") - this.playbackSpeeds = options.playbackSpeeds - options.label = "playback speed" - - MenuButton.call(this, player, options) - this.$("button").classList.add("vjs-quality-selector") - this.el().setAttribute("aria-label", "playback speed") - this.el().classList.add("playback-button-position") - this.controlText("playback speed") - }, - createItems: function() { - const menuItems = [] - const SettingMenuItems = videojs.getComponent("SettingMenuItems") - this.playbackSpeeds.map(item => { - menuItems.push( - new SettingMenuItems(this.player_, { - label: item, - selected: item === this.player_.playbackRate() - }) - ) - }) - return menuItems - } - }) - - // ready function - MenuButton.registerComponent("SettingMenuButton", SettingMenuButton) -} - -export const initPlayBackSpeedButton = () => { - _initMenuItems() - _initMenuButton() - - const SettingMenuButton = videojs.getComponent("SettingMenuButton") - - if (document.querySelector(".video-container")) { - const videoPlayers = document.querySelectorAll(".vjs-ocw") - for (const videoPlayer of Array.from(videoPlayers)) { - const player = videojs(videoPlayer.id) - player.ready(function() { - const playbackRates = [0.25, 0.5, 0.75, 1, 1.25, 1.5] - const menuButton = new SettingMenuButton(player, { - playbackSpeeds: playbackRates, - title: "Playback speed" - }) - player.controlBar.resolutionSwitcher = - player.controlBar.el_.insertBefore( - menuButton.el_, - player.controlBar.el().lastChild.nextSibling - ) - player.controlBar.resolutionSwitcher.dispose = function() { - this.parentNode.removeChild(this) - } - }) - } - } -} diff --git a/course/assets/js/video_transcript_track.js b/course/assets/js/video_transcript_track.js deleted file mode 100644 index 72479f214..000000000 --- a/course/assets/js/video_transcript_track.js +++ /dev/null @@ -1,34 +0,0 @@ -import videojs from "video.js" - -export const initVideoTranscriptTrack = () => { - if (document.querySelector(".video-container")) { - const videoPlayers = document.querySelectorAll(".vjs-ocw") - - for (const videoPlayer of Array.from(videoPlayers)) { - videojs(videoPlayer.id).ready(function() { - // @ts-expect-error TODO - window.videojs = videojs - require("videojs-transcript-ac") - - const options = { - showTitle: false, - showTrackSelector: false - } - - // @ts-expect-error TODO - const transcript = this.transcript(options) - - if (videoPlayer.closest(".video-page")) { - // @ts-expect-error TODO - const transcriptContainer = videoPlayer - .closest(".video-page") - .querySelector(".transcript") - - if (transcriptContainer) { - transcriptContainer.appendChild(transcript.el()) - } - } - }) - } - } -} diff --git a/course/content/learning_resource_types/_index.md b/course/content/learning_resource_types/_index.md deleted file mode 100644 index f10d8d4fe..000000000 --- a/course/content/learning_resource_types/_index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Resources -url: /resources/ -kind: taxonomy ---- diff --git a/course/go.mod b/course/go.mod deleted file mode 100644 index 1b04550a1..000000000 --- a/course/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/mitodl/ocw-hugo-themes/course - -go 1.16 diff --git a/course/layouts/_default/baseof.coursedata.json b/course/layouts/_default/baseof.coursedata.json deleted file mode 100644 index df5fa0e04..000000000 --- a/course/layouts/_default/baseof.coursedata.json +++ /dev/null @@ -1 +0,0 @@ -{{ block "main" . }}{{ end }} diff --git a/course/layouts/_default/baseof.html b/course/layouts/_default/baseof.html deleted file mode 100644 index adb9c20bd..000000000 --- a/course/layouts/_default/baseof.html +++ /dev/null @@ -1,71 +0,0 @@ -{{- $gtmId := getenv "GTM_ACCOUNT_ID" -}} - - -{{ partial "head.html" . }} - - {{ if $gtmId }} - - - - {{ end }} -
- {{ partialCached "mobile_course_nav.html" . }} - {{ partialCached "mobile_course_info.html" . }} - {{ block "header" . }}{{ partialCached "header" . }}{{ end }} - {{ $isCourseHomePage := (eq .Params.layout "course_home") }} - {{ if not $isCourseHomePage }} -
- -
- {{ end }} - {{ block "subheader" . }}{{ partial "course_banner.html" . }}{{ end }} -
-
- {{ partialCached "desktop_nav.html" . }} -
-
-
-
-
-
- {{ if not $isCourseHomePage }} - - {{ end }} - {{ block "main" . }}{{ end }} -
- {{ if not $isCourseHomePage }} - {{ partialCached "desktop_course_info.html" . }} - {{ end }} -
-
-
-
-
-
- {{ block "footer" . }}{{ partial "footer" . }}{{end}} - {{ partialCached "hide_offline_links.html" . }} -
- {{ partialCached "navigation_js.html" . }} - {{ partialCached "responsive_tables_js.html" . }} - {{- $theme := .Site.Data.webpack.main -}} - {{- $courseTheme := .Site.Data.webpack.course -}} - - {{ partial "include_js.html" (dict "context" . "url" $theme.js) }} - {{ partial "include_js.html" (dict "context" . "url" $courseTheme.js) }} - {{ partial "mathjax_if_necessary.html" (dict "context" .) }} - - - - - - - - diff --git a/course/layouts/_default/section.coursedata.json b/course/layouts/_default/section.coursedata.json deleted file mode 100644 index a821dfabb..000000000 --- a/course/layouts/_default/section.coursedata.json +++ /dev/null @@ -1,3 +0,0 @@ -{{ define "main" }} -{{ partial "course_content.json" . }} -{{ end }} diff --git a/course/layouts/home.html b/course/layouts/home.html deleted file mode 100644 index fe10c02a2..000000000 --- a/course/layouts/home.html +++ /dev/null @@ -1,113 +0,0 @@ -{{- $gtmId := getenv "GTM_ACCOUNT_ID" -}} -{{- $courseData := .Site.Data.course -}} -{{- $imageData := partial "course-image-url.html" . -}} -{{- $courseImageUrl := index $imageData 0 -}} -{{- $courseImageMetadata := index $imageData 1 -}} - - -{{ partial "head.html" . }} - - {{ if $gtmId }} - - - - {{ end }} -
- {{ partialCached "mobile_course_nav.html" . }} - {{ partialCached "mobile_course_info.html" . }} - {{ block "header" . }}{{ partialCached "header" . }}{{ end }} - {{ block "subheader" . }}{{ partial "course_banner.html" . }}{{ end }} -
-
- {{ partialCached "desktop_nav.html" . }} -
-
-
-
-
-
-
-
-
- {{- $imageCaption := $courseImageMetadata.Params.image_metadata.caption -}} - {{ $shouldCollapseImageDescription := gt (len $imageCaption) 130 }} -
-
- {{ index $courseImageMetadata.Params.image_metadata - - {{ if $shouldCollapseImageDescription }} -
- -
- {{ end }} -
-
-
- {{ partial "mobile_nav_toggle.html" . }} -
- - {{ $shouldCollapseDescription := false}} - {{ with $courseData.course_description }} - {{ $shouldCollapseDescription = gt (len .) 320 }} - {{ end }} -
-

Course Description

- -
- {{ if $shouldCollapseDescription }} -
- -
- {{ end }} -
- {{ partial "course_info.html" (dict "context" . "inPanel" false) }} -
-
-
-
- {{ partial "learning_resource_types.html" (dict "context" . "inPanel" false) }} -
-
-
-
-
-
-
-
-
-
-
- {{ block "footer" . }}{{ partial "footer" . }}{{end}} - {{ partialCached "hide_offline_links.html" . }} -
- {{ partialCached "navigation_js.html" . }} - {{ partialCached "responsive_tables_js.html" . }} - {{- $theme := .Site.Data.webpack.main -}} - {{- $courseTheme := .Site.Data.webpack.course -}} - - {{ partial "include_js.html" (dict "context" . "url" $theme.js) }} - {{ partial "include_js.html" (dict "context" . "url" $courseTheme.js) }} - {{ partial "mathjax_if_necessary.html" (dict "context" .) }} - - - - - - - - diff --git a/course/layouts/index.contentmap.json b/course/layouts/index.contentmap.json deleted file mode 100644 index 88009ddc3..000000000 --- a/course/layouts/index.contentmap.json +++ /dev/null @@ -1,5 +0,0 @@ -{{- $contentMap := dict -}} -{{- range where $.Site.Pages "Params.uid" "!=" nil -}} - {{- $contentMap = merge $contentMap (dict .Params.uid .RelPermalink) -}} -{{- end -}} -{{- $contentMap | jsonify -}} diff --git a/course/layouts/index.coursedata.json b/course/layouts/index.coursedata.json deleted file mode 100644 index b16c22e55..000000000 --- a/course/layouts/index.coursedata.json +++ /dev/null @@ -1,39 +0,0 @@ -{{- $courseData := .Site.Data.course -}} -{{- $courseImageUrl := index (partial "course-image-url.html" .) 0 -}} -{{- $courseImageMetadata := index (partial "course-image-url.html" .) 1 -}} - -{ - "course_title": {{- $courseData.course_title | jsonify -}}, - "course_description": {{- $courseData.course_description | jsonify -}}, - "site_uid": {{- $courseData.site_uid | jsonify -}}, - "legacy_uid": {{- $courseData.legacy_uid | jsonify -}}, - {{- with $courseData.instructors.content -}} - {{- $instructors := partial "get_instructors.html" . -}} - "instructors": [ - {{- range $index, $instructor := $instructors -}} - {{- if $index -}} - , - {{- end -}} - { - "first_name": {{- $instructor.first_name | jsonify -}}, - "last_name": {{- $instructor.last_name | jsonify -}}, - "middle_initial": {{- $instructor.middle_initial | jsonify -}}, - "salutation": {{- $instructor.salutation | jsonify -}}, - "title": {{- $instructor.title | jsonify -}} - } - {{- end }}], - {{- else -}} - "instructors": [], - {{- end -}} - "department_numbers": {{- $courseData.department_numbers | jsonify -}}, - "learning_resource_types": {{- $courseData.learning_resource_types | jsonify -}}, - "topics": {{- $courseData.topics | jsonify -}}, - "primary_course_number": {{- $courseData.primary_course_number | jsonify -}}, - "extra_course_numbers": {{- $courseData.extra_course_numbers | jsonify -}}, - "term": {{- $courseData.term | jsonify -}}, - "year": {{- $courseData.year | jsonify -}}, - "level": {{- $courseData.level | jsonify -}}, - "image_src": {{- $courseImageUrl | jsonify -}}, - "course_image_metadata": {{- $courseImageMetadata.Params | jsonify -}} -} - diff --git a/course/layouts/learning_resource_types/taxonomy.html b/course/layouts/learning_resource_types/taxonomy.html deleted file mode 100644 index 07b8c83d6..000000000 --- a/course/layouts/learning_resource_types/taxonomy.html +++ /dev/null @@ -1,51 +0,0 @@ -{{ define "main" }} -{{ partial "course_content.html" . }} - -{{ $numberOfResourcesLimit := 10 }} -{{ $showNoResourcesFoundMessage := true }} -{{ $taxonomy := "learning_resource_types" }} - -
- {{ with ($.Site.GetPage (printf "/%s" $taxonomy)) }} - {{ with .Pages }} - {{ range . }} - - {{ $resources := where .Pages "Params.content_type" "resource" }} - {{ $numberOfResources := len $resources }} - {{ if gt $numberOfResources 0 }} - - {{ $showNoResourcesFoundMessage = false }} - {{ $limitedResourcesShown := false }} - - {{ if gt $numberOfResources $numberOfResourcesLimit }} - {{ $numberOfResources = $numberOfResourcesLimit }} - {{ $limitedResourcesShown = true }} - {{ end }} - -
-

{{ .Title }}

-
- - {{ partial "resource_list.html" (dict "resources" $resources "limitResources" $numberOfResources) }} - - {{ if eq $limitedResourcesShown true }} -
-
- {{ partial "see_all.html" (dict "permalink" .Permalink) }} -
-
- {{ end }} -
- {{ end }} - {{ end }} - {{ else }} - {{ $showNoResourcesFoundMessage = false }} - {{ partial "no_resources_found.html" }} - {{ end }} - {{ end }} - - {{ if eq $showNoResourcesFoundMessage true }} - {{ partial "no_resources_found.html" }} - {{ end }} -
-{{ end }} diff --git a/course/layouts/learning_resource_types/term.html b/course/layouts/learning_resource_types/term.html deleted file mode 100644 index 7069d37fa..000000000 --- a/course/layouts/learning_resource_types/term.html +++ /dev/null @@ -1,8 +0,0 @@ -{{ define "main" }} -{{ partial "course_content.html" . }} - -
- {{ $resources := where .Pages "Params.content_type" "resource" }} - {{ partial "resource_list.html" (dict "resources" $resources) }} -
-{{ end }} diff --git a/course/layouts/lists/single.html b/course/layouts/lists/single.html deleted file mode 100644 index 9a2e773e3..000000000 --- a/course/layouts/lists/single.html +++ /dev/null @@ -1,18 +0,0 @@ -{{ define "main" }} - - {{- $bundle := . -}} - {{- $uids := .Params.resources.content -}} - {{- $resources := slice -}} - - {{ partial "course_content.html" . }} -
-
- {{ $bundle.Description | .RenderString }} -
- {{ range $id := $uids }} - {{ $page := where $.Site.Pages "Params.uid" $id }} - {{ $resources = $resources | append (index $page 0) }} - {{ end }} - {{- partial "resource_list.html" (dict "resources" $resources "sort" false) -}} -
-{{ end }} diff --git a/course/layouts/pages/instructor_insights.html b/course/layouts/pages/instructor_insights.html deleted file mode 100644 index 58947f811..000000000 --- a/course/layouts/pages/instructor_insights.html +++ /dev/null @@ -1,3 +0,0 @@ -{{ define "main" }} -{{ partial "course_content.html" . }} -{{ end }} diff --git a/course/layouts/pages/section.html b/course/layouts/pages/section.html deleted file mode 100644 index 58947f811..000000000 --- a/course/layouts/pages/section.html +++ /dev/null @@ -1,3 +0,0 @@ -{{ define "main" }} -{{ partial "course_content.html" . }} -{{ end }} diff --git a/course/layouts/pages/single.coursedata.json b/course/layouts/pages/single.coursedata.json deleted file mode 100644 index a821dfabb..000000000 --- a/course/layouts/pages/single.coursedata.json +++ /dev/null @@ -1,3 +0,0 @@ -{{ define "main" }} -{{ partial "course_content.json" . }} -{{ end }} diff --git a/course/layouts/pages/single.html b/course/layouts/pages/single.html deleted file mode 100644 index 58947f811..000000000 --- a/course/layouts/pages/single.html +++ /dev/null @@ -1,3 +0,0 @@ -{{ define "main" }} -{{ partial "course_content.html" . }} -{{ end }} diff --git a/course/layouts/partials/archived_versions.html b/course/layouts/partials/archived_versions.html deleted file mode 100644 index d5095ec1e..000000000 --- a/course/layouts/partials/archived_versions.html +++ /dev/null @@ -1,14 +0,0 @@ -{{ $courseData := .Site.Data.course }} -{{ $archivedVersions := $courseData.archived_versions }} -{{ if gt (len $archivedVersions) 0}} -
-
-

ARCHIVED OCW VERSIONS

-
    - {{ range $archivedVersions }} -
  • {{ . | markdownify }}
  • - {{ end }} -
-
-
-{{ end }} diff --git a/course/layouts/partials/course-image-url.html b/course/layouts/partials/course-image-url.html deleted file mode 100644 index 782eaa7f3..000000000 --- a/course/layouts/partials/course-image-url.html +++ /dev/null @@ -1,8 +0,0 @@ -{{- $courseData := .Site.Data.course -}} -{{- $courseImageUid := $courseData.course_image.content -}} -{{- $courseImageMetadata := (dict "Params" (dict "file" "None" "image_metadata" (dict "image-alt" "" "caption" ""))) -}} -{{- if $courseImageUid -}} -{{- $courseImageMetadata = partial "resource_metadata.html" $courseImageUid }} -{{- end -}} -{{- $courseImageUrl := partial "resource_url.html" (dict "context" . "url" $courseImageMetadata.Params.file) -}} -{{ return (slice $courseImageUrl $courseImageMetadata )}} diff --git a/course/layouts/partials/course_banner.html b/course/layouts/partials/course_banner.html deleted file mode 100644 index db14c5a3e..000000000 --- a/course/layouts/partials/course_banner.html +++ /dev/null @@ -1,11 +0,0 @@ -{{- $bannerClass := "text-uppercase display-4 font-weight-bold m-0 text-white" -}} -{{- $currentPage := . -}} -
-
- {{- $courseData := .Site.Data.course -}} - {{ $courseData.course_title }} -
-
diff --git a/course/layouts/partials/course_content.html b/course/layouts/partials/course_content.html deleted file mode 100644 index 2c060f702..000000000 --- a/course/layouts/partials/course_content.html +++ /dev/null @@ -1,8 +0,0 @@ -{{ $shouldCollapseTitle := gt (len .Title) 75 }} -
- {{ partial "content_header.html" . }} - {{ partial "mobile_nav_toggle.html" . }} -
-
{{- .Content -}}
-
-
diff --git a/course/layouts/partials/course_content.json b/course/layouts/partials/course_content.json deleted file mode 100644 index ff717e8c7..000000000 --- a/course/layouts/partials/course_content.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "title": {{- .Title | jsonify -}}, - "content": {{- .Plain | jsonify -}} -} \ No newline at end of file diff --git a/course/layouts/partials/course_info.html b/course/layouts/partials/course_info.html deleted file mode 100644 index d759e5b95..000000000 --- a/course/layouts/partials/course_info.html +++ /dev/null @@ -1,70 +0,0 @@ -{{ $courseData := .context.Site.Data.course }} -{{ $inPanel := .inPanel }} -
-
-

Course Info

-
- -
-
- {{ if not $inPanel }} -
- -
- {{ end }} -
diff --git a/course/layouts/partials/desktop_course_info.html b/course/layouts/partials/desktop_course_info.html deleted file mode 100644 index 415e15e49..000000000 --- a/course/layouts/partials/desktop_course_info.html +++ /dev/null @@ -1,5 +0,0 @@ -
- {{ partial "course_info.html" (dict "context" . "inPanel" true) }} - {{ partial "topics.html" (dict "context" . "inPanel" true) }} - {{ partial "learning_resource_types.html" (dict "context" . "inPanel" true) }} -
diff --git a/course/layouts/partials/desktop_nav.html b/course/layouts/partials/desktop_nav.html deleted file mode 100644 index 45dad3888..000000000 --- a/course/layouts/partials/desktop_nav.html +++ /dev/null @@ -1,5 +0,0 @@ -
-
- {{ partial "nav.html" . }} -
-
diff --git a/course/layouts/partials/extrahead.html b/course/layouts/partials/extrahead.html deleted file mode 100644 index 0f9013ed8..000000000 --- a/course/layouts/partials/extrahead.html +++ /dev/null @@ -1,10 +0,0 @@ -{{- define "title" -}}{{ partial "title.html" . }}{{- end -}} -{{- define "extrahead" -}} -{{- $layout := .Params.layout -}} -{{- $instructorInsights := .Site.Data.webpack.instructor_insights -}} -{{- $courseTheme := .Site.Data.webpack.course -}} -{{- if eq $layout "instructor_insights" -}} -{{ partial "include_css.html" (dict "context" . "url" $instructorInsights.css) }} -{{- end -}} -{{ partial "include_css.html" (dict "context" . "url" $courseTheme.css) }} -{{- end -}} diff --git a/course/layouts/partials/get_departments.html b/course/layouts/partials/get_departments.html deleted file mode 100644 index d0b8c2441..000000000 --- a/course/layouts/partials/get_departments.html +++ /dev/null @@ -1,7 +0,0 @@ -{{ $departments := slice }} -{{ range . }} -{{ $department := index site.Data.departments . }} -{{ $department := merge $department (dict "url" (partial "get_search_url.html" (dict "key" "department_numbers" "value" $department.title))) }} -{{ $departments = $departments | append $department }} -{{ end }} -{{ return $departments }} \ No newline at end of file diff --git a/course/layouts/partials/get_instructors.html b/course/layouts/partials/get_instructors.html deleted file mode 100644 index c5c1a2bd1..000000000 --- a/course/layouts/partials/get_instructors.html +++ /dev/null @@ -1,20 +0,0 @@ -{{ $instructors := slice }} -{{ range . }} - {{ $staticApiBaseUrl := getenv "STATIC_API_BASE_URL" }} - {{ $url := (print (strings.TrimSuffix "/" $staticApiBaseUrl) "/instructors/" . "/index.json") }} - {{ with resources.GetRemote $url }} - {{ with .Err }} - {{ $errorMessage := printf "Something went wrong while fetching instructors on %v via %v with error: %v" site.BaseURL $url .Err }} - {{ partial "sentry_capture_message.html" $errorMessage }} - {{ else }} - {{ $data := (. | unmarshal).data }} - {{ $searchUrl := partial "get_search_url.html" (dict "key" "instructors" "value" (title $data.title)) }} - {{ $instructor := merge $data (dict "url" $searchUrl) }} - {{ $instructors = $instructors | append $instructor }} - {{ end }} - {{ else }} - {{ $errorMessage := printf "Failed to fetch course instructors through %v on %v" $url site.BaseURL }} - {{ partial "sentry_capture_message.html" $errorMessage }} - {{ end }} -{{ end }} -{{ return $instructors }} diff --git a/course/layouts/partials/get_resource_download_link.html b/course/layouts/partials/get_resource_download_link.html deleted file mode 100644 index 2d35cb0c7..000000000 --- a/course/layouts/partials/get_resource_download_link.html +++ /dev/null @@ -1,10 +0,0 @@ -{{- $resourceParams := . -}} -{{- $downloadLink := $resourceParams.file | default nil -}} - -{{ if and (eq $downloadLink nil) (eq $resourceParams.resourceType "Video") }} - {{ $downloadLink = $resourceParams.video_files.archive_url }} -{{ else if $downloadLink }} - {{ $downloadLink = partial "resource_url.html" (dict "context" . "url" $downloadLink) }} -{{ end }} - -{{ return $downloadLink }} diff --git a/course/layouts/partials/get_resource_thumbnail_src.html b/course/layouts/partials/get_resource_thumbnail_src.html deleted file mode 100644 index 14d0b8f2b..000000000 --- a/course/layouts/partials/get_resource_thumbnail_src.html +++ /dev/null @@ -1,14 +0,0 @@ -{{- $resourceType := .resourceType -}} -{{- $resourceThumbnailSrc := "/images/file_thumbnail.png" -}} - -{{ if eq $resourceType "Document" }} - {{- $resourceThumbnailSrc = "/images/pdf_thumbnail.png" -}} -{{ else if eq $resourceType "Image" }} - {{- $resourceThumbnailSrc = "/images/file_thumbnail.png" -}} -{{ else if eq $resourceType "Video" }} -{{- $resourceThumbnailSrc = "/images/mobile_video_thumbnail.png" -}} -{{ else if eq $resourceType "Other" }} - {{- $resourceThumbnailSrc = "/images/file_thumbnail.png" -}} -{{ end }} - -{{ return $resourceThumbnailSrc }} diff --git a/course/layouts/partials/hierarchical_select_as_map.html b/course/layouts/partials/hierarchical_select_as_map.html deleted file mode 100644 index 8083ec7a7..000000000 --- a/course/layouts/partials/hierarchical_select_as_map.html +++ /dev/null @@ -1,14 +0,0 @@ -{{- $scratch := newScratch -}} -{{ $scratch.Set "combined" dict }} - -{{ range $topicGroup := . }} - {{ $scratch.Set "inner" nil }} - - {{ range $index := seq (len $topicGroup) }} - {{ $scratch.Set "inner" (dict (index $topicGroup (sub (len $topicGroup) $index)) ($scratch.Get "inner")) }} - {{ end }} - - {{ $scratch.Set "combined" (merge ($scratch.Get "combined") ($scratch.Get "inner" | default dict)) }} -{{ end }} - -{{- return $scratch.Get "combined" -}} diff --git a/course/layouts/partials/learning_resource_type.html b/course/layouts/partials/learning_resource_type.html deleted file mode 100644 index f17cf56a5..000000000 --- a/course/layouts/partials/learning_resource_type.html +++ /dev/null @@ -1,36 +0,0 @@ -
- - {{- if eq . "Course Introduction" -}} - groups - {{- else if in . "Audio" -}} - equalizer - {{- else if in . "Video" -}} - theaters - {{- else if or (in . "Problem Sets") (in . "Assignment") -}} - {{- if or (in . "with Examples") (in . "with Solutions") -}} - assignment_turned_in - {{- else -}} - assignment - {{- end -}} - {{- else if in . "Exams" -}} - grading - {{- else if eq . "Image Gallery" -}} - collections - {{- else if eq . "Lecture Notes" -}} - notes - {{- else if eq . "Online Textbook" -}} - menu_book - {{- else if in . "Projects" -}} - group_work - {{- else if in . "Simulations" -}} - laptop_windows - {{- else if in . "Instructor Insights" -}} - - co_present - - {{- end -}} - - - {{- . -}} - -
\ No newline at end of file diff --git a/course/layouts/partials/learning_resource_types.html b/course/layouts/partials/learning_resource_types.html deleted file mode 100644 index 9aa87c1bb..000000000 --- a/course/layouts/partials/learning_resource_types.html +++ /dev/null @@ -1,17 +0,0 @@ -{{ $courseData := .context.Site.Data.course }} -{{ $inPanel := .inPanel }} - -{{ if gt (len ($courseData.learning_resource_types | default slice)) 0 }} -
-
-

Learning Resource Types

-
- {{ range $courseData.learning_resource_types }} -
- {{ partial "learning_resource_type.html" . }} -
- {{ end }} -
-
-
-{{end}} diff --git a/course/layouts/partials/mobile_course_info.html b/course/layouts/partials/mobile_course_info.html deleted file mode 100644 index 0f4438c78..000000000 --- a/course/layouts/partials/mobile_course_info.html +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/course/layouts/partials/mobile_course_nav.html b/course/layouts/partials/mobile_course_nav.html deleted file mode 100644 index 869dfa06b..000000000 --- a/course/layouts/partials/mobile_course_nav.html +++ /dev/null @@ -1,6 +0,0 @@ - diff --git a/course/layouts/partials/mobile_nav_toggle.html b/course/layouts/partials/mobile_nav_toggle.html deleted file mode 100644 index 597a191cc..000000000 --- a/course/layouts/partials/mobile_nav_toggle.html +++ /dev/null @@ -1,12 +0,0 @@ -
- -
\ No newline at end of file diff --git a/course/layouts/partials/nav.html b/course/layouts/partials/nav.html deleted file mode 100644 index 9bfc013e2..000000000 --- a/course/layouts/partials/nav.html +++ /dev/null @@ -1,8 +0,0 @@ -{{ $menu := index .Site.Menus "leftnav" }} - diff --git a/course/layouts/partials/nav_item.html b/course/layouts/partials/nav_item.html deleted file mode 100644 index 377cf6dee..000000000 --- a/course/layouts/partials/nav_item.html +++ /dev/null @@ -1,37 +0,0 @@ -{{ $id := .menuItem.Identifier }} -{{ $hasParent := isset . "parentId" }} -{{ $hasChildren := .menuItem.HasChildren }} -{{ $url := partial "nav_url.html" . }} - -
  • -
    - - - {{ .menuItem.Name }} - - - {{ if .menuItem.HasChildren }} - - - - {{ end }} -
    - {{ if or (not $hasParent) $hasChildren }} -
    - {{ end }} - -
  • diff --git a/course/layouts/partials/nav_url.html b/course/layouts/partials/nav_url.html deleted file mode 100644 index 039c480da..000000000 --- a/course/layouts/partials/nav_url.html +++ /dev/null @@ -1 +0,0 @@ -{{ return .menuItem.URL }} diff --git a/course/layouts/partials/navigation_js.html b/course/layouts/partials/navigation_js.html deleted file mode 100644 index 42d7ffb5b..000000000 --- a/course/layouts/partials/navigation_js.html +++ /dev/null @@ -1,5 +0,0 @@ -{{ $navjs := resources.Get "js/navigation.js" }} -{{ $minified := $navjs | resources.Minify }} - diff --git a/course/layouts/partials/no_resources_found.html b/course/layouts/partials/no_resources_found.html deleted file mode 100644 index abf24128f..000000000 --- a/course/layouts/partials/no_resources_found.html +++ /dev/null @@ -1,3 +0,0 @@ -
    -

    No Resources Found.

    -
    \ No newline at end of file diff --git a/course/layouts/partials/open_learning_library_versions.html b/course/layouts/partials/open_learning_library_versions.html deleted file mode 100644 index 0ec0e5dae..000000000 --- a/course/layouts/partials/open_learning_library_versions.html +++ /dev/null @@ -1,15 +0,0 @@ -{{ $courseData := .Site.Data.course }} -{{ $openLearningLibraryVersions := $courseData.open_learning_library_versions }} -{{ if gt (len $openLearningLibraryVersions) 0}} -
    -
    -

    INTERACTIVE ASSESSMENTS WITH OPEN LEARNING LIBRARY

    -

    Other versions of this course on MIT Open Learning Library have interactive assessments and progress tracking to better support independent learning.

    -
      - {{ range $openLearningLibraryVersions }} -
    • {{ . | markdownify }}
    • - {{ end }} -
    -
    -
    -{{ end }} \ No newline at end of file diff --git a/course/layouts/partials/other_versions.html b/course/layouts/partials/other_versions.html deleted file mode 100644 index 352f558a9..000000000 --- a/course/layouts/partials/other_versions.html +++ /dev/null @@ -1,15 +0,0 @@ -{{ $courseData := .Site.Data.course }} -{{ $otherVersions := $courseData.other_versions }} -{{ if gt (len $otherVersions) 0}} -
    -
    -

    OTHER {{ index $courseData.primary_course_number }} OFFERINGS ON OPENCOURSEWARE

    -

    OCW has multiple versions of this course as taught in different terms by different faculty, with distinct materials and pedagogy.

    -
      - {{ range $otherVersions }} -
    • {{ . | markdownify }}
    • - {{ end }} -
    -
    -
    -{{ end }} \ No newline at end of file diff --git a/course/layouts/partials/partial_collapse_list.html b/course/layouts/partials/partial_collapse_list.html deleted file mode 100644 index 0d37663ea..000000000 --- a/course/layouts/partials/partial_collapse_list.html +++ /dev/null @@ -1,58 +0,0 @@ -{{ $params := . }} -{{ $className := .klass | default "coming-soon" }} -{{ $useLinks := .useLinks | default true }} -{{ $showCollapse := .showCollapse | default true }} -{{ if and (gt (len .list) 4) $showCollapse }} -
    - -
    -
      - {{ range $item := .list }} - {{ $text := "" }} - {{ if isset $params "key" }} - {{ $text = index $item $params.key }} - {{ else }} - {{ $text = $item }} - {{ end }} -
    • - {{ if $useLinks }} - - {{ $text }} - - {{ else }} - {{ $text }} - {{ end }} -
    • - {{ end }} -
    -
    -
    -
    -{{ else }} - -{{ end }} diff --git a/course/layouts/partials/quiz_multiple_choice_choice.html b/course/layouts/partials/quiz_multiple_choice_choice.html deleted file mode 100644 index fe73fd401..000000000 --- a/course/layouts/partials/quiz_multiple_choice_choice.html +++ /dev/null @@ -1,13 +0,0 @@ -
    - - {{.choiceText}} - {{ if eq .correct "true" }} - - check - - {{ else }} - - close - - {{end}} -
    \ No newline at end of file diff --git a/course/layouts/partials/quiz_multiple_choice_solution.html b/course/layouts/partials/quiz_multiple_choice_solution.html deleted file mode 100644 index 2507846af..000000000 --- a/course/layouts/partials/quiz_multiple_choice_solution.html +++ /dev/null @@ -1,18 +0,0 @@ -
    - - Check - - {{if .solution }} -   - - Show Solution - - {{end}} -
    -{{if .solution }} -
    -

    - {{.solution}} -

    -
    -{{end}} \ No newline at end of file diff --git a/course/layouts/partials/resource_list.html b/course/layouts/partials/resource_list.html deleted file mode 100644 index 9e22bd1e4..000000000 --- a/course/layouts/partials/resource_list.html +++ /dev/null @@ -1,24 +0,0 @@ -{{- $hideThumbnail := .hideThumbnail | default false -}} -{{- $hideDownloadIcon := .hideDownloadIcon | default false -}} -{{- $defaultSort := .sort | default true -}} - -{{ $resources := .resources }} -{{ $numberOfResources := len $resources }} - -{{ $limitResources := .limitResources | default $numberOfResources }} - -{{ if gt $numberOfResources 0 }} - {{ if $defaultSort }} - {{ range sort (first $limitResources $resources) .Params "title" }} - {{- partial "resource_list_item.html" (dict "params" .Params "permalink" .Permalink "hideThumbnail" $hideThumbnail "hideDownloadIcon" $hideDownloadIcon) -}} -
    - {{end}} - {{ else }} - {{ range (first $limitResources $resources)}} - {{- partial "resource_list_item.html" (dict "params" .Params "permalink" .Permalink "hideThumbnail" $hideThumbnail "hideDownloadIcon" $hideDownloadIcon) -}} -
    - {{ end }} - {{ end }} -{{ else }} - {{ partial "no_resources_found.html" }} -{{ end }} diff --git a/course/layouts/partials/resource_list_item.html b/course/layouts/partials/resource_list_item.html deleted file mode 100644 index e800c3b2f..000000000 --- a/course/layouts/partials/resource_list_item.html +++ /dev/null @@ -1,32 +0,0 @@ -
    -
    -
    - {{ if not .hideThumbnail }} - {{ $thumbnailSrc := partial "get_resource_thumbnail_src.html" (dict "resourceType" .params.resourcetype) }} - - {{ end }} - - {{ if not .hideDownloadIcon }} - {{ $downloadableLink := partial "get_resource_download_link.html" .params }} - - {{ if $downloadableLink }} - - - - {{ end }} - - {{ end }} - -
    -
    -
    diff --git a/course/layouts/partials/responsive_tables_js.html b/course/layouts/partials/responsive_tables_js.html deleted file mode 100644 index 89d6af03a..000000000 --- a/course/layouts/partials/responsive_tables_js.html +++ /dev/null @@ -1,5 +0,0 @@ -{{ $navjs := resources.Get "js/responsive_tables.ts" | js.Build }} -{{ $minified := $navjs | resources.Minify }} - diff --git a/course/layouts/partials/see_all.html b/course/layouts/partials/see_all.html deleted file mode 100644 index de0ce3ca5..000000000 --- a/course/layouts/partials/see_all.html +++ /dev/null @@ -1,6 +0,0 @@ -
    - - See all - arrow_forward - -
    diff --git a/course/layouts/partials/title.html b/course/layouts/partials/title.html deleted file mode 100644 index 516dcb952..000000000 --- a/course/layouts/partials/title.html +++ /dev/null @@ -1,17 +0,0 @@ -{{ $courseData := .Site.Data.course }} -{{- $titleArray := (slice) -}} -{{- if .Params.Title -}} - {{- $titleArray = $titleArray | append .Params.Title -}} -{{- end -}} -{{- if $courseData.course_title -}} - {{- $titleArray = $titleArray | append $courseData.course_title -}} - {{- if $courseData.department_numbers -}} - {{ $departments := partial "get_departments.html" $courseData.department_numbers }} - {{- $titleArray = $titleArray | append (index $departments 0).title -}} - {{- end -}} -{{- end -}} -{{- $titleArray = $titleArray | append $.Site.Title -}} -{{- if lt (len $titleArray) 3 -}} - {{- $titleArray = $titleArray | append "Free Online Course Materials" -}} -{{- end -}} -{{- delimit $titleArray " | " -}} diff --git a/course/layouts/partials/topic.html b/course/layouts/partials/topic.html deleted file mode 100644 index 507a0d1d3..000000000 --- a/course/layouts/partials/topic.html +++ /dev/null @@ -1,57 +0,0 @@ -{{ $index := .index }} -{{ $context := .context }} -{{ $subtopics := slice }} -{{ if not (eq .subtopics nil) }} -{{ $subtopics = .subtopics }} -{{ end }} -{{ $scratch := newScratch }} -
    - {{ if gt (len $subtopics) 0 }} - - - - {{ end }} - - {{ $topicTitle := title .topic }} - {{ $topicUrl := partial "get_search_url.html" (dict "key" "topic" "value" $topicTitle) }} - {{- partial "link.html" (dict "href" $topicUrl "class" "text-black course-info-topic" "text" $topicTitle "stripLinkOffline" true) -}} - -
    -{{ if gt (len $subtopics) 0 }} -
    - {{ $scratch.Set "index" 0 }} - {{ range $subtopic, $specialities := $subtopics }} - {{ $subtopicIndex := $scratch.Get "index" }} -
    - {{ if gt (len ($specialities | default slice)) 0 }} - - - - {{ end }} - - {{ $subTopicTitle := title $subtopic }} - {{ $subTopicUrl := partial "get_search_url.html" (dict "key" "topic" "value" $subTopicTitle) }} - {{- partial "link.html" (dict "href" $subTopicUrl "class" "text-black course-info-topic" "text" $subTopicTitle "stripLinkOffline" true) -}} - -
    - {{ range $speciality, $ignore := $specialities }} -
    - - {{ $specialityTitle := title $speciality }} - {{ $specialityUrl := partial "get_search_url.html" (dict "key" "topic" "value" $specialityTitle) }} - {{- partial "link.html" (dict "href" $specialityUrl "class" "text-black course-info-topic" "text" $specialityTitle "stripLinkOffline" true) -}} - -
    - {{ end }} - {{ $scratch.Set "index" (add 1 ($scratch.Get "index")) }} - {{ end }} -
    -{{ end }} diff --git a/course/layouts/partials/topics.html b/course/layouts/partials/topics.html deleted file mode 100644 index 0907faf91..000000000 --- a/course/layouts/partials/topics.html +++ /dev/null @@ -1,20 +0,0 @@ -{{ $courseData := .context.Site.Data.course }} -{{ $scratch := newScratch }} -{{ $scratch.Set "index" 0 }} -
    -

    Topics

    -
      - {{- $topics := (slice (slice "Social Science" "Political Science" "American Politics") (slice "Social Science" "Public Administration" "Public Policy")) -}} - - {{ with $courseData.topics }} - {{ $topics := partial "hierarchical_select_as_map.html" . }} - - {{- range $topic, $subtopics := $topics -}} -
    • - {{- partial "topic.html" (dict "index" ($scratch.Get "index") "topic" $topic "subtopics" $subtopics) -}} -
    • - {{ $scratch.Set "index" (add 1 ($scratch.Get "index")) }} - {{- end -}} - {{ end }} -
    -
    diff --git a/course/layouts/partials/topics_oneline.html b/course/layouts/partials/topics_oneline.html deleted file mode 100644 index 45f248078..000000000 --- a/course/layouts/partials/topics_oneline.html +++ /dev/null @@ -1,12 +0,0 @@ -{{ $courseData := .context.Site.Data.course }} - diff --git a/course/layouts/partials/video-gallery-item.html b/course/layouts/partials/video-gallery-item.html deleted file mode 100644 index 2e533326c..000000000 --- a/course/layouts/partials/video-gallery-item.html +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/course/layouts/partials/video-gallery-page.html b/course/layouts/partials/video-gallery-page.html deleted file mode 100644 index cf1ad3899..000000000 --- a/course/layouts/partials/video-gallery-page.html +++ /dev/null @@ -1,13 +0,0 @@ -{{- $ctx := . -}} -{{- partial "course_content.html" . -}} -{{/* - We check is_media_gallery here in case this is a legacy course. Legacy courses - often render video galleries between the text and bottomtext, so ocw-to-hugo - adds a video-gallery shortcode in the middle. So if it's a legacy course, we - don't need to explicitly render the video gallery here. -*/}} -{{- if not (isset .Params "is_media_gallery") -}} - {{- if isset .Params "videos" -}} - {{- partial "video-gallery.html" . -}} - {{- end -}} -{{- end -}} \ No newline at end of file diff --git a/course/layouts/partials/video-gallery-page.json b/course/layouts/partials/video-gallery-page.json deleted file mode 100644 index dd4fdef64..000000000 --- a/course/layouts/partials/video-gallery-page.json +++ /dev/null @@ -1,25 +0,0 @@ -{{- $ctx := . -}} -{ - "title": {{- .Title | jsonify -}}, - "description": {{- .Description | jsonify -}} - {{- if not (isset .Params "is_media_gallery") -}} - {{- if isset .Params "videos" -}} - , - "videos": [ - {{- range $index, $uuid := .Params.videos.content -}} - {{- range $ctx.Site.Pages -}} - {{- if eq (replace .Params.uid "-" "") (replace $uuid "-" "") -}} - {{- if $index -}} - , - {{- end -}} - { - "description": {{ .Params.description | jsonify }}, - "file": {{ .Params.file | jsonify }} - } - {{- end -}} - {{- end -}} - {{- end -}} - ] - {{- end -}} - {{- end -}} -} diff --git a/course/layouts/partials/video-gallery.html b/course/layouts/partials/video-gallery.html deleted file mode 100644 index 713119c57..000000000 --- a/course/layouts/partials/video-gallery.html +++ /dev/null @@ -1,9 +0,0 @@ -{{- $ctx := . -}} -{{- range .Params.videos.content -}} - {{- $uuid := . -}} - {{- range $ctx.Site.Pages -}} - {{- if eq (replace .Params.uid "-" "") (replace $uuid "-" "") -}} - {{ partial "video-gallery-item.html" . }} - {{- end -}} - {{- end -}} -{{- end -}} \ No newline at end of file diff --git a/course/layouts/resources/single.coursedata.json b/course/layouts/resources/single.coursedata.json deleted file mode 100644 index e3f32a1ce..000000000 --- a/course/layouts/resources/single.coursedata.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "title": {{- .Title | jsonify -}}, - "description": {{ .Params.description | jsonify }}, - "file": {{ .Params.file | jsonify }}, - "learning_resource_types": {{ .Params.learning_resource_types| jsonify }}, - "resource_type": {{ .Params.resourcetype | jsonify}}, - "file_type": {{ .Params.file_type | jsonify}} - {{- if eq .Params.resourcetype "Image" -}} - , - "image_metadata": {{ .Params.image_metadata | jsonify}} - {{- else if eq .Params.resourcetype "Video" -}} - , - "youtube_key": {{ .Params.video_metadata.youtube_id | jsonify}}, - "captions_file": {{ .Params.video_files.video_captions_file | jsonify }}, - "transcript_file": {{ .Params.video_files.video_transcript_file | jsonify }}, - "thumbnail_file": {{ .Params.video_files.video_thumbnail_file | jsonify }}, - "archive_url": {{ .Params.video_files.archive_url | jsonify }} - {{- end -}} -} diff --git a/course/layouts/resources/single.html b/course/layouts/resources/single.html deleted file mode 100644 index 8b7583131..000000000 --- a/course/layouts/resources/single.html +++ /dev/null @@ -1,4 +0,0 @@ -{{ define "main" }} -{{ partial "resource_title.html" . }} -{{ partial "resource_body.html" . }} -{{ end }} diff --git a/course/layouts/shortcodes/quiz_choice.html b/course/layouts/shortcodes/quiz_choice.html deleted file mode 100644 index 0f619fe34..000000000 --- a/course/layouts/shortcodes/quiz_choice.html +++ /dev/null @@ -1,5 +0,0 @@ -{{ $correct := .Get "isCorrect" }} -{{ $inner := .Inner }} -{{ $questionId := .Parent.Parent.Get "questionId" }} - -{{ partial "quiz_multiple_choice_choice.html" (dict "correct" $correct "choiceText" $inner "questionId" $questionId) }} diff --git a/course/layouts/shortcodes/quiz_choices.html b/course/layouts/shortcodes/quiz_choices.html deleted file mode 100644 index 876eb1960..000000000 --- a/course/layouts/shortcodes/quiz_choices.html +++ /dev/null @@ -1,2 +0,0 @@ -{{ $questionId := .Parent.Get "questionId" }} -
    {{ .Inner }}
    diff --git a/course/layouts/shortcodes/quiz_multiple_choice.html b/course/layouts/shortcodes/quiz_multiple_choice.html deleted file mode 100644 index 01153a3fa..000000000 --- a/course/layouts/shortcodes/quiz_multiple_choice.html +++ /dev/null @@ -1,2 +0,0 @@ -{{ $questionId := .Get "questionId" }} -

    {{ .Inner }}

    diff --git a/course/layouts/shortcodes/quiz_solution.html b/course/layouts/shortcodes/quiz_solution.html deleted file mode 100644 index e6c564eab..000000000 --- a/course/layouts/shortcodes/quiz_solution.html +++ /dev/null @@ -1,4 +0,0 @@ -{{ $solution := .Inner }} -{{ $questionId := .Parent.Get "questionId" }} - -{{ partial "quiz_multiple_choice_solution.html" (dict "solution" $solution "questionId" $questionId)}} \ No newline at end of file diff --git a/course/layouts/shortcodes/resource_file.html b/course/layouts/shortcodes/resource_file.html deleted file mode 100644 index efaef6e01..000000000 --- a/course/layouts/shortcodes/resource_file.html +++ /dev/null @@ -1,4 +0,0 @@ -{{- $uuid := index .Params 0 -}} -{{- range where $.Site.Pages "Params.uid" $uuid -}} -{{- partial "resource_url.html" (dict "context" . "url" .Params.file) -}} -{{- end -}} diff --git a/course/layouts/shortcodes/video-gallery.html b/course/layouts/shortcodes/video-gallery.html deleted file mode 100644 index 8ad4c4301..000000000 --- a/course/layouts/shortcodes/video-gallery.html +++ /dev/null @@ -1 +0,0 @@ -{{ partial "video-gallery.html" .Page }} \ No newline at end of file diff --git a/course/layouts/shortcodes/youtube.html b/course/layouts/shortcodes/youtube.html deleted file mode 100644 index ab32b8605..000000000 --- a/course/layouts/shortcodes/youtube.html +++ /dev/null @@ -1,4 +0,0 @@ -{{ $youtubeId := index .Params 0 }} -{{ $captionsLocation := index .Params 1}} -{{ $transcriptPdfLocation := index .Params 2}} -{{ partial "youtube_player.html" (dict "youtubeKey" $youtubeId "captionsLocation" $captionsLocation "transcriptPdfLocation" $transcriptPdfLocation) }} diff --git a/course/layouts/video_galleries/list.html b/course/layouts/video_galleries/list.html deleted file mode 100644 index fbe514b71..000000000 --- a/course/layouts/video_galleries/list.html +++ /dev/null @@ -1,3 +0,0 @@ -{{ define "main" }} -{{ partial "video-gallery-page.html" . }} -{{ end }} diff --git a/course/layouts/video_galleries/single.coursedata.json b/course/layouts/video_galleries/single.coursedata.json deleted file mode 100644 index 3151927e7..000000000 --- a/course/layouts/video_galleries/single.coursedata.json +++ /dev/null @@ -1,3 +0,0 @@ -{{ define "main" }} -{{ partial "video-gallery-page.json" . }} -{{ end }} diff --git a/course/layouts/video_galleries/single.html b/course/layouts/video_galleries/single.html deleted file mode 100644 index fbe514b71..000000000 --- a/course/layouts/video_galleries/single.html +++ /dev/null @@ -1,3 +0,0 @@ -{{ define "main" }} -{{ partial "video-gallery-page.html" . }} -{{ end }} diff --git a/tsconfig.json b/tsconfig.json index 93488af54..744419467 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -26,9 +26,6 @@ "./base-theme/assets/**/*.ts", "./base-theme/assets/**/*.tsx", "./base-theme/assets/**/*.js", - "./course/assets/**/*.ts", - "./course/assets/**/*.tsx", - "./course/assets/**/*.js", "./course-v2/assets/**/*.ts", "./course-v2/assets/**/*.tsx", "./course-v2/assets/**/*.js", diff --git a/www/layouts/resources/single.html b/www/layouts/resources/single.html index fa35999f0..ab62cbcdd 100644 --- a/www/layouts/resources/single.html +++ b/www/layouts/resources/single.html @@ -4,8 +4,8 @@ {{ end }}
    - {{ partial "content_header.html" . }} + {{ partial "content_header_v2.html" . }}
    - {{ partial "resource_body.html" . }} + {{ partial "resource_body_v2.html" . }}
    {{ end }} From 1a3c8954a93c969e007ab3617df0f0aaa58d2288 Mon Sep 17 00:00:00 2001 From: Chris Chudzicki Date: Wed, 25 Jan 2023 10:46:45 -0500 Subject: [PATCH 4/5] remove 4 deps included in nanogallery2 (#1054) Nanogallery2 includes hammerjs, screenfull, shifty, and images loaded as modules embedded in its source code; see https://github.com/nanostudio-org/nanogallery2/blob/d6056652705360e19ab330095f489f438a9e9d1c/src/jquery.nanogallery2.core.js#L11-L15. In browsers, Nanogallery2 intends to expose those objects on the global Window. However, bundling with Webpack messes up the way Nanogallery2 exposes those objects. (NG checks if `exports` is undefined, but Webpack defines an `eports` object itself.) Consequently, naive inclusion of Nanogallery2 in a webpack build does not work. To work around this, we previously were including those 4 dependencies separately and manually attaching them to global Window object, which is the workaround suggested at https://github.com/nanostudio-org/nanogallery2/issues/98#issuecomment-391770383. This approach has several downsides, e.g: extra js; need to make sure we are including the correct versions of the 4 dependencies. A cleaner approach is to use imports-loader, as suggested https://github.com/nanostudio-org/nanogallery2/issues/98#issuecomment-492121137. --- base-theme/assets/index.ts | 4 -- base-theme/assets/webpack/webpack.common.ts | 38 ++----------------- package.json | 4 -- www/assets/www.tsx | 2 - yarn.lock | 41 --------------------- 5 files changed, 4 insertions(+), 85 deletions(-) diff --git a/base-theme/assets/index.ts b/base-theme/assets/index.ts index c3919a757..583bcb6e9 100644 --- a/base-theme/assets/index.ts +++ b/base-theme/assets/index.ts @@ -3,10 +3,6 @@ import "video.js/dist/video-js.css" import "bootstrap" import Popper from "popper.js" -import "shifty" -import "hammerjs" -import "imagesloaded" -import "screenfull" import "./js/utils" import * as Sentry from "@sentry/browser" import { initSentry } from "./js/sentry" diff --git a/base-theme/assets/webpack/webpack.common.ts b/base-theme/assets/webpack/webpack.common.ts index 447ff8387..0ac2b6535 100644 --- a/base-theme/assets/webpack/webpack.common.ts +++ b/base-theme/assets/webpack/webpack.common.ts @@ -33,6 +33,10 @@ const config: webpack.Configuration = { module: { rules: [ + { + test: /nanogallery2/, + use: "imports-loader?module.exports=>undefined&exports=>undefined" + }, { test: /\.(jpg)|(png)|(svg)|(gif)$/, use: [ @@ -77,40 +81,6 @@ const config: webpack.Configuration = { "postcss-loader", "sass-loader" ] - }, - - { - test: require.resolve("shifty"), - use: [ - { loader: "expose-loader", options: { exposes: ["NGTweenable"] } } - ] - }, - - { - test: require.resolve("hammerjs"), - use: [ - { - loader: "expose-loader", - options: { exposes: ["NGHammer"] } - } - ] - }, - - { - test: require.resolve("imagesloaded"), - use: [ - { - loader: "expose-loader", - options: { exposes: ["ngimagesLoaded", "ngImagesLoaded"] } - } - ] - }, - - { - test: require.resolve("screenfull"), - use: [ - { loader: "expose-loader", options: { exposes: ["ngscreenfull"] } } - ] } ] }, diff --git a/package.json b/package.json index ece170252..5db24ddad 100644 --- a/package.json +++ b/package.json @@ -96,10 +96,8 @@ "file-loader": "^5.0.2", "fuse.js": "^6.5.3", "gulp": "^4.0.2", - "hammerjs": "2.0.7", "history": "^5.3.0", "hugo-bin-extended": "0.110.0", - "imagesloaded": "4.1.1", "imports-loader": "^0.8.0", "inquirer": "^8.2.5", "isomorphic-fetch": "^2.2.1", @@ -141,10 +139,8 @@ "sass": "^1.32.13", "sass-lint": "^1.13.1", "sass-loader": "^8.0.0", - "screenfull": "3.2.0", "serve-handler": "^6.1.3", "shelljs": "^0.8.4", - "shifty": "1.5.3", "sinon": "^10.0.0", "spinkit": "^2.0.1", "style-loader": "^1.0.0", diff --git a/www/assets/www.tsx b/www/assets/www.tsx index 255aa95b7..1e146c8a2 100644 --- a/www/assets/www.tsx +++ b/www/assets/www.tsx @@ -1,5 +1,3 @@ -import "../../node_modules/nanogallery2/src/css/nanogallery2.css" - import "./css/www.scss" import "./css/search.scss" diff --git a/yarn.lock b/yarn.lock index e1a47ee06..bea57d6de 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7316,13 +7316,6 @@ __metadata: languageName: node linkType: hard -"ev-emitter@npm:~1.0.0": - version: 1.0.3 - resolution: "ev-emitter@npm:1.0.3" - checksum: 9395fbf09bfcf65597e7262e3860aae1847fa761c94a9618958d3342a60d38e2d5a347ec8b0de499e3b19e47d93740f8d4032ff5935af1d47594639de7c505c0 - languageName: node - linkType: hard - "event-emitter@npm:~0.3.5": version: 0.3.5 resolution: "event-emitter@npm:0.3.5" @@ -8865,13 +8858,6 @@ __metadata: languageName: node linkType: hard -"hammerjs@npm:2.0.7": - version: 2.0.7 - resolution: "hammerjs@npm:2.0.7" - checksum: ba95afe6e1b57bde4d0c42d11aaf715f537a625772b1740c76e37c1efad3b8bb1adba55d0db5330f16e861475184543b8d6bce8456140a55981f79d930645e96 - languageName: node - linkType: hard - "handle-thing@npm:^2.0.0": version: 2.0.1 resolution: "handle-thing@npm:2.0.1" @@ -9372,15 +9358,6 @@ __metadata: languageName: node linkType: hard -"imagesloaded@npm:4.1.1": - version: 4.1.1 - resolution: "imagesloaded@npm:4.1.1" - dependencies: - ev-emitter: ~1.0.0 - checksum: 8052d6afcd770ca90f751e46396174cade88dfd1aa219eee08b76e2347bae737f46b7fd2e962cfd7c8656fc9c115155ea4b330d779799d3d2ee728ccc39745c8 - languageName: node - linkType: hard - "import-cwd@npm:^2.0.0": version: 2.1.0 resolution: "import-cwd@npm:2.1.0" @@ -13146,10 +13123,8 @@ __metadata: file-loader: ^5.0.2 fuse.js: ^6.5.3 gulp: ^4.0.2 - hammerjs: 2.0.7 history: ^5.3.0 hugo-bin-extended: 0.110.0 - imagesloaded: 4.1.1 imports-loader: ^0.8.0 inquirer: ^8.2.5 isomorphic-fetch: ^2.2.1 @@ -13191,10 +13166,8 @@ __metadata: sass: ^1.32.13 sass-lint: ^1.13.1 sass-loader: ^8.0.0 - screenfull: 3.2.0 serve-handler: ^6.1.3 shelljs: ^0.8.4 - shifty: 1.5.3 sinon: ^10.0.0 spinkit: ^2.0.1 style-loader: ^1.0.0 @@ -16345,13 +16318,6 @@ __metadata: languageName: node linkType: hard -"screenfull@npm:3.2.0": - version: 3.2.0 - resolution: "screenfull@npm:3.2.0" - checksum: 7cbf176531751ea5ffa337fa2e64209c6c35a8d9628686233dfce7208cc25741bc1fd40a928211bafd8385b2deda1c6457e2a235f7dcb37e722119519f9db571 - languageName: node - linkType: hard - "seek-bzip@npm:^1.0.5": version: 1.0.6 resolution: "seek-bzip@npm:1.0.6" @@ -16638,13 +16604,6 @@ __metadata: languageName: node linkType: hard -"shifty@npm:1.5.3": - version: 1.5.3 - resolution: "shifty@npm:1.5.3" - checksum: 4e592efeb6bb234e9b8a55c2eae13f8dc88ca995756120c149c76c845bfb4766efd86069b16ea2764516b8aef9431782edd86adef80b7999785aaf157dbadb70 - languageName: node - linkType: hard - "side-channel@npm:^1.0.4": version: 1.0.4 resolution: "side-channel@npm:1.0.4" From 0f3abad7b6da458e2ff5384e19dadc0e6c4c61da Mon Sep 17 00:00:00 2001 From: Doof Date: Wed, 25 Jan 2023 16:04:24 +0000 Subject: [PATCH 5/5] Release 1.83.1 --- RELEASE.rst | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/RELEASE.rst b/RELEASE.rst index 24c462af1..55bc3948b 100644 --- a/RELEASE.rst +++ b/RELEASE.rst @@ -1,6 +1,14 @@ Release Notes ============= +Version 1.83.1 +-------------- + +- remove 4 deps included in nanogallery2 (#1054) +- refactor: old course theme removed (#1051) +- add pre-commit config (#1048) +- change TS config to target ES6 modules (#1044) + Version 1.83.0 (Released January 24, 2023) -------------- diff --git a/package.json b/package.json index 5db24ddad..d438b4ac9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ocw-hugo-themes", - "version": "1.83.0", + "version": "1.83.1", "description": "A Hugo theme for building OCW websites", "repository": "mitodl/ocw-hugo-themes", "main": "base-theme/assets/index.js",