diff --git a/lms/djangoapps/courseware/tests/test_footer.py b/lms/djangoapps/courseware/tests/test_footer.py index f8552d06c9..1985efd000 100644 --- a/lms/djangoapps/courseware/tests/test_footer.py +++ b/lms/djangoapps/courseware/tests/test_footer.py @@ -5,11 +5,23 @@ edx.org uses an edx footer but other instances use an Open edX footer. from mock import patch +from django.conf import settings from django.test import TestCase class TestFooter(TestCase): + SOCIAL_MEDIA_URLS = { + "facebook": "http://www.facebook.com/", + "google_plus": "https://plus.google.com/", + "twitter": "https://twitter.com/", + "linkedin": "http://www.linkedin.com/", + "tumblr": "http://www.tumblr.com/", + "meetup": "http://www.meetup.com/", + "reddit": "http://www.reddit.com/", + "youtube": "https://www.youtube.com/" + } + def test_edx_footer(self): """ Verify that the homepage, when accessed at edx.org, has the edX footer @@ -34,3 +46,12 @@ class TestFooter(TestCase): # assert that footer template has been properly overridden on homepage # test the top-level element class; which is less likely to change than copy. self.assertContains(resp, 'wrapper-footer') + + @patch.dict(settings.FEATURES, {'IS_EDX_DOMAIN': True}) + @override_settings(SOCIAL_MEDIA_FOOTER_URLS=SOCIAL_MEDIA_URLS) + def test_edx_footer_social_links(self): + resp = self.client.get('/') + for name, url in self.SOCIAL_MEDIA_URLS.iteritems(): + self.assertContains(resp, url) + self.assertContains(resp, settings.SOCIAL_MEDIA_FOOTER_DISPLAY[name]['title']) + self.assertContains(resp, settings.SOCIAL_MEDIA_FOOTER_DISPLAY[name]['icon']) diff --git a/lms/envs/aws.py b/lms/envs/aws.py index db43cf3c56..0b9f61a0e0 100644 --- a/lms/envs/aws.py +++ b/lms/envs/aws.py @@ -135,11 +135,9 @@ PLATFORM_NAME = ENV_TOKENS.get('PLATFORM_NAME', PLATFORM_NAME) # For displaying on the receipt. At Stanford PLATFORM_NAME != MERCHANT_NAME, but PLATFORM_NAME is a fine default PLATFORM_TWITTER_ACCOUNT = ENV_TOKENS.get('PLATFORM_TWITTER_ACCOUNT', PLATFORM_TWITTER_ACCOUNT) PLATFORM_FACEBOOK_ACCOUNT = ENV_TOKENS.get('PLATFORM_FACEBOOK_ACCOUNT', PLATFORM_FACEBOOK_ACCOUNT) -# Used for social media links. -PLATFORM_TWITTER_URL = ENV_TOKENS.get('PLATFORM_TWITTER_URL', PLATFORM_TWITTER_URL) -PLATFORM_MEETUP_URL = ENV_TOKENS.get('PLATFORM_MEETUP_URL', PLATFORM_MEETUP_URL) -PLATFORM_LINKEDIN_URL = ENV_TOKENS.get('PLATFORM_LINKEDIN_URL', PLATFORM_LINKEDIN_URL) -PLATFORM_GOOGLE_PLUS_URL = ENV_TOKENS.get('PLATFORM_GOOGLE_PLUS_URL', PLATFORM_GOOGLE_PLUS_URL) + +# Social media links for the page footer +SOCIAL_MEDIA_FOOTER_URLS = ENV_TOKENS.get('SOCIAL_MEDIA_FOOTER_URLS', SOCIAL_MEDIA_FOOTER_URLS) CC_MERCHANT_NAME = ENV_TOKENS.get('CC_MERCHANT_NAME', PLATFORM_NAME) EMAIL_BACKEND = ENV_TOKENS.get('EMAIL_BACKEND', EMAIL_BACKEND) diff --git a/lms/envs/common.py b/lms/envs/common.py index 18955a4dd7..7ab9cbee2b 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -51,11 +51,6 @@ COPYRIGHT_YEAR = "2015" PLATFORM_FACEBOOK_ACCOUNT = "http://www.facebook.com/YourPlatformFacebookAccount" PLATFORM_TWITTER_ACCOUNT = "@YourPlatformTwitterAccount" -PLATFORM_TWITTER_URL = "https://twitter.com/YourPlatformTwitterAccount" -PLATFORM_MEETUP_URL = "http://www.meetup.com/YourMeetup" -PLATFORM_LINKEDIN_URL = "http://www.linkedin.com/company/YourPlatform" -PLATFORM_GOOGLE_PLUS_URL = "https://plus.google.com/YourGooglePlusAccount/" - COURSEWARE_ENABLED = True ENABLE_JASMINE = False @@ -1700,6 +1695,77 @@ MKTG_URL_LINK_MAP = { 'WHAT_IS_VERIFIED_CERT': 'verified-certificate', } +################# Social Media Footer Links ####################### +# The names list controls the order of social media +# links in the footer. +SOCIAL_MEDIA_FOOTER_NAMES = [ + "facebook", + "twitter", + "linkedin", + "google_plus", + "tumblr", + "meetup", + "reddit", + "youtube", +] + +# The footer URLs dictionary maps social footer names +# to URLs defined in configuration. +SOCIAL_MEDIA_FOOTER_URLS = {} + +# The display dictionary defines the title +# and icon class for each social media link. +SOCIAL_MEDIA_FOOTER_DISPLAY = { + "facebook": { + # Translators: This is the website name of www.facebook.com. Please + # translate this the way that Facebook advertises in your language. + "title": _("Facebook"), + "icon": "fa-facebook-square" + }, + "twitter": { + # Translators: This is the website name of www.twitter.com. Please + # translate this the way that Twitter advertises in your language. + "title": _("Twitter"), + "icon": "fa-twitter" + }, + "linkedin": { + # Translators: This is the website name of www.linkedin.com. Please + # translate this the way that LinkedIn advertises in your language. + "title": _("LinkedIn"), + "icon": "fa-linkedin-square" + }, + "google_plus": { + # Translators: This is the website name of plus.google.com. Please + # translate this the way that Google+ advertises in your language. + "title": _("Google+"), + "icon": "fa-google-plus-square" + }, + "tumblr": { + # Translators: This is the website name of www.tumblr.com. Please + # translate this the way that Tumblr advertises in your language. + "title": _("Tumblr"), + "icon": "fa-tumblr-square" + }, + "meetup": { + # Translators: This is the website name of www.meetup.com. Please + # translate this the way that MeetUp advertises in your language. + "title": _("Meetup"), + "icon": "fa-calendar" + }, + "reddit": { + # Translators: This is the website name of www.reddit.com. Please + # translate this the way that Reddit advertises in your language. + "title": _("Reddit"), + "icon": "fa-reddit-square" + }, + "youtube": { + # Translators: This is the website name of www.youtube.com. Please + # translate this the way that YouTube advertises in your language. + "title": _("Youtube"), + "icon": "fa-youtube-square" + } +} + ################# Mobile URLS ########################## # These are URLs to the app store for mobile. diff --git a/lms/templates/footer-edx-new.html b/lms/templates/footer-edx-new.html index 950d4aafd1..b54e2a06f7 100644 --- a/lms/templates/footer-edx-new.html +++ b/lms/templates/footer-edx-new.html @@ -74,36 +74,18 @@