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
a9fe8e69
Commit
a9fe8e69
authored
Feb 05, 2015
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #381 from open-craft/eugeny/vote-count-and-search-messages-css-class
Discussion bug fixes and improvements
parents
bce50e88
d7ba0fc2
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
90 additions
and
8 deletions
+90
-8
common/static/coffee/spec/discussion/discussion_spec_helper.coffee
+1
-1
common/static/coffee/spec/discussion/view/discussion_thread_list_view_spec.coffee
+22
-0
common/static/coffee/src/discussion/views/discussion_content_view.coffee
+2
-0
common/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
+9
-5
common/static/coffee/src/discussion/views/discussion_thread_view.coffee
+1
-1
common/templates/discussion/_underscore_templates.html
+1
-1
common/test/acceptance/pages/lms/discussion.py
+4
-0
common/test/acceptance/tests/discussion/test_discussion.py
+50
-0
No files found.
common/static/coffee/spec/discussion/discussion_spec_helper.coffee
View file @
a9fe8e69
...
@@ -303,7 +303,7 @@ browser and pasting the output. When that file changes, this one should be rege
...
@@ -303,7 +303,7 @@ browser and pasting the output. When that file changes, this one should be rege
</script>
</script>
<script aria-hidden="true" type="text/template" id="search-alert-template">
<script aria-hidden="true" type="text/template" id="search-alert-template">
<div class="search-alert" id="search-alert-<%- cid %>">
<div class="search-alert
<%= css_class %>
" id="search-alert-<%- cid %>">
<div class="search-alert-content">
<div class="search-alert-content">
<p class="message"><%= message %></p>
<p class="message"><%= message %></p>
</div>
</div>
...
...
common/static/coffee/spec/discussion/view/discussion_thread_list_view_spec.coffee
View file @
a9fe8e69
...
@@ -274,6 +274,11 @@ describe "DiscussionThreadListView", ->
...
@@ -274,6 +274,11 @@ describe "DiscussionThreadListView", ->
$
(
@
).
html
()
$
(
@
).
html
()
).
get
()).
toEqual
(
expectedMessages
)
).
get
()).
toEqual
(
expectedMessages
)
getAlertMessagesAndClasses
=
()
->
$
(
".search-alert"
).
map
(
->
{
text
:
$
(
'.message'
,
@
).
html
(),
'css_class'
:
$
(
@
).
attr
(
'class'
)
}
).
get
()
it
"renders and removes search alerts"
,
->
it
"renders and removes search alerts"
,
->
testAlertMessages
[]
testAlertMessages
[]
foo
=
@
view
.
addSearchAlert
(
"foo"
)
foo
=
@
view
.
addSearchAlert
(
"foo"
)
...
@@ -285,6 +290,23 @@ describe "DiscussionThreadListView", ->
...
@@ -285,6 +290,23 @@ describe "DiscussionThreadListView", ->
@
view
.
removeSearchAlert
(
bar
.
cid
)
@
view
.
removeSearchAlert
(
bar
.
cid
)
testAlertMessages
[]
testAlertMessages
[]
it
"renders search alert with custom class"
,
->
testAlertMessages
[]
foo
=
@
view
.
addSearchAlert
(
"foo"
,
"custom-class"
)
messages
=
getAlertMessagesAndClasses
()
expect
(
messages
.
length
).
toEqual
(
1
);
expect
(
messages
[
0
].
text
).
toEqual
(
"foo"
)
expect
(
messages
[
0
].
css_class
).
toEqual
(
"search-alert custom-class"
)
foo
=
@
view
.
addSearchAlert
(
"bar"
,
"other-class"
)
messages
=
getAlertMessagesAndClasses
()
expect
(
messages
.
length
).
toEqual
(
2
);
expect
(
messages
[
0
].
text
).
toEqual
(
"foo"
)
expect
(
messages
[
0
].
css_class
).
toEqual
(
"search-alert custom-class"
)
expect
(
messages
[
1
].
text
).
toEqual
(
"bar"
)
expect
(
messages
[
1
].
css_class
).
toEqual
(
"search-alert other-class"
)
it
"clears all search alerts"
,
->
it
"clears all search alerts"
,
->
@
view
.
addSearchAlert
(
"foo"
)
@
view
.
addSearchAlert
(
"foo"
)
@
view
.
addSearchAlert
(
"bar"
)
@
view
.
addSearchAlert
(
"bar"
)
...
...
common/static/coffee/src/discussion/views/discussion_content_view.coffee
View file @
a9fe8e69
...
@@ -138,6 +138,8 @@ if Backbone?
...
@@ -138,6 +138,8 @@ if Backbone?
closed
:
(
closed
)
->
closed
:
(
closed
)
->
@
updateButtonState
(
".action-close"
,
closed
)
@
updateButtonState
(
".action-close"
,
closed
)
@
$
(
".post-label-closed"
).
toggleClass
(
"is-hidden"
,
not
closed
)
@
$
(
".post-label-closed"
).
toggleClass
(
"is-hidden"
,
not
closed
)
@
$
(
".action-vote"
).
toggle
(
not
closed
)
@
$
(
".display-vote"
).
toggle
(
closed
)
})
})
toggleSecondaryActions
:
(
event
)
=>
toggleSecondaryActions
:
(
event
)
=>
...
...
common/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
View file @
a9fe8e69
...
@@ -42,8 +42,12 @@ if Backbone?
...
@@ -42,8 +42,12 @@ if Backbone?
@
searchAlertCollection
.
on
"add"
,
(
searchAlert
)
=>
@
searchAlertCollection
.
on
"add"
,
(
searchAlert
)
=>
content
=
_
.
template
(
content
=
_
.
template
(
$
(
"#search-alert-template"
).
html
(),
$
(
"#search-alert-template"
).
html
(),
{
'message'
:
searchAlert
.
attributes
.
message
,
'cid'
:
searchAlert
.
cid
}
{
)
'message'
:
searchAlert
.
attributes
.
message
,
'cid'
:
searchAlert
.
cid
,
'css_class'
:
searchAlert
.
attributes
.
css_class
}
)
@
$
(
".search-alerts"
).
append
(
content
)
@
$
(
".search-alerts"
).
append
(
content
)
@
$
(
"#search-alert-"
+
searchAlert
.
cid
+
" a.dismiss"
).
bind
"click"
,
searchAlert
,
(
event
)
=>
@
$
(
"#search-alert-"
+
searchAlert
.
cid
+
" a.dismiss"
).
bind
"click"
,
searchAlert
,
(
event
)
=>
@
removeSearchAlert
(
event
.
data
.
cid
)
@
removeSearchAlert
(
event
.
data
.
cid
)
...
@@ -54,8 +58,8 @@ if Backbone?
...
@@ -54,8 +58,8 @@ if Backbone?
@
searchAlertCollection
.
on
"reset"
,
=>
@
searchAlertCollection
.
on
"reset"
,
=>
@
$
(
".search-alerts"
).
empty
()
@
$
(
".search-alerts"
).
empty
()
addSearchAlert
:
(
message
)
=>
addSearchAlert
:
(
message
,
css_class
=
""
)
=>
m
=
new
Backbone
.
Model
({
"message"
:
message
})
m
=
new
Backbone
.
Model
({
"message"
:
message
,
"css_class"
:
css_class
})
@
searchAlertCollection
.
add
(
m
)
@
searchAlertCollection
.
add
(
m
)
m
m
...
@@ -496,7 +500,7 @@ if Backbone?
...
@@ -496,7 +500,7 @@ if Backbone?
},
},
true
true
)
)
@
addSearchAlert
(
message
)
@
addSearchAlert
(
message
,
'search-by-user'
)
clearSearch
:
->
clearSearch
:
->
@
$
(
".forum-nav-search-input"
).
val
(
""
)
@
$
(
".forum-nav-search-input"
).
val
(
""
)
...
...
common/static/coffee/src/discussion/views/discussion_thread_view.coffee
View file @
a9fe8e69
...
@@ -75,7 +75,6 @@ if Backbone?
...
@@ -75,7 +75,6 @@ if Backbone?
@
$
(
'.comment-form'
).
closest
(
'li'
).
toggle
(
not
closed
)
@
$
(
'.comment-form'
).
closest
(
'li'
).
toggle
(
not
closed
)
@
$
(
".action-vote"
).
toggle
(
not
closed
)
@
$
(
".action-vote"
).
toggle
(
not
closed
)
@
$
(
".display-vote"
).
toggle
(
closed
)
@
$
(
".display-vote"
).
toggle
(
closed
)
# @$(".display-vote").toggle(closed)
@
renderAddResponseButton
()
@
renderAddResponseButton
()
})
})
...
@@ -256,6 +255,7 @@ if Backbone?
...
@@ -256,6 +255,7 @@ if Backbone?
comment
=
new
Comment
(
body
:
body
,
created_at
:
(
new
Date
()).
toISOString
(),
username
:
window
.
user
.
get
(
"username"
),
votes
:
{
up_count
:
0
},
abuse_flaggers
:
[],
endorsed
:
false
,
user_id
:
window
.
user
.
get
(
"id"
))
comment
=
new
Comment
(
body
:
body
,
created_at
:
(
new
Date
()).
toISOString
(),
username
:
window
.
user
.
get
(
"username"
),
votes
:
{
up_count
:
0
},
abuse_flaggers
:
[],
endorsed
:
false
,
user_id
:
window
.
user
.
get
(
"id"
))
comment
.
set
(
'thread'
,
@
model
.
get
(
'thread'
))
comment
.
set
(
'thread'
,
@
model
.
get
(
'thread'
))
@
renderResponseToList
(
comment
,
".js-response-list"
)
@
renderResponseToList
(
comment
,
".js-response-list"
)
@
renderAttrs
()
@
model
.
addComment
()
@
model
.
addComment
()
@
renderAddResponseButton
()
@
renderAddResponseButton
()
...
...
common/templates/discussion/_underscore_templates.html
View file @
a9fe8e69
...
@@ -371,7 +371,7 @@
...
@@ -371,7 +371,7 @@
</script>
</script>
<script
aria-hidden=
"true"
type=
"text/template"
id=
"search-alert-template"
>
<script
aria-hidden=
"true"
type=
"text/template"
id=
"search-alert-template"
>
<
div
class
=
"search-alert"
id
=
"search-alert-${'<%- cid %>'}"
>
<
div
class
=
"search-alert
${'<%= css_class %>'}
"
id
=
"search-alert-${'<%- cid %>'}"
>
<
div
class
=
"search-alert-content"
>
<
div
class
=
"search-alert-content"
>
<
p
class
=
"message"
>
$
{
'<%= message %>'
}
<
/p
>
<
p
class
=
"message"
>
$
{
'<%= message %>'
}
<
/p
>
<
/div
>
<
/div
>
...
...
common/test/acceptance/pages/lms/discussion.py
View file @
a9fe8e69
...
@@ -258,6 +258,10 @@ class DiscussionTabSingleThreadPage(CoursePage):
...
@@ -258,6 +258,10 @@ class DiscussionTabSingleThreadPage(CoursePage):
def
__getattr__
(
self
,
name
):
def
__getattr__
(
self
,
name
):
return
getattr
(
self
.
thread_page
,
name
)
return
getattr
(
self
.
thread_page
,
name
)
def
close_open_thread
(
self
):
with
self
.
thread_page
.
_secondary_action_menu_open
(
".forum-thread-main-wrapper"
):
self
.
_find_within
(
".forum-thread-main-wrapper .action-close"
)
.
first
.
click
()
class
InlineDiscussionPage
(
PageObject
):
class
InlineDiscussionPage
(
PageObject
):
url
=
None
url
=
None
...
...
common/test/acceptance/tests/discussion/test_discussion.py
View file @
a9fe8e69
...
@@ -153,6 +153,56 @@ class DiscussionTabSingleThreadTest(UniqueCourseTest, DiscussionResponsePaginati
...
@@ -153,6 +153,56 @@ class DiscussionTabSingleThreadTest(UniqueCourseTest, DiscussionResponsePaginati
@attr
(
'shard_1'
)
@attr
(
'shard_1'
)
class
DiscussionOpenClosedThreadTest
(
UniqueCourseTest
):
"""
Tests for checking the display of attributes on open and closed threads
"""
def
setUp
(
self
):
super
(
DiscussionOpenClosedThreadTest
,
self
)
.
setUp
()
# Create a course to register for
CourseFixture
(
**
self
.
course_info
)
.
install
()
self
.
thread_id
=
"test_thread_{}"
.
format
(
uuid4
()
.
hex
)
def
setup_user
(
self
,
roles
=
[]):
roles_str
=
','
.
join
(
roles
)
self
.
user_id
=
AutoAuthPage
(
self
.
browser
,
course_id
=
self
.
course_id
,
roles
=
roles_str
)
.
visit
()
.
get_user_id
()
def
setup_view
(
self
,
**
thread_kwargs
):
view
=
SingleThreadViewFixture
(
Thread
(
id
=
self
.
thread_id
,
**
thread_kwargs
)
)
view
.
addResponse
(
Response
(
id
=
"response1"
))
view
.
push
()
def
setup_openclosed_thread_page
(
self
,
closed
=
False
):
self
.
setup_user
(
roles
=
[
'Moderator'
])
if
closed
:
self
.
setup_view
(
closed
=
True
)
else
:
self
.
setup_view
()
page
=
DiscussionTabSingleThreadPage
(
self
.
browser
,
self
.
course_id
,
self
.
thread_id
)
page
.
visit
()
page
.
close_open_thread
()
return
page
def
test_originally_open_thread_vote_display
(
self
):
page
=
self
.
setup_openclosed_thread_page
()
self
.
assertFalse
(
page
.
_is_element_visible
(
'.forum-thread-main-wrapper .action-vote'
))
self
.
assertTrue
(
page
.
_is_element_visible
(
'.forum-thread-main-wrapper .display-vote'
))
self
.
assertFalse
(
page
.
_is_element_visible
(
'.response_response1 .action-vote'
))
self
.
assertTrue
(
page
.
_is_element_visible
(
'.response_response1 .display-vote'
))
def
test_originally_closed_thread_vote_display
(
self
):
page
=
self
.
setup_openclosed_thread_page
(
True
)
self
.
assertTrue
(
page
.
_is_element_visible
(
'.forum-thread-main-wrapper .action-vote'
))
self
.
assertFalse
(
page
.
_is_element_visible
(
'.forum-thread-main-wrapper .display-vote'
))
self
.
assertTrue
(
page
.
_is_element_visible
(
'.response_response1 .action-vote'
))
self
.
assertFalse
(
page
.
_is_element_visible
(
'.response_response1 .display-vote'
))
@attr
(
'shard_1'
)
class
DiscussionCommentDeletionTest
(
UniqueCourseTest
):
class
DiscussionCommentDeletionTest
(
UniqueCourseTest
):
"""
"""
Tests for deleting comments displayed beneath responses in the single thread view.
Tests for deleting comments displayed beneath responses in the single thread view.
...
...
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