Commit 1529c1e9 by Will Daly

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.
parent a35264af
......@@ -5,12 +5,24 @@ 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
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 @@ 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'])
......@@ -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)
......
......@@ -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
......@@ -1688,6 +1683,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.
......
......@@ -74,36 +74,18 @@
<h2 class="footer-follow-title">${_("Follow Us")}</h2>
<div class="footer-follow-links">
## Translators: This is the website name of www.twitter.com. Please
## translate this the way that Twitter advertises in your language.
<a href="${settings.PLATFORM_TWITTER_URL}" title="${_("Twitter")}" rel="noreferrer">
<i class="icon fa fa-twitter element-invisible"></i>
<span class="copy">${_("Twitter")}</span>
</a>
## Translators: This is the website name of www.facebook.com. Please
## translate this the way that Facebook advertises in your language.
<a href="${settings.PLATFORM_FACEBOOK_ACCOUNT}" title="${_("Facebook")}" rel="noreferrer">
<i class="icon fa fa-facebook element-invisible"></i>
<span class="copy">${_("Facebook")}</span>
</a>
## Translators: This is the website name of www.meetup.com. Please
## translate this the way that Meetup advertises in your language.
<a href="${settings.PLATFORM_MEETUP_URL}" title="${_("Meetup")}" rel="noreferrer">
<i class="icon fa fa-calendar element-invisible"></i>
<span class="copy">${_("Meetup")}</span>
</a>
## Translators: This is the website name of www.linked.com. Please
## translate this the way that LinkedIn advertises in your language.
<a href="${settings.PLATFORM_LINKEDIN_URL}" title="${_("LinkedIn")}" rel="noreferrer">
<i class="icon fa fa-linkedin element-invisible"></i>
<span class="copy">${_("LinkedIn")}</span>
</a>
## Translators: This is the website name of plus.google.com. Please
## translate this the way that Google+ advertises in your language.
<a href="${settings.PLATFORM_GOOGLE_PLUS_URL}" title="${_("Google+")}" rel="noreferrer">
<i class="icon fa fa-google-plus element-invisible"></i>
<span class="copy">${_("Google+")}</span>
% for social_name in settings.SOCIAL_MEDIA_FOOTER_NAMES:
<% social_url, social_title, social_icon = (
settings.SOCIAL_MEDIA_FOOTER_URLS.get(social_name, "#"),
unicode(settings.SOCIAL_MEDIA_FOOTER_DISPLAY.get(social_name, {}).get("title", "")),
settings.SOCIAL_MEDIA_FOOTER_DISPLAY.get(social_name).get("icon", "")
)
%>
<a href="${social_url}" title="${social_title}" rel="noreferrer">
<i class="icon fa ${social_icon} element-invisible"></i>
<span class="copy">${social_title}</span>
</a>
% endfor
</div>
% if settings.FEATURES.get('ENABLE_FOOTER_MOBILE_APP_LINKS'):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment