Skip to content

Commit

Permalink
Merged in features/LMA-608 (pull request openedx#6)
Browse files Browse the repository at this point in the history
Implement social sharing

Approved-by: Oksana Slusarenko
  • Loading branch information
Vladyslav Zherebkin authored and Oksana Slusarenko committed Apr 7, 2021
2 parents c70c311 + b570211 commit 2ff4680
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions lms/templates/courseware/course_about_sidebar_header.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<%namespace name='static' file='../static_content.html'/>
<%!
import six
import urllib

from django.utils.translation import ugettext as _
from django.urls import reverse
Expand Down Expand Up @@ -35,7 +36,27 @@
).replace(u" ", u"+")
tweet_action = u"http://twitter.com/intent/tweet?text={tweet_text}".format(tweet_text=six.moves.urllib.parse.quote_plus(tweet_text.encode('UTF-8')))

facebook_link = static.get_value('course_about_facebook_link', settings.PLATFORM_FACEBOOK_ACCOUNT)
facebook_text = _("I just enrolled in {number} {title}: {url}").format(
number=course.number,
title=course.display_name_with_default_escaped,
url=u"{protocol}://{domain}{path}".format(
protocol=site_protocol,
domain=site_domain,
path=urllib.parse.quote_plus(
reverse('about_course', args=[text_type(course.id)]),
)
)
).replace(u" ", u"%20")
course_url=u"{protocol}://{domain}{path}".format(
protocol=site_protocol,
domain=site_domain,
path=urllib.parse.quote_plus(
reverse('about_course', args=[text_type(course.id)]),
),
)
facebook_action = u"https://www.facebook.com/sharer/sharer.php?u={course_url}&quote={facebook_text}".format(
course_url=course_url, facebook_text=facebook_text
)

email_body = _("I just enrolled in {number} {title} through {platform} {url}").format(
number=course.number,
Expand All @@ -57,7 +78,7 @@
<a href="${tweet_action}" class="share">
<span class="icon fa fa-twitter" aria-hidden="true"></span><span class="sr">${_("Tweet that you've enrolled in this course")}</span>
</a>
<a href="${facebook_link}" class="share">
<a href="${facebook_action}" class="share">
<span class="icon fa fa-thumbs-up" aria-hidden="true"></span><span class="sr">${_("Post a Facebook message to say you've enrolled in this course")}</span>
</a>
<a href="${email_link}" class="share">
Expand Down

0 comments on commit 2ff4680

Please sign in to comment.