diff --git a/services/web/app/views/_mixins/bootstrap_js.pug b/services/web/app/views/_mixins/bootstrap_js.pug new file mode 100644 index 0000000000..866b0b4218 --- /dev/null +++ b/services/web/app/views/_mixins/bootstrap_js.pug @@ -0,0 +1,3 @@ +mixin bootstrap-js(bootstrapVersion) + each file in (entrypointScripts(bootstrapVersion === 5 ? 'bootstrap-5' : 'bootstrap-3')) + script(type="text/javascript", nonce=scriptNonce, src=file) diff --git a/services/web/app/views/layout-base.pug b/services/web/app/views/layout-base.pug index 2dde4d6eda..d7b45230f3 100644 --- a/services/web/app/views/layout-base.pug +++ b/services/web/app/views/layout-base.pug @@ -4,7 +4,7 @@ html( class=(fixedSizeDocument ? 'fixed-size-document' : undefined) ) - metadata = metadata || {} - - bootstrap5EnabledPage = false + - let bootstrap5EnabledPage = false block entrypointVar @@ -13,7 +13,7 @@ html( head include ./_metadata.pug - - var bootstrapVersion = bootstrap5EnabledPage && splitTestVariants['bootstrap-5'] === 'enabled' ? 5 : 3 + - const bootstrapVersion = bootstrap5EnabledPage && splitTestVariants['bootstrap-5'] === 'enabled' ? 5 : 3 //- Stylesheet link(rel='stylesheet', href=buildCssPath(getCssThemeModifier(userSettings, brandVariation), bootstrapVersion), id="main-stylesheet") diff --git a/services/web/app/views/layout-marketing.pug b/services/web/app/views/layout-marketing.pug index 0ca338809e..a5c7ae5b76 100644 --- a/services/web/app/views/layout-marketing.pug +++ b/services/web/app/views/layout-marketing.pug @@ -1,6 +1,7 @@ extends ./layout-base include ./_mixins/formMessages +include ./_mixins/bootstrap_js block entrypointVar - entrypoint = 'marketing' @@ -21,3 +22,6 @@ block body include _cookie_banner != moduleIncludes("contactModal-marketing", locals) + +block prepend foot-scripts + +bootstrap-js(bootstrapVersion) diff --git a/services/web/app/views/layout-website-redesign.pug b/services/web/app/views/layout-website-redesign.pug index 8f21e904cc..e848600e15 100644 --- a/services/web/app/views/layout-website-redesign.pug +++ b/services/web/app/views/layout-website-redesign.pug @@ -1,6 +1,7 @@ extends ./layout-base include ./_mixins/formMessages +include ./_mixins/bootstrap_js block entrypointVar - entrypoint = 'marketing' @@ -21,3 +22,6 @@ block body include _cookie_banner != moduleIncludes("contactModal-marketing", locals) + +block prepend foot-scripts + +bootstrap-js(bootstrapVersion) diff --git a/services/web/app/views/subscriptions/interstitial-payment.pug b/services/web/app/views/subscriptions/interstitial-payment.pug index 5458654aec..8cebac6831 100644 --- a/services/web/app/views/subscriptions/interstitial-payment.pug +++ b/services/web/app/views/subscriptions/interstitial-payment.pug @@ -1,6 +1,7 @@ extends ../layout include ./plans/_mixins +include ../_mixins/bootstrap_js block vars - entrypoint = 'pages/user/subscription/plans-v2/plans-v2-main' @@ -65,3 +66,6 @@ block content | #{translate("continue_with_free_plan")} != moduleIncludes("contactModalGeneral-marketing", locals) + +block prepend foot-scripts + +bootstrap-js(bootstrapVersion) diff --git a/services/web/frontend/js/bootstrap-3.ts b/services/web/frontend/js/bootstrap-3.ts new file mode 100644 index 0000000000..9c2bc11ddf --- /dev/null +++ b/services/web/frontend/js/bootstrap-3.ts @@ -0,0 +1,5 @@ +import 'jquery' +import 'bootstrap' + +$('[data-ol-lang-selector-tooltip]').tooltip({ trigger: 'hover' }) +$('[data-toggle="tooltip"]').tooltip() diff --git a/services/web/frontend/js/bootstrap-5.ts b/services/web/frontend/js/bootstrap-5.ts new file mode 100644 index 0000000000..3b4282f29f --- /dev/null +++ b/services/web/frontend/js/bootstrap-5.ts @@ -0,0 +1 @@ +import 'bootstrap-5' diff --git a/services/web/frontend/js/marketing.js b/services/web/frontend/js/marketing.js index 3cb12be43a..1f61c4b735 100644 --- a/services/web/frontend/js/marketing.js +++ b/services/web/frontend/js/marketing.js @@ -1,7 +1,5 @@ import './utils/webpack-public-path' import './infrastructure/error-reporter' -import 'jquery' -import 'bootstrap' import './features/form-helpers/hydrate-form' import './features/form-helpers/password-visibility' import './features/link-helpers/slow-link' @@ -13,6 +11,3 @@ import './features/multi-submit' import './features/cookie-banner' import './features/autoplay-video' import './features/mathjax' - -$('[data-ol-lang-selector-tooltip]').tooltip({ trigger: 'hover' }) -$('[data-toggle="tooltip"]').tooltip() diff --git a/services/web/frontend/js/pages/project-list.jsx b/services/web/frontend/js/pages/project-list.jsx index b69ca485f9..744f5f1bf7 100644 --- a/services/web/frontend/js/pages/project-list.jsx +++ b/services/web/frontend/js/pages/project-list.jsx @@ -1,5 +1,3 @@ -import 'jquery' -import 'bootstrap' import './../utils/meta' import './../utils/webpack-public-path' import './../infrastructure/error-reporter' diff --git a/services/web/webpack.config.js b/services/web/webpack.config.js index 1d80e11edf..10c7920715 100644 --- a/services/web/webpack.config.js +++ b/services/web/webpack.config.js @@ -17,6 +17,8 @@ invalidateBabelCacheIfNeeded() // Generate a hash of entry points, including modules const entryPoints = { tracing: './frontend/js/tracing.js', + 'bootstrap-3': './frontend/js/bootstrap-3.ts', + 'bootstrap-5': './frontend/js/bootstrap-5.ts', devToolbar: './frontend/js/dev-toolbar.js', main: './frontend/js/main.js', ide: './frontend/js/ide.js',