Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
2277aaca
Commit
2277aaca
authored
Oct 24, 2017
by
Hasnain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WL-1060 | Made the dashboard social sharing site aware.
parent
a1419b15
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
common/djangoapps/util/course.py
+7
-2
lms/envs/common.py
+3
-1
lms/templates/dashboard/_dashboard_course_listing.html
+2
-2
No files found.
common/djangoapps/util/course.py
View file @
2277aaca
...
...
@@ -6,6 +6,8 @@ import urllib
from
django.conf
import
settings
from
openedx.core.djangoapps.site_configuration
import
helpers
as
configuration_helpers
log
=
logging
.
getLogger
(
__name__
)
COURSE_SHARING_UTM_PARAMETERS
=
{
...
...
@@ -40,14 +42,17 @@ def get_link_for_about_page(course):
Returns the course sharing url, this can be one of course's social sharing url, marketing url, or
lms course about url.
"""
is_social_sharing_enabled
=
getattr
(
settings
,
'SOCIAL_SHARING_SETTINGS'
,
{})
.
get
(
'CUSTOM_COURSE_URLS'
)
is_social_sharing_enabled
=
configuration_helpers
.
get_value
(
'SOCIAL_SHARING_SETTINGS'
,
getattr
(
settings
,
'SOCIAL_SHARING_SETTINGS'
,
{})
)
.
get
(
'CUSTOM_COURSE_URLS'
)
if
is_social_sharing_enabled
and
course
.
social_sharing_url
:
course_about_url
=
course
.
social_sharing_url
elif
settings
.
FEATURES
.
get
(
'ENABLE_MKTG_SITE'
)
and
getattr
(
course
,
'marketing_url'
,
None
):
course_about_url
=
course
.
marketing_url
else
:
course_about_url
=
u'{about_base_url}/courses/{course_key}/about'
.
format
(
about_base_url
=
settings
.
LMS_ROOT_URL
,
about_base_url
=
configuration_helpers
.
get_value
(
'LMS_ROOT_URL'
,
settings
.
LMS_ROOT_URL
)
,
course_key
=
unicode
(
course
.
id
),
)
...
...
lms/envs/common.py
View file @
2277aaca
...
...
@@ -2329,12 +2329,14 @@ SOCIAL_SHARING_SETTINGS = {
# Note: Ensure 'CUSTOM_COURSE_URLS' has a matching value in cms/envs/common.py
'CUSTOM_COURSE_URLS'
:
False
,
'DASHBOARD_FACEBOOK'
:
False
,
'FACEBOOK_BRAND'
:
None
,
'CERTIFICATE_FACEBOOK'
:
False
,
'CERTIFICATE_FACEBOOK_TEXT'
:
None
,
'CERTIFICATE_TWITTER'
:
False
,
'CERTIFICATE_TWITTER_TEXT'
:
None
,
'DASHBOARD_TWITTER'
:
False
,
'DASHBOARD_TWITTER_TEXT'
:
None
'DASHBOARD_TWITTER_TEXT'
:
None
,
'TWITTER_BRAND'
:
None
}
################# Social Media Footer Links #######################
...
...
lms/templates/dashboard/_dashboard_course_listing.html
View file @
2277aaca
...
...
@@ -166,7 +166,7 @@ from util.course import get_link_for_about_page, get_encoded_course_sharing_utm_
% if share_settings.get('DASHBOARD_FACEBOOK', False):
<
%
facebook_share_url =
"{url}?{utm_params}"
.
format
(
url=
share_url.encode('utf-8'),
utm_params=
encoded_utm_parameters['facebook'])
share_text =
_("I'm
taking
{
course_name
}
online
with
edX
.
org
.
Check
it
out
!").
format
(
course_name=
course_overview.display_name_with_default
)
share_text =
_("I'm
taking
{
course_name
}
online
with
{
facebook_brand
}.
Check
it
out
!").
format
(
course_name=
course_overview.display_name_with_default,
facebook_brand=
share_settings.get('FACEBOOK_BRAND',
'
edX
.
org
')
)
query_params =
urllib.urlencode((('u',
facebook_share_url
),
('
quote
',
share_text
.
encode
('
utf-8
')),))
facebook_url =
'https://www.facebook.com/sharer/sharer.php?{query}'
.
format
(
query=
query_params)
share_msg =
_("Share
{
course_name
}
on
Facebook
").
format
(
course_name=
course_overview.display_name_with_default)
...
...
@@ -187,7 +187,7 @@ from util.course import get_link_for_about_page, get_encoded_course_sharing_utm_
% if share_settings.get('DASHBOARD_TWITTER', False):
<
%
twitter_share_url =
"{url}?{utm_params}"
.
format
(
url=
share_url.encode('utf-8'),
utm_params=
encoded_utm_parameters['twitter'])
default_share_text =
_("I'm
taking
{
course_name
}
online
with
@
edxonline
.
Check
it
out
!").
format
(
course_name=
course_overview.display_name_with_default
)
default_share_text =
_("I'm
taking
{
course_name
}
online
with
{
twitter_brand
}.
Check
it
out
!").
format
(
course_name=
course_overview.display_name_with_default,
twitter_brand=
share_settings.get('TWITTER_BRAND',
'@
edxonline
')
)
share_text =
urllib.quote_plus(share_settings.get('DASHBOARD_TWITTER_TEXT',
default_share_text
.
encode
('
utf-8
')))
twitter_url =
'https://twitter.com/intent/tweet?text='
+
share_text
+
'%
20
'
+
urllib
.
quote_plus
(
twitter_share_url
)
share_msg =
_("Share
{
course_name
}
on
Twitter
").
format
(
course_name=
course_overview.display_name_with_default)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment