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
32a45e19
Commit
32a45e19
authored
Sep 16, 2014
by
Jim Abramson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5227 from edx/jsa/tnl153
allow TAs to select the cohort of new posts.
parents
7593ad3a
eef28a4f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
10 deletions
+20
-10
common/static/coffee/spec/discussion/discussion_spec_helper.coffee
+4
-1
common/static/coffee/spec/discussion/view/new_post_view_spec.coffee
+15
-8
common/static/coffee/src/discussion/views/new_post_view.coffee
+1
-1
No files found.
common/static/coffee/spec/discussion/discussion_spec_helper.coffee
View file @
32a45e19
...
@@ -6,8 +6,11 @@ class @DiscussionSpecHelper
...
@@ -6,8 +6,11 @@ class @DiscussionSpecHelper
window
.
user
=
new
DiscussionUser
({
username
:
"test_user"
,
id
:
"567"
,
upvoted_ids
:
[]})
window
.
user
=
new
DiscussionUser
({
username
:
"test_user"
,
id
:
"567"
,
upvoted_ids
:
[]})
DiscussionUtil
.
setUser
(
window
.
user
)
DiscussionUtil
.
setUser
(
window
.
user
)
@
makeTA
=
()
->
DiscussionUtil
.
roleIds
[
"Community TA"
].
push
(
parseInt
(
DiscussionUtil
.
getUser
().
id
))
@
makeModerator
=
()
->
@
makeModerator
=
()
->
DiscussionUtil
.
roleIds
[
"Moderator"
].
push
(
parseInt
(
window
.
user
.
id
))
DiscussionUtil
.
roleIds
[
"Moderator"
].
push
(
parseInt
(
DiscussionUtil
.
getUser
()
.
id
))
@
makeAjaxSpy
=
(
fakeAjax
)
->
@
makeAjaxSpy
=
(
fakeAjax
)
->
spyOn
(
$
,
"ajax"
).
andCallFake
(
spyOn
(
$
,
"ajax"
).
andCallFake
(
...
...
common/static/coffee/spec/discussion/view/new_post_view_spec.coffee
View file @
32a45e19
...
@@ -141,19 +141,26 @@ describe "NewPostView", ->
...
@@ -141,19 +141,26 @@ describe "NewPostView", ->
mode
:
"tab"
mode
:
"tab"
)
)
expectCohortSelectorVisible
=
(
view
,
visible
)
->
checkVisibility
=
(
view
,
expectedVisible
)
=>
expect
(
view
.
$
(
".js-group-select"
).
is
(
":visible"
)).
toEqual
(
visible
)
view
.
render
()
expect
(
view
.
$
(
".js-group-select"
).
is
(
":visible"
)).
toEqual
(
expectedVisible
)
if
expectedVisible
expect
(
view
.
$
(
".js-group-select"
).
prop
(
"disabled"
)).
toEqual
(
false
)
it
"is not visible to students"
,
->
it
"is not visible to students"
,
->
@
view
.
render
()
checkVisibility
(
@
view
,
false
)
expectCohortSelectorVisible
(
@
view
,
false
)
it
"allows TAs to see the cohort selector"
,
->
DiscussionSpecHelper
.
makeTA
()
checkVisibility
(
@
view
,
true
)
it
"allows moderators to se
lect visibility
"
,
->
it
"allows moderators to se
e the cohort selector
"
,
->
DiscussionSpecHelper
.
makeModerator
()
DiscussionSpecHelper
.
makeModerator
()
@
view
.
render
()
checkVisibility
(
@
view
,
true
)
expectCohortSelectorVisible
(
@
view
,
true
)
expect
(
@
view
.
$
(
".js-group-select"
).
prop
(
"disabled"
)).
toEqual
(
false
)
it
"allows the user to make a cohort selection"
,
->
DiscussionSpecHelper
.
makeModerator
()
@
view
.
render
()
expectedGroupId
=
null
expectedGroupId
=
null
DiscussionSpecHelper
.
makeAjaxSpy
(
DiscussionSpecHelper
.
makeAjaxSpy
(
(
params
)
->
expect
(
params
.
data
.
group_id
).
toEqual
(
expectedGroupId
)
(
params
)
->
expect
(
params
.
data
.
group_id
).
toEqual
(
expectedGroupId
)
...
...
common/static/coffee/src/discussion/views/new_post_view.coffee
View file @
32a45e19
...
@@ -41,7 +41,7 @@ if Backbone?
...
@@ -41,7 +41,7 @@ if Backbone?
html
html
getCohortOptions
:
()
->
getCohortOptions
:
()
->
if
@
course_settings
.
get
(
"is_cohorted"
)
and
DiscussionUtil
.
is
Staff
()
if
@
course_settings
.
get
(
"is_cohorted"
)
and
DiscussionUtil
.
is
PrivilegedUser
()
user_cohort_id
=
$
(
"#discussion-container"
).
data
(
"user-cohort-id"
)
user_cohort_id
=
$
(
"#discussion-container"
).
data
(
"user-cohort-id"
)
_
.
map
@
course_settings
.
get
(
"cohorts"
),
(
cohort
)
->
_
.
map
@
course_settings
.
get
(
"cohorts"
),
(
cohort
)
->
{
value
:
cohort
.
id
,
text
:
cohort
.
name
,
selected
:
cohort
.
id
==
user_cohort_id
}
{
value
:
cohort
.
id
,
text
:
cohort
.
name
,
selected
:
cohort
.
id
==
user_cohort_id
}
...
...
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