From 1529c1e956d78deafb4165c11198a7d32f751b9c Mon Sep 17 00:00:00 2001 From: Will Daly Date: Mon, 16 Mar 2015 14:15:22 -0400 Subject: [PATCH] Update social media links in EdX footer. Replaces some PLATFORM_* settings with a more general setting for specifying social media URLs in the footer. Adds icons and titles for new social media sites (Tumblr, Reddit, Youtube) to match EdX.org. --- .../courseware/tests/test_footer.py | 21 +++++ lms/envs/aws.py | 8 +- lms/envs/common.py | 76 +++++++++++++++++-- lms/templates/footer-edx-new.html | 40 +++------- 4 files changed, 106 insertions(+), 39 deletions(-) diff --git a/lms/djangoapps/courseware/tests/test_footer.py b/lms/djangoapps/courseware/tests/test_footer.py index f9c3c24ba375..f504abb9cb4e 100644 --- a/lms/djangoapps/courseware/tests/test_footer.py +++ b/lms/djangoapps/courseware/tests/test_footer.py @@ -5,12 +5,24 @@ from mock import patch +from django.conf import settings from django.test import TestCase from django.test.utils import override_settings 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 @@ -35,3 +47,12 @@ def test_openedx_footer(self): # 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 db43cf3c562e..0b9f61a0e0dd 100644 --- a/lms/envs/aws.py +++ b/lms/envs/aws.py @@ -135,11 +135,9 @@ # 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 14d998b0606e..23cedf01b269 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -51,11 +51,6 @@ 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 @@ -1688,6 +1683,77 @@ '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 950d4aafd13d..b54e2a06f7bd 100644 --- a/lms/templates/footer-edx-new.html +++ b/lms/templates/footer-edx-new.html @@ -74,36 +74,18 @@ % if settings.FEATURES.get('ENABLE_FOOTER_MOBILE_APP_LINKS'):