/
githubmirror
/
edx-platform
Обзор
Документация
Войти
/
githubmirror
/
edx-platform
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
release-ulmo
cms/templates/base.html
201 строка
7 KB
Omar Al-Ithawi
fix: add fallback `gettext` function if translations aren't pulled in dev envs (#34416)
27 мар 2024, 20:20
Не верифицирован
27 мар 2024, 20:20
5a43777
Код
Авторство
О чём код?
## coding=utf-8 ## mako ## Pages currently use v1 styling by default. Once the Pattern Library ## rollout has been completed, this default can be switched to v2. <%! main_css = "style-main-v1" %> ## Standard imports <%namespace name='static' file='static_content.html'/> <%! from django.utils.translation import gettext as _ from cms.djangoapps.contentstore.config.waffle import CUSTOM_RELATIVE_DATES from lms.djangoapps.branding import api as branding_api from openedx.core.djangoapps.util.user_messages import PageLevelMessages from openedx.core.djangolib.js_utils import ( dump_js_escaped_json, js_escaped_string ) from openedx.core.djangolib.markup import HTML from openedx.core.release import RELEASE_LINE %> <%page expression_filter="h"/> <!doctype html> <!--[if lte IE 9]><html class="ie9 lte9" lang="${LANGUAGE_CODE}"><![endif]--> <!--[if !IE]><<!--><html lang="${LANGUAGE_CODE}"><!--<![endif]--> <head dir="${static.dir_rtl()}"> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="openedx-release-line" content="${RELEASE_LINE}" /> <title> <%block name="title"></%block> | % if context_course: <% ctx_loc = context_course.location %> ${context_course.display_name_with_default} | % elif context_library: ${context_library.display_name_with_default} | % endif ${settings.STUDIO_NAME} </title> <% jsi18n_path = "js/i18n/{language}/djangojs.js".format(language=LANGUAGE_CODE) %> % if getattr(settings, 'CAPTURE_CONSOLE_LOG', False): <script type="text/javascript"> var oldOnError = window.onerror; window.localStorage.setItem('console_log_capture', JSON.stringify([])); window.onerror = function (message, url, lineno, colno, error) { if (oldOnError) { oldOnError.apply(this, arguments); } var messages = JSON.parse(window.localStorage.getItem('console_log_capture')); messages.push([message, url, lineno, colno, (error || {}).stack]); window.localStorage.setItem('console_log_capture', JSON.stringify(messages)); } </script> % endif <script type="text/javascript" src="${static.url(jsi18n_path)}"></script> % if settings.DEBUG: ## Provides a fallback for gettext functions in development environment <script type="text/javascript" src="${static.url('js/src/gettext_fallback.js')}"></script> % endif <meta name="viewport" content="width=device-width,initial-scale=1"> <meta name="path_prefix" content="${EDX_ROOT_URL}"> <%block name="header_meta"></%block> <% favicon_url = branding_api.get_favicon_url() %> <link rel="icon" type="image/x-icon" href="${favicon_url}"/> <%static:css group='style-vendor'/> <%static:css group='style-vendor-tinymce-content'/> <%static:css group='style-vendor-tinymce-skin'/> % if uses_bootstrap: <link rel="stylesheet" href="${static.url(self.attr.main_css)}" type="text/css" media="all" /> % else: <%static:css group='${self.attr.main_css}'/> % endif <%include file="widgets/segment-io.html" /> <%block name="header_extras"></%block> <!-- Hotjar Tracking Code for studio --> <script> (function(h,o,t,j,a,r){ h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)}; h._hjSettings={hjid: Number("${settings.HOTJAR_ID |n, js_escaped_string}"),hjsv:6}; a=o.getElementsByTagName('head')[0]; r=o.createElement('script');r.async=1; r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv; a.appendChild(r); })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv='); </script> </head> <body class="${static.dir_rtl()} <%block name='bodyclass'></%block> lang_${LANGUAGE_CODE}"> <%block name="view_notes"></%block> <a class="nav-skip" href="#main">${_("Skip to main content")}</a> <%static:js group='base_vendor'/> <%static:webpack entry="commons"/> <script type="text/javascript"> window.baseUrl = "${settings.STATIC_URL | n, js_escaped_string}"; require.config({ baseUrl: window.baseUrl }); </script> <script type="text/javascript" src="${static.url("cms/js/require-config.js")}"></script> <!-- view --> <div class="wrapper wrapper-view" dir="${static.dir_rtl()}"> <% online_help_token = self.online_help_token() if hasattr(self, 'online_help_token') else None %> <%include file="widgets/header.html" args="online_help_token=online_help_token" /> <% banner_messages = list(PageLevelMessages.user_messages(request)) %> % if banner_messages: <div class="page-banner"> <div class="user-messages"> % for message in banner_messages: <div class="alert ${message.css_class}" role="alert"> <span class="icon icon-alert fa ${message.icon_class}" aria-hidden="true"></span> ${HTML(message.message_html)} </div> % endfor </div> </div> % endif <div id="page-alert"> <%include file="widgets/deprecated-course-key-warning.html" args="course=context_course" /> <%block name="page_alert"></%block> </div> <main id="main" aria-label="Content" tabindex="-1"> <div id="content"> <%block name="content"></%block> </div> </main> % if user.is_authenticated: <%include file="widgets/sock.html" args="online_help_token=online_help_token" /> % endif <%include file="widgets/footer.html" /> <div id="page-notification"></div> </div> <div id="page-prompt"></div> <%block name="modal_placeholder"></%block> <%block name="jsextra"></%block> % if context_course: <%static:webpack entry="js/factories/context_course"/> <script type="text/javascript"> window.course = new ContextCourse({ id: "${context_course.id | n, js_escaped_string}", name: "${context_course.display_name_with_default | n, js_escaped_string}", url_name: "${context_course.location.block_id | n, js_escaped_string}", org: "${context_course.location.org | n, js_escaped_string}", num: "${context_course.location.course | n, js_escaped_string}", display_course_number: "${context_course.display_coursenumber | n, js_escaped_string}", revision: "${context_course.location.branch | n, js_escaped_string}", self_paced: ${ context_course.self_paced | n, dump_js_escaped_json }, is_custom_relative_dates_active: ${CUSTOM_RELATIVE_DATES.is_enabled(context_course.id) | n, dump_js_escaped_json}, start: ${context_course.start | n, dump_js_escaped_json}, discussions_settings: ${context_course.discussions_settings | n, dump_js_escaped_json} }); </script> % endif % if user.is_authenticated: <%static:webpack entry='js/sock'/> % endif <%block name='page_bundle'> <script type="text/javascript"> require(['js/factories/base'], function () { <%block name='requirejs'></%block> }); </script> </%block> <%include file="widgets/segment-io-footer.html" /> <div class="modal-cover"></div> </body> <script> var beamer_config = { product_id : "${settings.BEAMER_PRODUCT_ID | n, js_escaped_string}" }; </script> <script type="text/javascript" src="https://app.getbeamer.com/js/beamer-embed.js" defer="defer"></script> </html>