def test_footer_language_selector_is_enabled(self, base_config, site_config, expected): """ Verify that the footer language selector config is correct. """ with patch.dict('django.conf.settings.FEATURES', base_config): with with_site_configuration_context(configuration=site_config): assert language_api.footer_language_selector_is_enabled() == expected
def test_footer_language_selector_is_enabled(self, base_config, site_config, expected): """ Verify that the footer language selector config is correct. """ with patch.dict('django.conf.settings.FEATURES', base_config): with with_site_configuration_context(configuration=site_config): self.assertEqual(language_api.footer_language_selector_is_enabled(), expected)
def render_body(context, **pageargs): __M_caller = context.caller_stack._push_frame() try: __M_locals = __M_dict_builtin(pageargs=pageargs) static = _mako_get_namespace(context, 'static') marketing_link = context.get('marketing_link', UNDEFINED) __M_writer = context.writer() __M_writer(u'\n') __M_writer(u'\n') __M_writer( u'\n\n<div class="wrapper wrapper-footer">\n <footer>\n <!-- This is super-ugly, don\'t use it! -->\n <div class="colophon">\n <nav class="nav-colophon" aria-label="' ) __M_writer(filters.html_escape(filters.decode.utf8(_('About')))) __M_writer( u'">\n <ol>\n <li class="nav-colophon-01">\n <a id="about" href="' ) __M_writer( filters.html_escape(filters.decode.utf8(marketing_link('ABOUT')))) __M_writer(u'">\n ') __M_writer(filters.html_escape(filters.decode.utf8(_("About")))) __M_writer(u'\n </a>\n </li>\n') if marketing_link('JOBS') and marketing_link('JOBS') != '#': __M_writer( u' <li class="nav-colophon-02">\n <a id="jobs" href="' ) __M_writer( filters.html_escape(filters.decode.utf8( marketing_link('JOBS')))) __M_writer(u'">\n ') __M_writer(filters.html_escape(filters.decode.utf8(_("Jobs")))) __M_writer(u'\n </a>\n </li>\n') if marketing_link('NEWS') and marketing_link('NEWS') != '#': __M_writer( u' <li class="nav-colophon-03">\n <a id="news" href="' ) __M_writer( filters.html_escape(filters.decode.utf8( marketing_link('NEWS')))) __M_writer(u'">\n ') __M_writer(filters.html_escape(filters.decode.utf8(_("News")))) __M_writer(u'\n </a>\n </li>\n') __M_writer( u' <li class="nav-colophon-04">\n <a id="faq" href="' ) __M_writer( filters.html_escape(filters.decode.utf8(marketing_link('FAQ')))) __M_writer(u'">\n ') __M_writer(filters.html_escape(filters.decode.utf8(_("FAQ")))) __M_writer( u'\n </a>\n </li>\n <li class="nav-colophon-05">\n <a id="contact" href="' ) __M_writer( filters.html_escape(filters.decode.utf8( marketing_link('CONTACT')))) __M_writer(u'">\n ') __M_writer(filters.html_escape(filters.decode.utf8(_("Contact")))) __M_writer( u'\n </a>\n </li>\n </ol>\n </nav>\n\n' ) if context.get('include_language_selector', footer_language_selector_is_enabled()): __M_writer(u' ') runtime._include_file(context, (static.get_template_path( 'widgets/footer-language-selector.html')), _template_uri) __M_writer(u'\n') __M_writer( u'\n <div class="wrapper-logo">\n <p>\n <a href="/">\n' ) __M_writer( u' <img alt="organization logo placeholder" src="') __M_writer( filters.html_escape( filters.decode.utf8(static.url("images/logo.png")))) __M_writer( u'">\n </a>\n </p>\n </div>\n\n <p class="copyright">© ' ) __M_writer( filters.html_escape( filters.decode.utf8( datetime.now(pytz.timezone(settings.TIME_ZONE)).year))) __M_writer(u' ') __M_writer( filters.html_escape(filters.decode.utf8( static.get_platform_name()))) __M_writer(u'.</p>\n\n') __M_writer(u' <p class="copyright">\n') __M_writer(u' ') __M_writer( filters.html_escape( filters.decode.utf8( Text( _("edX, Open edX, and the edX and Open edX logos are registered trademarks of {link_start}edX Inc.{link_end}" )).format(link_start=HTML( u"<a href='https://www.edx.org/'>"), link_end=HTML(u"</a>"))))) __M_writer(u'\n </p>\n <nav class="nav-legal" aria-label="') __M_writer(filters.html_escape(filters.decode.utf8(_('Legal')))) __M_writer(u'">\n <ul>\n') if marketing_link('HONOR') and marketing_link('HONOR') != '#': __M_writer(u' <li class="nav-legal-01">\n ') tos_link = HTML(u"<a href='{}'>").format(marketing_link('TOS')) honor_link = HTML(u"<a href='{}'>").format(marketing_link('HONOR')) __M_locals_builtin_stored = __M_locals_builtin() __M_locals.update( __M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['honor_link', 'tos_link'] if __M_key in __M_locals_builtin_stored])) __M_writer(u'\n ') __M_writer( filters.html_escape( filters.decode.utf8( Text( _("{tos_link_start}Terms of Service{tos_link_end} and {honor_link_start}Honor Code{honor_link_end}" )).format( tos_link_start=tos_link, tos_link_end=HTML("</a>"), honor_link_start=honor_link, honor_link_end=HTML("</a>"), )))) __M_writer(u'\n </li>\n') else: __M_writer( u' <li class="nav-legal-01">\n <a href="') __M_writer( filters.html_escape(filters.decode.utf8( marketing_link('TOS')))) __M_writer(u'">') __M_writer( filters.html_escape(filters.decode.utf8( _("Terms of Service")))) __M_writer(u'</a>\n </li>\n') __M_writer( u' <li class="nav-legal-02">\n <a href="') __M_writer( filters.html_escape(filters.decode.utf8( marketing_link('PRIVACY')))) __M_writer(u'">') __M_writer( filters.html_escape(filters.decode.utf8(_("Privacy Policy")))) __M_writer( u'</a>\n </li>\n </ul>\n </nav>\n </div>\n\n' ) __M_writer( u' <div class="footer-about-openedx">\n <p>\n <a href="http://openedx.org/">\n' ) __M_writer( u' <img src="(static.url("images/logo.png")" alt="') __M_writer( filters.html_escape(filters.decode.utf8(_('Powered by Open edX')))) __M_writer(u'" width="140" />\n') __M_writer( u' </a>\n </p>\n </div>\n </footer>\n</div>\n') return '' finally: context.caller_stack._pop_frame()
def render_body(context,**pageargs): __M_caller = context.caller_stack._push_frame() try: __M_locals = __M_dict_builtin(pageargs=pageargs) include_dependencies = context.get('include_dependencies', UNDEFINED) uses_bootstrap = context.get('uses_bootstrap', UNDEFINED) settings = context.get('settings', UNDEFINED) footer_css_urls = context.get('footer_css_urls', UNDEFINED) getattr = context.get('getattr', UNDEFINED) static = _mako_get_namespace(context, 'static') bidi = context.get('bidi', UNDEFINED) enumerate = context.get('enumerate', UNDEFINED) is_secure = context.get('is_secure', UNDEFINED) hide_openedx_link = context.get('hide_openedx_link', UNDEFINED) __M_writer = context.writer() __M_writer(u'\n') __M_writer(u'\n') footer = get_footer(is_secure=is_secure) __M_locals_builtin_stored = __M_locals_builtin() __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['footer'] if __M_key in __M_locals_builtin_stored])) __M_writer(u'\n') __M_writer(u'\n\n') if uses_bootstrap: __M_writer(u' <div class="container-fluid wrapper-footer">\n <footer>\n <div class="row">\n <div class="col-md-9">\n <nav class="navbar site-nav navbar-expand-sm" aria-label="') __M_writer(filters.html_escape(filters.decode.utf8(_('About')))) __M_writer(u'">\n <ul class="navbar-nav">\n') for item_num, link in enumerate(footer['navigation_links'], start=1): __M_writer(u' <li class="nav-item">\n <a class="nav-link" href="') __M_writer(filters.html_escape(filters.decode.utf8(link['url']))) __M_writer(u'">') __M_writer(filters.html_escape(filters.decode.utf8(link['title']))) __M_writer(u'</a>\n </li>\n') __M_writer(u' </ul>\n </nav>\n\n') __M_writer(u' <p class="copyright">') __M_writer(filters.html_escape(filters.decode.utf8(footer['copyright']))) __M_writer(u' ') __M_writer(filters.html_escape(filters.decode.utf8(u" | {icp}".format(icp=getattr(settings,'ICP_LICENSE')) if getattr(settings,'ICP_LICENSE',False) else ""))) __M_writer(u'</p>\n\n <nav class="navbar legal-nav navbar-expand-sm" aria-label="') __M_writer(filters.html_escape(filters.decode.utf8(_('Legal')))) __M_writer(u'">\n <ul class="navbar-nav">\n') for item_num, link in enumerate(footer['legal_links'], start=1): __M_writer(u' <li class="nav-item">\n <a class="nav-link" href="') __M_writer(filters.html_escape(filters.decode.utf8(link['url']))) __M_writer(u'">') __M_writer(filters.html_escape(filters.decode.utf8(link['title']))) __M_writer(u'</a>\n </li>\n') __M_writer(u' <li class="nav-item">\n <a class="nav-link" href="') __M_writer(filters.html_escape(filters.decode.utf8(footer['edx_org_link']['url']))) __M_writer(u'">') __M_writer(filters.html_escape(filters.decode.utf8(footer['edx_org_link']['text']))) __M_writer(u'</a>\n </li>\n </ul>\n </nav>\n </div>\n <div class="col-md-3">\n') if not hide_openedx_link: __M_writer(u' <div class="footer-about-openedx">\n <p>\n <a href="') __M_writer(filters.html_escape(filters.decode.utf8(footer['openedx_link']['url']))) __M_writer(u'">\n <img src="') __M_writer(filters.html_escape(filters.decode.utf8(footer['openedx_link']['image']))) __M_writer(u'" alt="') __M_writer(filters.html_escape(filters.decode.utf8(footer['openedx_link']['title']))) __M_writer(u'" width="140" />\n </a>\n </p>\n </div>\n') __M_writer(u' </div>\n </div>\n </footer>\n </div>\n') else: __M_writer(u' <div class="wrapper wrapper-footer">\n <footer id="footer-openedx" class="grid-container"\n') if bidi: __M_writer(u' dir=') __M_writer(filters.html_escape(filters.decode.utf8(bidi))) __M_writer(u'\n') __M_writer(u' >\n <div class="colophon">\n <nav class="nav-colophon" aria-label="') __M_writer(filters.html_escape(filters.decode.utf8(_('About')))) __M_writer(u'">\n <ol>\n') for item_num, link in enumerate(footer['navigation_links'], start=1): __M_writer(u' <li class="nav-colophon-0') __M_writer(filters.html_escape(filters.decode.utf8(item_num))) __M_writer(u'">\n <a id="') __M_writer(filters.html_escape(filters.decode.utf8(link['name']))) __M_writer(u'" href="') __M_writer(filters.html_escape(filters.decode.utf8(link['url']))) __M_writer(u'">') __M_writer(filters.html_escape(filters.decode.utf8(link['title']))) __M_writer(u'</a>\n </li>\n') __M_writer(u' </ol>\n </nav>\n\n') if context.get('include_language_selector', footer_language_selector_is_enabled()): __M_writer(u' ') runtime._include_file(context, (static.get_template_path('widgets/footer-language-selector.html')), _template_uri) __M_writer(u'\n') __M_writer(u'\n <div class="wrapper-logo">\n <p>\n <a href="/">\n') __M_writer(u' <img alt="organization logo" src="') __M_writer(filters.html_escape(filters.decode.utf8(footer['logo_image']))) __M_writer(u'">\n </a>\n </p>\n </div>\n\n') __M_writer(u' <p class="copyright">') __M_writer(filters.html_escape(filters.decode.utf8(footer['copyright']))) __M_writer(u' ') __M_writer(filters.html_escape(filters.decode.utf8(u" | {icp}".format(icp=getattr(settings,'ICP_LICENSE')) if getattr(settings,'ICP_LICENSE',False) else ""))) __M_writer(u'</p>\n\n <nav class="nav-legal" aria-label="') __M_writer(filters.html_escape(filters.decode.utf8(_('Legal')))) __M_writer(u'">\n <ul>\n') for item_num, link in enumerate(footer['legal_links'], start=1): __M_writer(u' <li class="nav-legal-0') __M_writer(filters.html_escape(filters.decode.utf8(item_num))) __M_writer(u'">\n <a href="') __M_writer(filters.html_escape(filters.decode.utf8(link['url']))) __M_writer(u'">') __M_writer(filters.html_escape(filters.decode.utf8(link['title']))) __M_writer(u'</a>\n </li>\n') __M_writer(u' <li><a href="') __M_writer(filters.html_escape(filters.decode.utf8(footer['edx_org_link']['url']))) __M_writer(u'">') __M_writer(filters.html_escape(filters.decode.utf8(footer['edx_org_link']['text']))) __M_writer(u'</a></li>\n </ul>\n </nav>\n </div>\n\n') if not hide_openedx_link: __M_writer(u' <div class="footer-about-openedx">\n <p>\n <a href="') __M_writer(filters.html_escape(filters.decode.utf8(footer['openedx_link']['url']))) __M_writer(u'">\n <img src="') __M_writer(filters.html_escape(filters.decode.utf8(footer['openedx_link']['image']))) __M_writer(u'" alt="') __M_writer(filters.html_escape(filters.decode.utf8(footer['openedx_link']['title']))) __M_writer(u'" width="140" />\n </a>\n </p>\n </div>\n') __M_writer(u' </footer>\n </div>\n') if include_dependencies: __M_writer(u' ') def ccall(caller): def body(): __M_writer = context.writer() return '' return [body] context.caller_stack.nextcaller = runtime.Namespace('caller', context, callables=ccall(__M_caller)) try: __M_writer(filters.html_escape(filters.decode.utf8(static.js(group=u'base_vendor')))) finally: context.caller_stack.nextcaller = None __M_writer(u'\n ') def ccall(caller): def body(): __M_writer = context.writer() return '' return [body] context.caller_stack.nextcaller = runtime.Namespace('caller', context, callables=ccall(__M_caller)) try: __M_writer(filters.html_escape(filters.decode.utf8(static.css(group=u'style-vendor')))) finally: context.caller_stack.nextcaller = None __M_writer(u'\n ') runtime._include_file(context, u'widgets/segment-io.html', _template_uri) __M_writer(u'\n ') runtime._include_file(context, u'widgets/segment-io-footer.html', _template_uri) __M_writer(u'\n') if footer_css_urls: for url in footer_css_urls: __M_writer(u' <link rel="stylesheet" type="text/css" href="') __M_writer(filters.html_escape(filters.decode.utf8(url))) __M_writer(u'"></link>\n') return '' finally: context.caller_stack._pop_frame()