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
a04af07d
Commit
a04af07d
authored
Aug 09, 2017
by
Harry Rein
Committed by
GitHub
Aug 09, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15774 from edx/HarryRein/LEARNER-2027-resume-course-eventing
Eventing on Resume Course click on home page
parents
8415d766
8f6aa79c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
4 deletions
+31
-4
openedx/features/course_experience/static/course_experience/fixtures/course-home-fragment.html
+2
-2
openedx/features/course_experience/static/course_experience/js/CourseHome.js
+13
-0
openedx/features/course_experience/static/course_experience/js/spec/CourseHome_spec.js
+13
-0
openedx/features/course_experience/templates/course_experience/course-home-fragment.html
+3
-2
No files found.
openedx/features/course_experience/static/course_experience/fixtures/course-home-fragment.html
View file @
a04af07d
...
...
@@ -20,8 +20,8 @@
</form>
</div>
<div
class=
"form-actions"
>
<a
class=
"btn btn-brand action-resume-course"
href=
"
${resume_course_url}
"
>
Start Course
<a
class=
"btn btn-brand action-resume-course"
href=
"
/courses/course-v1:edX+DemoX+Demo_Course/courseware/19a30717eff543078a5d94ae9d6c18a5/
"
>
<span
data-action-type=
"start"
>
Start Course
</span>
</a>
</div>
</div>
...
...
openedx/features/course_experience/static/course_experience/js/CourseHome.js
View file @
a04af07d
...
...
@@ -2,6 +2,19 @@
export
class
CourseHome
{
// eslint-disable-line import/prefer-default-export
constructor
(
options
)
{
// Logging for 'Resume Course' or 'Start Course' button click
const
$resumeCourseLink
=
$
(
options
.
resumeCourseLink
);
$resumeCourseLink
.
on
(
'click'
,
(
event
)
=>
{
const
eventType
=
$resumeCourseLink
.
find
(
'span'
).
data
(
'action-type'
);
Logger
.
log
(
'edx.course.home.resume_course.clicked'
,
{
event_type
:
eventType
,
url
:
event
.
currentTarget
.
href
,
},
);
});
// Logging for course tool click events
const
$courseToolLink
=
$
(
options
.
courseToolLink
);
$courseToolLink
.
on
(
'click'
,
(
event
)
=>
{
...
...
openedx/features/course_experience/static/course_experience/js/spec/CourseHome_spec.js
View file @
a04af07d
...
...
@@ -9,11 +9,24 @@ describe('Course Home factory', () => {
beforeEach
(()
=>
{
loadFixtures
(
'course_experience/fixtures/course-home-fragment.html'
);
home
=
new
CourseHome
({
resumeCourseLink
:
'.action-resume-course'
,
courseToolLink
:
'.course-tool-link'
,
});
spyOn
(
Logger
,
'log'
);
});
it
(
'sends an event when resume or start course is clicked'
,
()
=>
{
$
(
'.action-resume-course'
).
click
();
expect
(
Logger
.
log
).
toHaveBeenCalledWith
(
'edx.course.home.resume_course.clicked'
,
{
event_type
:
'start'
,
url
:
`http://
${
window
.
location
.
host
}
/courses/course-v1:edX+DemoX+Demo_Course/courseware`
+
'/19a30717eff543078a5d94ae9d6c18a5/'
,
},
);
});
it
(
'sends an event when an course tool is clicked'
,
()
=>
{
const
courseToolNames
=
document
.
querySelectorAll
(
'.course-tool-link'
);
for
(
let
i
=
0
;
i
<
courseToolNames
.
length
;
i
+=
1
)
{
...
...
openedx/features/course_experience/templates/course_experience/course-home-fragment.html
View file @
a04af07d
...
...
@@ -45,9 +45,9 @@ from openedx.features.course_experience import UNIFIED_COURSE_TAB_FLAG, SHOW_REV
% if resume_course_url:
<a
class=
"btn btn-brand action-resume-course"
href=
"${resume_course_url}"
>
% if has_visited_course:
${_("Resume Course")}
<span
data-action-type=
"resume"
>
${_("Resume Course")}
</span>
% else:
${_("Start Course")}
<span
data-action-type=
"start"
>
${_("Start Course")}
</span>
% endif
</a>
% endif
...
...
@@ -109,6 +109,7 @@ from openedx.features.course_experience import UNIFIED_COURSE_TAB_FLAG, SHOW_REV
<
%
static:webpack
entry=
"CourseHome"
>
new CourseHome({
resumeCourseLink: ".action-resume-course",
courseToolLink: ".course-tool-link",
});
</
%
static:webpack>
...
...
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