Exemple #1
0
 def test_get_footer_disabled_contact_form(self):
     """
     Test retrieving the footer with disabled contact form.
     """
     actual_footer = get_footer(is_secure=True)
     self.assertEqual(any(l['name'] == 'contact' for l in actual_footer['connect_links']), False)
     self.assertEqual(any(l['name'] == 'contact' for l in actual_footer['navigation_links']), False)
 def test_get_footer_disabled_contact_form(self):
     """
     Test retrieving the footer with disabled contact form.
     """
     actual_footer = get_footer(is_secure=True)
     self.assertEqual(any(l['name'] == 'contact' for l in actual_footer['connect_links']), False)
     self.assertEqual(any(l['name'] == 'contact' for l in actual_footer['navigation_links']), False)
    def completion(self, request, suffix=''):

        context = {
            "logo": branding_api.get_logo_url(False),
            "course": get_course_by_id(self.course_id),
            "footer": branding_api.get_footer(False),
            "completed_survey": self.verify_completion(),
            "css": self.resource_string("static/css/surveymonkey.css"),
        }
        return Response(
            LOADER.render_template(
                "static/html/surveymonkey_completion_page.html", context))
Exemple #4
0
 def test_get_footer(self):
     actual_footer = get_footer(is_secure=True)
     expected_footer = {
         'copyright': '\xa9 \xe9dX.  All rights reserved except where noted.  EdX, Open edX and the edX and Open'
                      ' EdX logos are registered trademarks or trademarks of edX Inc.',
         'navigation_links': [
             {'url': 'https://edx.org/about-us', 'name': 'about', 'title': 'About'},
             {'url': 'https://edx.org/enterprise', 'name': 'enterprise', 'title': '\xe9dX for Business'},
             {'url': 'https://edx.org/edx-blog', 'name': 'blog', 'title': 'Blog'},
             {'url': 'https://edx.org/news-announcements', 'name': 'news', 'title': 'News'},
             {'url': 'https://support.example.com', 'name': 'help-center', 'title': 'Help Center'},
             {'url': 'https://edx.org/contact', 'name': 'contact', 'title': 'Contact'},
             {'url': 'https://edx.org/donate', 'name': 'donate', 'title': 'Donate'}
         ],
         'legal_links': [
             {'url': 'https://edx.org/edx-terms-service',
              'name': 'terms_of_service_and_honor_code',
              'title': 'Terms of Service & Honor Code'},
             {'url': 'https://edx.org/edx-privacy-policy', 'name': 'privacy_policy', 'title': 'Privacy Policy'},
             {'url': 'https://edx.org/accessibility',
              'name': 'accessibility_policy',
              'title': 'Accessibility Policy'},
             {'url': 'https://edx.org/sitemap', 'name': 'sitemap', 'title': 'Sitemap'},
             {'url': 'https://edx.org/media-kit', 'name': 'media_kit', 'title': 'Media Kit'}
         ],
         'social_links': [
             {'url': '#', 'action': 'Like \xe9dX on Facebook', 'name': 'facebook',
              'icon-class': 'fa-facebook-square', 'title': 'Facebook'},
             {'url': '#', 'action': 'Follow \xe9dX on Twitter', 'name': 'twitter',
              'icon-class': 'fa-twitter', 'title': 'Twitter'},
             {'url': '#', 'action': 'Subscribe to the \xe9dX YouTube channel',
              'name': 'youtube', 'icon-class': 'fa-youtube', 'title': 'Youtube'},
             {'url': '#', 'action': 'Follow \xe9dX on LinkedIn', 'name': 'linkedin',
              'icon-class': 'fa-linkedin-square', 'title': 'LinkedIn'},
             {'url': '#', 'action': 'Follow \xe9dX on Google+', 'name': 'google_plus',
              'icon-class': 'fa-google-plus-square', 'title': 'Google+'},
             {'url': '#', 'action': 'Subscribe to the \xe9dX subreddit',
              'name': 'reddit', 'icon-class': 'fa-reddit', 'title': 'Reddit'}
         ],
         'mobile_links': [],
         'logo_image': 'https://edx.org/static/images/logo.png',
         'openedx_link': {
             'url': 'http://open.edx.org',
             'image': 'https://files.edx.org/openedx-logos/edx-openedx-logo-tag.png',
             'title': 'Powered by Open edX'
         },
         'edx_org_link': {
             'url': 'https://www.edx.org/?utm_medium=affiliate_partner&utm_source=opensource-partner&utm_content=open-edx-partner-footer-link&utm_campaign=open-edx-footer',
             'text': 'Take free online courses at edX.org',
         },
     }
     self.assertEqual(actual_footer, expected_footer)
Exemple #5
0
    def test_get_footer_custom_contact_url(self):
        """
        Test retrieving the footer with custom contact form url.
        """
        actual_footer = get_footer(is_secure=True)
        contact_us_link = [l for l in actual_footer['connect_links'] if l['name'] == 'contact'][0]
        self.assertEqual(
            contact_us_link['url'],
            test_config_custom_url_contact_us['CONTACT_US_CUSTOM_LINK']
        )

        navigation_link_contact_us = [l for l in actual_footer['navigation_links'] if l['name'] == 'contact'][0]
        self.assertEqual(
            navigation_link_contact_us['url'],
            test_config_custom_url_contact_us['CONTACT_US_CUSTOM_LINK']
        )
    def test_get_footer_custom_contact_url(self):
        """
        Test retrieving the footer with custom contact form url.
        """
        actual_footer = get_footer(is_secure=True)
        contact_us_link = [l for l in actual_footer['connect_links'] if l['name'] == 'contact'][0]
        self.assertEqual(
            contact_us_link['url'],
            test_config_custom_url_contact_us['CONTACT_US_CUSTOM_LINK']
        )

        navigation_link_contact_us = [l for l in actual_footer['navigation_links'] if l['name'] == 'contact'][0]
        self.assertEqual(
            navigation_link_contact_us['url'],
            test_config_custom_url_contact_us['CONTACT_US_CUSTOM_LINK']
        )
Exemple #7
0
def footer(request):
    """Retrieve the branded footer.

    This end-point provides information about the site footer,
    allowing for consistent display of the footer across other sites
    (for example, on the marketing site and blog).

    It can be used in one of two ways:
    1) A client renders the footer from a JSON description.
    2) A browser loads an HTML representation of the footer
        and injects it into the DOM.  The HTML includes
        CSS and JavaScript links.

    In case (2), we assume that the following dependencies
    are included on the page:
    a) JQuery (same version as used in edx-platform)
    b) font-awesome (same version as used in edx-platform)
    c) Open Sans web fonts

    Example: Retrieving the footer as JSON

        GET /api/branding/v1/footer
        Accepts: application/json

        {
            "navigation_links": [
                {
                  "url": "http://example.com/about",
                  "name": "about",
                  "title": "About"
                },
                # ...
            ],
            "social_links": [
                {
                    "url": "http://example.com/social",
                    "name": "facebook",
                    "icon-class": "fa-facebook-square",
                    "title": "Facebook",
                    "action": "Sign up on Facebook!"
                },
                # ...
            ],
            "mobile_links": [
                {
                    "url": "http://example.com/android",
                    "name": "google",
                    "image": "http://example.com/google.png",
                    "title": "Google"
                },
                # ...
            ],
            "legal_links": [
                {
                    "url": "http://example.com/terms-of-service.html",
                    "name": "terms_of_service",
                    "title': "Terms of Service"
                },
                # ...
            ],
            "openedx_link": {
                "url": "http://open.edx.org",
                "title": "Powered by Open edX",
                "image": "http://example.com/openedx.png"
            },
            "logo_image": "http://example.com/static/images/logo.png",
            "copyright": "EdX, Open edX, and the edX and Open edX logos are \
                registered trademarks or trademarks of edX Inc."
        }


    Example: Retrieving the footer as HTML

        GET /api/branding/v1/footer
        Accepts: text/html


    Example: Including the footer with the "Powered by OpenEdX" logo

        GET /api/branding/v1/footer?show-openedx-logo=1
        Accepts: text/html


    Example: Retrieving the footer in a particular language

        GET /api/branding/v1/footer?language=en
        Accepts: text/html

    Example: Retrieving the footer with all JS and CSS dependencies (for testing)

        GET /api/branding/v1/footer?include-dependencies=1
        Accepts: text/html

    """
    if not branding_api.is_enabled():
        raise Http404

    # Use the content type to decide what representation to serve
    accepts = request.META.get('HTTP_ACCEPT', '*/*')

    # Show the OpenEdX logo in the footer
    show_openedx_logo = bool(request.GET.get('show-openedx-logo', False))

    # Include JS and CSS dependencies
    # This is useful for testing the end-point directly.
    include_dependencies = bool(request.GET.get('include-dependencies', False))

    # Override the language if necessary
    language = request.GET.get('language', translation.get_language())

    # Render the footer information based on the extension
    if 'text/html' in accepts or '*/*' in accepts:
        cache_key = u"branding.footer.{params}.html".format(
            params=urllib.urlencode({
                'language': language,
                'show_openedx_logo': show_openedx_logo,
                'include_dependencies': include_dependencies,
            })
        )
        content = cache.get(cache_key)
        if content is None:
            with translation.override(language):
                content = _render_footer_html(request, show_openedx_logo, include_dependencies)
                cache.set(cache_key, content, settings.FOOTER_CACHE_TIMEOUT)
        return HttpResponse(content, status=200, content_type="text/html; charset=utf-8")

    elif 'application/json' in accepts:
        cache_key = u"branding.footer.{params}.json".format(
            params=urllib.urlencode({
                'language': language,
                'is_secure': request.is_secure(),
            })
        )
        footer_dict = cache.get(cache_key)
        if footer_dict is None:
            with translation.override(language):
                footer_dict = branding_api.get_footer(is_secure=request.is_secure())
                cache.set(cache_key, footer_dict, settings.FOOTER_CACHE_TIMEOUT)
        return JsonResponse(footer_dict, 200, content_type="application/json; charset=utf-8")

    else:
        return HttpResponse(status=406)
Exemple #8
0
def footer(request):
    """Retrieve the branded footer.

    This end-point provides information about the site footer,
    allowing for consistent display of the footer across other sites
    (for example, on the marketing site and blog).

    It can be used in one of two ways:
    1) A client renders the footer from a JSON description.
    2) A browser loads an HTML representation of the footer
        and injects it into the DOM.  The HTML includes
        CSS and JavaScript links.

    In case (2), we assume that the following dependencies
    are included on the page:
    a) JQuery (same version as used in edx-platform)
    b) font-awesome (same version as used in edx-platform)
    c) Open Sans web fonts

    Example: Retrieving the footer as JSON

        GET /api/branding/v1/footer
        Accepts: application/json

        {
            "navigation_links": [
                {
                  "url": "http://example.com/about",
                  "name": "about",
                  "title": "About"
                },
                # ...
            ],
            "social_links": [
                {
                    "url": "http://example.com/social",
                    "name": "facebook",
                    "icon-class": "fa-facebook-square",
                    "title": "Facebook",
                    "action": "Sign up on Facebook!"
                },
                # ...
            ],
            "mobile_links": [
                {
                    "url": "http://example.com/android",
                    "name": "google",
                    "image": "http://example.com/google.png",
                    "title": "Google"
                },
                # ...
            ],
            "legal_links": [
                {
                    "url": "http://example.com/terms-of-service.html",
                    "name": "terms_of_service",
                    "title': "Terms of Service"
                },
                # ...
            ],
            "openedx_link": {
                "url": "http://open.edx.org",
                "title": "Powered by Open edX",
                "image": "http://example.com/openedx.png"
            },
            "logo_image": "http://example.com/static/images/logo.png",
            "copyright": "edX, Open edX and their respective logos are registered trademarks of edX Inc."
        }


    Example: Retrieving the footer as HTML

        GET /api/branding/v1/footer
        Accepts: text/html


    Example: Including the footer with the "Powered by Open edX" logo

        GET /api/branding/v1/footer?show-openedx-logo=1
        Accepts: text/html


    Example: Retrieving the footer in a particular language

        GET /api/branding/v1/footer?language=en
        Accepts: text/html


    Example: Retrieving the footer with a language selector

        GET /api/branding/v1/footer?include-language-selector=1
        Accepts: text/html


    Example: Retrieving the footer with all JS and CSS dependencies (for testing)

        GET /api/branding/v1/footer?include-dependencies=1
        Accepts: text/html

    """
    if not branding_api.is_enabled():
        raise Http404

    # Use the content type to decide what representation to serve
    accepts = request.META.get('HTTP_ACCEPT', '*/*')

    # Show the OpenEdX logo in the footer
    show_openedx_logo = bool(request.GET.get('show-openedx-logo', False))

    # Include JS and CSS dependencies
    # This is useful for testing the end-point directly.
    include_dependencies = bool(request.GET.get('include-dependencies', False))

    # Override the language if necessary
    language = request.GET.get('language', translation.get_language())
    try:
        language = get_supported_language_variant(language)
    except LookupError:
        language = settings.LANGUAGE_CODE

    # Include a language selector
    include_language_selector = request.GET.get('include-language-selector',
                                                '') == '1'

    # Render the footer information based on the extension
    if 'text/html' in accepts or '*/*' in accepts:
        cache_params = {
            'language': language,
            'show_openedx_logo': show_openedx_logo,
            'include_dependencies': include_dependencies
        }
        if include_language_selector:
            cache_params['language_selector_options'] = ','.join(
                sorted([lang.code for lang in released_languages()]))
        cache_key = u"branding.footer.{params}.html".format(
            params=six.moves.urllib.parse.urlencode(cache_params))

        content = cache.get(cache_key)
        if content is None:
            with translation.override(language):
                content = _render_footer_html(request, show_openedx_logo,
                                              include_dependencies,
                                              include_language_selector,
                                              language)
                cache.set(cache_key, content, settings.FOOTER_CACHE_TIMEOUT)
        return HttpResponse(content,
                            status=200,
                            content_type="text/html; charset=utf-8")

    elif 'application/json' in accepts:
        cache_key = u"branding.footer.{params}.json".format(
            params=six.moves.urllib.parse.urlencode(
                {
                    'language': language,
                    'is_secure': request.is_secure(),
                }))
        footer_dict = cache.get(cache_key)
        if footer_dict is None:
            with translation.override(language):
                footer_dict = branding_api.get_footer(
                    is_secure=request.is_secure())
                cache.set(cache_key, footer_dict,
                          settings.FOOTER_CACHE_TIMEOUT)
        return JsonResponse(footer_dict,
                            200,
                            content_type="application/json; charset=utf-8")

    else:
        return HttpResponse(status=406)
Exemple #9
0
    def test_get_footer(self):
        actual_footer = get_footer(is_secure=True)
        business_url = 'https://business.edx.org/?utm_campaign=edX.org+Referral&utm_source=edX.org&utm_medium=Footer'
        expected_footer = {
            'copyright': '\xa9 \xe9dX.  All rights reserved except where noted. '
                         ' edX, Open edX and their respective logos are '
                         'registered trademarks of edX Inc.',
            'navigation_links': [
                {'url': 'https://edx.org/about-us', 'name': 'about', 'title': 'About'},
                {'url': 'https://business.edx.org', 'name': 'enterprise', 'title': '\xe9dX for Business'},
                {'url': 'https://edx.org/edx-blog', 'name': 'blog', 'title': 'Blog'},
                {'url': 'https://edx.org/news-announcements', 'name': 'news', 'title': 'News'},
                {'url': 'https://example.support.edx.org/hc/en-us', 'name': 'help-center', 'title': 'Help Center'},
                {'url': '/support/contact_us', 'name': 'contact', 'title': 'Contact'},
                {'url': 'https://edx.org/careers', 'name': 'careers', 'title': 'Careers'},
                {'url': 'https://edx.org/donate', 'name': 'donate', 'title': 'Donate'}
            ],
            'business_links': [
                {'url': 'https://edx.org/about-us', 'name': 'about', 'title': 'About'},
                {'url': business_url, 'name': 'enterprise', 'title': '\xe9dX for Business'},
                {'url': 'https://edx.org/affiliate-program', 'name': 'affiliates', 'title': 'Affiliates'},
                {'url': 'http://open.edx.org', 'name': 'openedx', 'title': 'Open edX'},
                {'url': 'https://edx.org/careers', 'name': 'careers', 'title': 'Careers'},
                {'url': 'https://edx.org/news-announcements', 'name': 'news', 'title': 'News'},

            ],
            'more_info_links': [
                {'url': 'https://edx.org/edx-terms-service',
                 'name': 'terms_of_service_and_honor_code',
                 'title': 'Terms of Service & Honor Code'},
                {'url': 'https://edx.org/edx-privacy-policy', 'name': 'privacy_policy', 'title': 'Privacy Policy'},
                {'url': 'https://edx.org/accessibility',
                 'name': 'accessibility_policy',
                 'title': 'Accessibility Policy'},
                {'url': 'https://edx.org/trademarks', 'name': 'trademarks', 'title': 'Trademark Policy'},
                {'url': 'https://edx.org/sitemap', 'name': 'sitemap', 'title': 'Sitemap'},

            ],
            'connect_links': [
                {'url': 'https://edx.org/edx-blog', 'name': 'blog', 'title': 'Blog'},
                # pylint: disable=line-too-long
                {'url': '{base_url}/support/contact_us'.format(base_url=settings.LMS_ROOT_URL), 'name': 'contact', 'title': 'Contact Us'},
                {'url': 'https://example.support.edx.org/hc/en-us', 'name': 'help-center', 'title': 'Help Center'},
                {'url': 'https://edx.org/media-kit', 'name': 'media_kit', 'title': 'Media Kit'},
                {'url': 'https://edx.org/donate', 'name': 'donate', 'title': 'Donate'}
            ],
            'legal_links': [
                {'url': 'https://edx.org/edx-terms-service',
                 'name': 'terms_of_service_and_honor_code',
                 'title': 'Terms of Service & Honor Code'},
                {'url': 'https://edx.org/edx-privacy-policy', 'name': 'privacy_policy', 'title': 'Privacy Policy'},
                {'url': 'https://edx.org/accessibility',
                 'name': 'accessibility_policy',
                 'title': 'Accessibility Policy'},
                {'url': 'https://edx.org/sitemap', 'name': 'sitemap', 'title': 'Sitemap'},
                {'name': 'media_kit',
                 'title': u'Media Kit',
                 'url': u'https://edx.org/media-kit'}
            ],
            'social_links': [
                {'url': '#', 'action': 'Like \xe9dX on Facebook', 'name': 'facebook',
                 'icon-class': 'fa-facebook-square', 'title': 'Facebook'},
                {'url': '#', 'action': 'Follow \xe9dX on Twitter', 'name': 'twitter',
                 'icon-class': 'fa-twitter-square', 'title': 'Twitter'},
                {'url': '#', 'action': 'Follow \xe9dX on LinkedIn', 'name': 'linkedin',
                 'icon-class': 'fa-linkedin-square', 'title': 'LinkedIn'},
                {'url': '#', 'action': 'Follow \xe9dX on Google+', 'name': 'google_plus',
                 'icon-class': 'fa-google-plus-square', 'title': 'Google+'},
                {'url': '#', 'action': 'Subscribe to the \xe9dX subreddit',
                 'name': 'reddit', 'icon-class': 'fa-reddit-square', 'title': 'Reddit'}
            ],
            'mobile_links': [],
            'logo_image': 'https://edx.org/static/images/logo.png',
            'openedx_link': {
                'url': 'http://open.edx.org',
                'image': 'https://files.edx.org/openedx-logos/edx-openedx-logo-tag.png',
                'title': 'Powered by Open edX'
            },
            'edx_org_link': {
                'url': 'https://www.edx.org/?'
                       'utm_medium=affiliate_partner'
                       '&utm_source=opensource-partner'
                       '&utm_content=open-edx-partner-footer-link'
                       '&utm_campaign=open-edx-footer',
                'text': 'Take free online courses at edX.org',
            },
        }
        self.assertEqual(actual_footer, expected_footer)
    def test_get_footer(self):
        actual_footer = get_footer(is_secure=True)
        expected_footer = {
            'copyright': '\xa9 \xe9dX.  All rights reserved except where noted. '
                         ' EdX, Open edX and their respective logos are '
                         'trademarks or registered trademarks of edX Inc.',
            'navigation_links': [
                {'url': 'https://edx.org/about-us', 'name': 'about', 'title': 'About'},
                {'url': 'https://edx.org/enterprise', 'name': 'enterprise', 'title': '\xe9dX for Business'},
                {'url': 'https://edx.org/edx-blog', 'name': 'blog', 'title': 'Blog'},
                {'url': 'https://edx.org/news-announcements', 'name': 'news', 'title': 'News'},
                {'url': 'https://support.example.com', 'name': 'help-center', 'title': 'Help Center'},
                {'url': '/support/contact_us', 'name': 'contact', 'title': 'Contact'},
                {'url': 'https://edx.org/careers', 'name': 'careers', 'title': 'Careers'},
                {'url': 'https://edx.org/donate', 'name': 'donate', 'title': 'Donate'}
            ],
            'business_links': [
                {'url': 'https://edx.org/about-us', 'name': 'about', 'title': 'About'},
                {'url': 'https://edx.org/enterprise', 'name': 'enterprise', 'title': '\xe9dX for Business'},
                {'url': 'https://edx.org/affiliate-program', 'name': 'affiliates', 'title': 'Affiliates'},
                {'url': 'http://open.edx.org', 'name': 'openedx', 'title': 'Open edX'},
                {'url': 'https://edx.org/careers', 'name': 'careers', 'title': 'Careers'},
                {'url': 'https://edx.org/news-announcements', 'name': 'news', 'title': 'News'},

            ],
            'more_info_links': [
                {'url': 'https://edx.org/edx-terms-service',
                 'name': 'terms_of_service_and_honor_code',
                 'title': 'Terms of Service & Honor Code'},
                {'url': 'https://edx.org/edx-privacy-policy', 'name': 'privacy_policy', 'title': 'Privacy Policy'},
                {'url': 'https://edx.org/accessibility',
                 'name': 'accessibility_policy',
                 'title': 'Accessibility Policy'},
                {'url': 'https://edx.org/trademarks', 'name': 'trademarks', 'title': 'Trademark Policy'},
                {'url': 'https://edx.org/sitemap', 'name': 'sitemap', 'title': 'Sitemap'},

            ],
            'connect_links': [
                {'url': 'https://edx.org/edx-blog', 'name': 'blog', 'title': 'Blog'},
                # pylint: disable=line-too-long
                {'url': '{base_url}/support/contact_us'.format(base_url=settings.LMS_ROOT_URL), 'name': 'contact', 'title': 'Contact Us'},
                {'url': 'https://support.example.com', 'name': 'help-center', 'title': 'Help Center'},
                {'url': 'https://edx.org/media-kit', 'name': 'media_kit', 'title': 'Media Kit'},
                {'url': 'https://edx.org/donate', 'name': 'donate', 'title': 'Donate'}
            ],
            'legal_links': [
                {'url': 'https://edx.org/edx-terms-service',
                 'name': 'terms_of_service_and_honor_code',
                 'title': 'Terms of Service & Honor Code'},
                {'url': 'https://edx.org/edx-privacy-policy', 'name': 'privacy_policy', 'title': 'Privacy Policy'},
                {'url': 'https://edx.org/accessibility',
                 'name': 'accessibility_policy',
                 'title': 'Accessibility Policy'},
                {'url': 'https://edx.org/sitemap', 'name': 'sitemap', 'title': 'Sitemap'},
                {'name': 'media_kit',
                 'title': u'Media Kit',
                 'url': u'https://edx.org/media-kit'}
            ],
            'social_links': [
                {'url': '#', 'action': 'Like \xe9dX on Facebook', 'name': 'facebook',
                 'icon-class': 'fa-facebook-square', 'title': 'Facebook'},
                {'url': '#', 'action': 'Follow \xe9dX on Twitter', 'name': 'twitter',
                 'icon-class': 'fa-twitter-square', 'title': 'Twitter'},
                {'url': '#', 'action': 'Subscribe to the \xe9dX YouTube channel',
                 'name': 'youtube', 'icon-class': 'fa-youtube-square', 'title': 'Youtube'},
                {'url': '#', 'action': 'Follow \xe9dX on LinkedIn', 'name': 'linkedin',
                 'icon-class': 'fa-linkedin-square', 'title': 'LinkedIn'},
                {'url': '#', 'action': 'Follow \xe9dX on Google+', 'name': 'google_plus',
                 'icon-class': 'fa-google-plus-square', 'title': 'Google+'},
                {'url': '#', 'action': 'Subscribe to the \xe9dX subreddit',
                 'name': 'reddit', 'icon-class': 'fa-reddit-square', 'title': 'Reddit'}
            ],
            'mobile_links': [],
            'logo_image': 'https://edx.org/static/images/logo.png',
            'openedx_link': {
                'url': 'http://open.edx.org',
                'image': 'https://files.edx.org/openedx-logos/edx-openedx-logo-tag.png',
                'title': 'Powered by Open edX'
            },
            'edx_org_link': {
                'url': 'https://www.edx.org/?utm_medium=affiliate_partner&utm_source=opensource-partner&utm_content=open-edx-partner-footer-link&utm_campaign=open-edx-footer',
                'text': 'Take free online courses at edX.org',
            },
        }
        self.assertEqual(actual_footer, expected_footer)
Exemple #11
0
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)
        is_secure = context.get('is_secure', UNDEFINED)
        static = _mako_get_namespace(context, 'static')
        bidi = context.get('bidi', UNDEFINED)
        footer_css_urls = context.get('footer_css_urls', 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<div class="wrapper wrapper-footer">\n\n  <div class="footer_section footer_section-contact-us">\n    <div class="footer_section-holder">\n      <span class="footer_text">If you have some questions please contact us</span>\n      <a class="footer_btn__contact" href="/contact">Contact us</a>\n    </div>\n  </div>\n\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      <div class="footer-nav-wrapper">\n        <div class="footer-col">\n          <div class="footer-title">About the CintanaTech</div>\n          <ul>\n            <li><a href="https://cintanatech.com/" target="_blank">CintanaTech</a></li>\n            <li><a href="https://cintanatech.com/" target="_blank">About Us</a></li>\n            <li><a href="https://cintanatech.com/" target="_blank">eDX Services</a></li>\n            <li><a href="https://cintanatech.com/" target="_blank">Blog</a></li>\n          </ul>\n        </div>\n\n        <div class="footer-col">\n          <div class="footer-title">courses</div>\n          <ul>\n            <li><a href="https://cintanatech.com/" target="_blank">Create Course Now</a></li>\n            <li><a href="https://cintanatech.com/en/about-us/" target="_blank">About Us</a></li>\n            <li><a href="https://cintanatech.com/#our_services" target="_blank">eDX Services</a></li>\n            <li><a href="https://cintanatech.com/en/blog/" target="_blank">Blog</a></li>\n          </ul>\n        </div>\n\n        <div class="footer-col">\n          <div class="footer-title">Contact us</div>\n          <ul>\n            <li><a href="/contact">Contact Us</a></li>\n            <li><a href="https://cintanatech.com/" target="_blank">Help</a></li>\n          </ul>\n        </div>\n      </div>\n\n      <div class="footer_section">\n        <div class="footer_copyright-holder">\n          \xa9 2020 CintanaTech. All Rights Reserved\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        </div>\n      </div>\n\n    </div>\n  </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()
Exemple #12
0
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()