From 2fd68dc983b7548300260737de9c249166d5a137 Mon Sep 17 00:00:00 2001 From: Will Daly Date: Fri, 12 Jun 2015 11:06:41 -0400 Subject: [PATCH] ECOM-1724 a11y footer updates * Add action text to social media links. * Make the alt text for mobile links more descriptive. --- lms/djangoapps/branding/api.py | 27 +++++++++++++++------ lms/djangoapps/branding/tests/test_views.py | 1 + lms/djangoapps/branding/views.py | 3 ++- lms/envs/common.py | 18 +++++++++----- lms/templates/footer-edx-v3.html | 1 + 5 files changed, 35 insertions(+), 15 deletions(-) diff --git a/lms/djangoapps/branding/api.py b/lms/djangoapps/branding/api.py index e964580c8f..c1bd3c0c4e 100644 --- a/lms/djangoapps/branding/api.py +++ b/lms/djangoapps/branding/api.py @@ -55,7 +55,8 @@ def get_footer(is_secure=True): "name": "facebook", "title": "Facebook", "url": "http://www.facebook.com/example", - "icon-class": "fa-facebook-square" + "icon-class": "fa-facebook-square", + "action": "Sign up on Facebook!" }, ... ], @@ -71,7 +72,7 @@ def get_footer(is_secure=True): { "name": "apple", "title": "Apple", - "url": "http://store.apple.com/example_app" + "url": "http://store.apple.com/example_app", "image": "http://example.com/static/apple_logo.png" }, ... @@ -148,14 +149,18 @@ def _footer_social_links(): Returns: list """ + platform_name = microsite.get_value('platform_name', settings.PLATFORM_NAME) links = [] + for social_name in settings.SOCIAL_MEDIA_FOOTER_NAMES: + display = settings.SOCIAL_MEDIA_FOOTER_DISPLAY.get(social_name, {}) links.append( { "name": social_name, - "title": unicode(settings.SOCIAL_MEDIA_FOOTER_DISPLAY.get(social_name, {}).get("title", "")), + "title": unicode(display.get("title", "")), "url": settings.SOCIAL_MEDIA_FOOTER_URLS.get(social_name, "#"), - "icon-class": settings.SOCIAL_MEDIA_FOOTER_DISPLAY.get(social_name, {}).get("icon", ""), + "icon-class": display.get("icon", ""), + "action": unicode(display.get("action", "")).format(platform_name=platform_name), } ) return links @@ -221,20 +226,26 @@ def _footer_mobile_links(is_secure): Returns: list """ + platform_name = microsite.get_value('platform_name', settings.PLATFORM_NAME) + mobile_links = [] if settings.FEATURES.get('ENABLE_FOOTER_MOBILE_APP_LINKS'): mobile_links = [ { "name": "apple", - "title": "Apple", + "title": _( + "Download the {platform_name} mobile app from the Apple App Store" + ).format(platform_name=platform_name), "url": settings.MOBILE_STORE_URLS.get('apple', '#'), - "image": _absolute_url_staticfile(is_secure, 'images/app/app_store_badge_135x40.svg') + "image": _absolute_url_staticfile(is_secure, 'images/app/app_store_badge_135x40.svg'), }, { "name": "google", - "title": "Google", + "title": _( + "Download the {platform_name} mobile app from Google Play" + ).format(platform_name=platform_name), "url": settings.MOBILE_STORE_URLS.get('google', '#'), - "image": _absolute_url_staticfile(is_secure, 'images/app/google_play_badge_45.png') + "image": _absolute_url_staticfile(is_secure, 'images/app/google_play_badge_45.png'), } ] return mobile_links diff --git a/lms/djangoapps/branding/tests/test_views.py b/lms/djangoapps/branding/tests/test_views.py index 41c7db22cb..64dd0f3b51 100644 --- a/lms/djangoapps/branding/tests/test_views.py +++ b/lms/djangoapps/branding/tests/test_views.py @@ -77,6 +77,7 @@ class TestFooter(TestCase): self.assertIn("title", link) self.assertIn("url", link) self.assertIn("icon-class", link) + self.assertIn("action", link) # Mobile links self.assertIn("mobile_links", json_data) diff --git a/lms/djangoapps/branding/views.py b/lms/djangoapps/branding/views.py index 398c025f2b..17677bdfbd 100644 --- a/lms/djangoapps/branding/views.py +++ b/lms/djangoapps/branding/views.py @@ -206,7 +206,8 @@ def footer(request): "url": "http://example.com/social", "name": "facebook", "icon-class": "fa-facebook-square", - "title": "Facebook" + "title": "Facebook", + "action": "Sign up on Facebook!" }, # ... ], diff --git a/lms/envs/common.py b/lms/envs/common.py index 340a5130e5..a495c62c1a 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -1911,25 +1911,29 @@ SOCIAL_MEDIA_FOOTER_DISPLAY = { # 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" + "icon": "fa-facebook-square", + "action": _("Like {platform_name} on Facebook") }, "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" + "icon": "fa-twitter", + "action": _("Follow {platform_name} on 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" + "icon": "fa-linkedin-square", + "action": _("Follow {platform_name} on LinkedIn") }, "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" + "icon": "fa-google-plus-square", + "action": _("Follow {platform_name} on Google+") }, "tumblr": { # Translators: This is the website name of www.tumblr.com. Please @@ -1947,7 +1951,8 @@ SOCIAL_MEDIA_FOOTER_DISPLAY = { # 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" + "icon": "fa-reddit", + "action": _("Subscribe to the {platform_name} subreddit"), }, "vk": { # Translators: This is the website name of https://vk.com. Please @@ -1965,7 +1970,8 @@ SOCIAL_MEDIA_FOOTER_DISPLAY = { # 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" + "icon": "fa-youtube", + "action": _("Subscribe to the {platform_name} YouTube channel") } } diff --git a/lms/templates/footer-edx-v3.html b/lms/templates/footer-edx-v3.html index 55a7aa7a45..5df9e230e5 100644 --- a/lms/templates/footer-edx-v3.html +++ b/lms/templates/footer-edx-v3.html @@ -51,6 +51,7 @@ % for link in footer['social_links']: + ${link['action']} % endfor