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
6595dfc2
Commit
6595dfc2
authored
Jan 27, 2016
by
Cliff Dyer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11360 from edx/cdyer/track-push
Track push notification activity in analytics
parents
08a2bc96
90493ac3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
9 deletions
+27
-9
cms/static/coffee/spec/main.coffee
+5
-2
cms/static/coffee/spec/views/course_info_spec.coffee
+11
-1
cms/static/js/views/course_info_update.js
+11
-6
No files found.
cms/static/coffee/spec/main.coffee
View file @
6595dfc2
...
@@ -221,8 +221,11 @@ define([
...
@@ -221,8 +221,11 @@ define([
"coffee/spec/models/settings_grading_spec"
,
"coffee/spec/models/textbook_spec"
,
"coffee/spec/models/settings_grading_spec"
,
"coffee/spec/models/textbook_spec"
,
"coffee/spec/models/upload_spec"
,
"coffee/spec/models/upload_spec"
,
"coffee/spec/views/metadata_edit_spec"
,
"coffee/spec/views/module_edit_spec"
,
"coffee/spec/views/course_info_spec"
,
"coffee/spec/views/textbook_spec"
,
"coffee/spec/views/upload_spec"
,
"coffee/spec/views/metadata_edit_spec"
,
"coffee/spec/views/module_edit_spec"
,
"coffee/spec/views/textbook_spec"
,
"coffee/spec/views/upload_spec"
,
"js/spec/video/transcripts/utils_spec"
,
"js/spec/video/transcripts/editor_spec"
,
"js/spec/video/transcripts/utils_spec"
,
"js/spec/video/transcripts/editor_spec"
,
"js/spec/video/transcripts/videolist_spec"
,
"js/spec/video/transcripts/message_manager_spec"
,
"js/spec/video/transcripts/videolist_spec"
,
"js/spec/video/transcripts/message_manager_spec"
,
...
...
cms/static/coffee/spec/views/course_info_spec.coffee
View file @
6595dfc2
...
@@ -123,6 +123,9 @@ define ["js/views/course_info_handout", "js/views/course_info_update", "js/model
...
@@ -123,6 +123,9 @@ define ["js/views/course_info_handout", "js/views/course_info_update", "js/model
# Verify the link is not rewritten when saved.
# Verify the link is not rewritten when saved.
expect
(
requestSent
.
content
).
toEqual
(
'/static/image.jpg'
)
expect
(
requestSent
.
content
).
toEqual
(
'/static/image.jpg'
)
# Verify that analytics are sent
expect
(
window
.
analytics
.
track
).
toHaveBeenCalled
()
it
"does rewrite links for preview"
,
->
it
"does rewrite links for preview"
,
->
# Create a new update.
# Create a new update.
@
createNewUpdate
(
'/static/image.jpg'
)
@
createNewUpdate
(
'/static/image.jpg'
)
...
@@ -177,15 +180,22 @@ define ["js/views/course_info_handout", "js/views/course_info_update", "js/model
...
@@ -177,15 +180,22 @@ define ["js/views/course_info_handout", "js/views/course_info_update", "js/model
requestSent
=
JSON
.
parse
(
requests
[
requests
.
length
-
1
].
requestBody
)
requestSent
=
JSON
.
parse
(
requests
[
requests
.
length
-
1
].
requestBody
)
expect
(
requestSent
.
push_notification_selected
).
toEqual
(
true
)
expect
(
requestSent
.
push_notification_selected
).
toEqual
(
true
)
# Check that analytics send push_notification info
analytics_payload
=
window
.
analytics
.
track
.
calls
[
0
].
args
[
1
]
expect
(
analytics_payload
).
toEqual
(
jasmine
.
objectContaining
({
'push_notification_selected'
:
true
}))
it
"sends correct value for push_notification_selected when it is unselected"
,
->
it
"sends correct value for push_notification_selected when it is unselected"
,
->
requests
=
AjaxHelpers
.
requests
(
this
);
requests
=
AjaxHelpers
.
requests
(
this
);
# unselect push notification
# unselect push notification
@
courseInfoEdit
.
$el
.
find
(
'.toggle-checkbox'
).
attr
(
'checked'
,
false
);
@
courseInfoEdit
.
$el
.
find
(
'.toggle-checkbox'
).
attr
(
'checked'
,
false
);
@
courseInfoEdit
.
$el
.
find
(
'.save-button'
).
click
()
@
courseInfoEdit
.
$el
.
find
(
'.save-button'
).
click
()
requestSent
=
JSON
.
parse
(
requests
[
requests
.
length
-
1
].
requestBody
)
requestSent
=
JSON
.
parse
(
requests
[
requests
.
length
-
1
].
requestBody
)
expect
(
requestSent
.
push_notification_selected
).
toEqual
(
false
)
expect
(
requestSent
.
push_notification_selected
).
toEqual
(
false
)
# Check that analytics send push_notification info
analytics_payload
=
window
.
analytics
.
track
.
calls
[
0
].
args
[
1
]
expect
(
analytics_payload
).
toEqual
(
jasmine
.
objectContaining
({
'push_notification_selected'
:
false
}))
describe
"Course Handouts"
,
->
describe
"Course Handouts"
,
->
handoutsTemplate
=
readFixtures
(
'course_info_handouts.underscore'
)
handoutsTemplate
=
readFixtures
(
'course_info_handouts.underscore'
)
...
...
cms/static/js/views/course_info_update.js
View file @
6595dfc2
...
@@ -105,7 +105,8 @@ define(["js/views/baseview", "codemirror", "js/models/course_update",
...
@@ -105,7 +105,8 @@ define(["js/views/baseview", "codemirror", "js/models/course_update",
analytics
.
track
(
'Saved Course Update'
,
{
analytics
.
track
(
'Saved Course Update'
,
{
'course'
:
course_location_analytics
,
'course'
:
course_location_analytics
,
'date'
:
this
.
dateEntry
(
event
).
val
()
'date'
:
this
.
dateEntry
(
event
).
val
(),
'push_notification_selected'
:
this
.
push_notification_selected
(
event
)
});
});
},
},
...
@@ -134,7 +135,7 @@ define(["js/views/baseview", "codemirror", "js/models/course_update",
...
@@ -134,7 +135,7 @@ define(["js/views/baseview", "codemirror", "js/models/course_update",
// Variable stored for unit test.
// Variable stored for unit test.
this
.
$modalCover
=
ModalUtils
.
showModalCover
(
false
,
this
.
$modalCover
=
ModalUtils
.
showModalCover
(
false
,
function
()
{
function
()
{
self
.
closeEditor
(
false
)
self
.
closeEditor
(
false
)
;
}
}
);
);
},
},
...
@@ -211,9 +212,10 @@ define(["js/views/baseview", "codemirror", "js/models/course_update",
...
@@ -211,9 +212,10 @@ define(["js/views/baseview", "codemirror", "js/models/course_update",
// hide the push notification checkbox for subsequent edits to the Post
// hide the push notification checkbox for subsequent edits to the Post
var
push_notification_ele
=
this
.
$currentPost
.
find
(
".new-update-push-notification"
);
var
push_notification_ele
=
this
.
$currentPost
.
find
(
".new-update-push-notification"
);
if
(
push_notification_ele
)
if
(
push_notification_ele
)
{
push_notification_ele
.
hide
();
push_notification_ele
.
hide
();
}
}
}
ModalUtils
.
hideModalCover
(
this
.
$modalCover
);
ModalUtils
.
hideModalCover
(
this
.
$modalCover
);
this
.
$codeMirror
=
null
;
this
.
$codeMirror
=
null
;
...
@@ -231,12 +233,16 @@ define(["js/views/baseview", "codemirror", "js/models/course_update",
...
@@ -231,12 +233,16 @@ define(["js/views/baseview", "codemirror", "js/models/course_update",
editor
:
function
(
event
)
{
editor
:
function
(
event
)
{
var
li
=
$
(
event
.
currentTarget
).
closest
(
"li"
);
var
li
=
$
(
event
.
currentTarget
).
closest
(
"li"
);
if
(
li
)
return
$
(
li
).
find
(
"form"
).
first
();
if
(
li
)
{
return
$
(
li
).
find
(
"form"
).
first
();
}
},
},
dateEntry
:
function
(
event
)
{
dateEntry
:
function
(
event
)
{
var
li
=
$
(
event
.
currentTarget
).
closest
(
"li"
);
var
li
=
$
(
event
.
currentTarget
).
closest
(
"li"
);
if
(
li
)
return
$
(
li
).
find
(
".date"
).
first
();
if
(
li
)
{
return
$
(
li
).
find
(
".date"
).
first
();
}
},
},
push_notification_selected
:
function
(
event
)
{
push_notification_selected
:
function
(
event
)
{
...
@@ -249,7 +255,6 @@ define(["js/views/baseview", "codemirror", "js/models/course_update",
...
@@ -249,7 +255,6 @@ define(["js/views/baseview", "codemirror", "js/models/course_update",
}
}
}
}
}
}
});
});
return
CourseInfoUpdateView
;
return
CourseInfoUpdateView
;
...
...
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