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
bd57d56b
Commit
bd57d56b
authored
Dec 30, 2014
by
Jonathan Piacenti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add classes to group of elements for cohort selector.
Retriggring Jenkins build
parent
3d4a853e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
9 deletions
+35
-9
common/static/coffee/spec/discussion/discussion_spec_helper.coffee
+1
-1
common/static/coffee/spec/discussion/view/new_post_view_spec.coffee
+29
-7
common/static/coffee/src/discussion/views/new_post_view.coffee
+4
-0
lms/templates/discussion/_underscore_templates.html
+1
-1
No files found.
common/static/coffee/spec/discussion/discussion_spec_helper.coffee
View file @
bd57d56b
...
...
@@ -317,7 +317,7 @@ browser and pasting the output. When that file changes, this one should be rege
<ul class="post-errors" style="display: none"></ul>
<div class="forum-new-post-form-wrapper"></div>
<% if (cohort_options) { %>
<div class="post-field">
<div class="post-field
group-selector-wrapper<% if (!is_commentable_cohorted) { %> disabled<% } %>
">
<label class="field-label">
<span class="field-label-text">
Visible To:
...
...
common/static/coffee/spec/discussion/view/new_post_view_spec.coffee
View file @
bd57d56b
...
...
@@ -10,21 +10,29 @@ describe "NewPostView", ->
)
@
discussion
=
new
Discussion
([],
{
pages
:
1
})
checkVisibility
=
(
view
,
expectedVisible
,
expectedDisabled
)
=>
view
.
render
()
expect
(
view
.
$
(
".js-group-select"
).
is
(
":visible"
)).
toEqual
(
expectedVisible
)
disabled
=
view
.
$
(
".js-group-select"
).
prop
(
"disabled"
)
if
expectedVisible
and
!
expectedDisabled
checkVisibility
=
(
view
,
expectedVisible
,
expectedDisabled
,
noRender
)
=>
if
!
noRender
view
.
render
()
# Can also be undefined if the element does not exist.
expect
(
view
.
$
(
'.group-selector-wrapper'
).
is
(
":visible"
)
or
false
).
toEqual
(
expectedVisible
)
disabled
=
view
.
$
(
".js-group-select"
).
prop
(
"disabled"
)
or
false
group_disabled
=
view
.
$
(
'.group-selector-wrapper'
).
hasClass
(
'disabled'
)
if
expectedVisible
and
!
expectedDisabled
expect
(
disabled
).
toEqual
(
false
)
expect
(
group_disabled
).
toEqual
(
false
)
else
if
expectedDisabled
expect
(
disabled
).
toEqual
(
true
)
expect
(
group_disabled
).
toEqual
(
true
)
describe
"cohort selector"
,
->
beforeEach
->
@
course_settings
=
new
DiscussionCourseSettings
({
"category_map"
:
{
"children"
:
[
"Topic"
],
"entries"
:
{
"Topic"
:
{
"is_cohorted"
:
true
,
"id"
:
"topic"
}}
"children"
:
[
"Topic"
,
"General"
],
"entries"
:
{
"Topic"
:
{
"is_cohorted"
:
true
,
"id"
:
"topic"
},
"General"
:
{
"is_cohorted"
:
false
,
"id"
:
"general"
}
}
},
"allow_anonymous"
:
false
,
"allow_anonymous_to_peers"
:
false
,
...
...
@@ -38,6 +46,7 @@ describe "NewPostView", ->
el
:
$
(
"#fixture-element"
),
collection
:
@
discussion
,
course_settings
:
@
course_settings
,
is_commententable_cohorted
:
true
,
mode
:
"tab"
)
...
...
@@ -52,6 +61,19 @@ describe "NewPostView", ->
DiscussionSpecHelper
.
makeModerator
()
checkVisibility
(
@
view
,
true
)
it
"only enables the cohort selector when applicable"
,
->
DiscussionSpecHelper
.
makeModerator
()
# We start on the cohorted discussion
checkVisibility
(
@
view
,
true
)
# Select the uncohorted topic
$
(
'.topic-title:contains(General)'
).
click
()
# The menu should now be visible but disabled.
checkVisibility
(
@
view
,
true
,
true
,
true
)
# Select the cohorted topic again
$
(
'.topic-title:contains(Topic)'
).
click
()
# It should be visible and enabled once more.
checkVisibility
(
@
view
,
true
,
false
,
true
)
it
"allows the user to make a cohort selection"
,
->
DiscussionSpecHelper
.
makeModerator
()
@
view
.
render
()
...
...
common/static/coffee/src/discussion/views/new_post_view.coffee
View file @
bd57d56b
...
...
@@ -19,6 +19,8 @@ if Backbone?
})
@
$el
.
html
(
_
.
template
(
$
(
"#new-post-template"
).
html
(),
context
))
threadTypeTemplate
=
_
.
template
(
$
(
"#thread-type-template"
).
html
());
if
$
(
'.js-group-select'
).
is
(
':disabled'
)
$
(
'.group-selector-wrapper'
).
addClass
(
'disabled'
)
@
addField
(
threadTypeTemplate
({
form_id
:
_
.
uniqueId
(
"form-"
)}));
if
@
isTabMode
()
@
topicView
=
new
DiscussionTopicMenuView
{
...
...
@@ -52,8 +54,10 @@ if Backbone?
toggleGroupDropdown
:
(
$target
)
->
if
$target
.
data
(
'cohorted'
)
$
(
'.js-group-select'
).
prop
(
'disabled'
,
false
);
$
(
'.group-selector-wrapper'
).
removeClass
(
'disabled'
)
else
$
(
'.js-group-select'
).
val
(
''
).
prop
(
'disabled'
,
true
);
$
(
'.group-selector-wrapper'
).
addClass
(
'disabled'
)
postOptionChange
:
(
event
)
->
$target
=
$
(
event
.
target
)
...
...
lms/templates/discussion/_underscore_templates.html
View file @
bd57d56b
...
...
@@ -387,7 +387,7 @@
<
ul
class
=
"post-errors"
style
=
"display: none"
><
/ul
>
<
div
class
=
"forum-new-post-form-wrapper"
><
/div
>
$
{
'<% if (cohort_options) { %>'
}
<
div
class
=
"post-field
"
>
<
div
class
=
"post-field
group-selector-wrapper${'<% if (!is_commentable_cohorted) { %>'} disabled${'<% } %>'}"
>
<
label
class
=
"field-label"
>
<
span
class
=
"field-label-text"
>
##
Translators
:
This
labels
the
selector
for
which
group
of
students
can
view
a
post
...
...
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