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
c88a017d
Commit
c88a017d
authored
Dec 08, 2014
by
Waqas Khalid
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5244 from mlkwaqas/waqas/tnl152-stop-voting-on-closed-thread
Don't allow voting while the thread is closed
parents
6821fd40
1efa1b31
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
11 deletions
+40
-11
common/static/coffee/spec/discussion/discussion_spec_helper.coffee
+4
-1
common/static/coffee/spec/discussion/view/discussion_thread_view_spec.coffee
+20
-1
common/static/coffee/spec/discussion/view/discussion_view_spec_helper.coffee
+1
-1
common/static/coffee/src/discussion/views/discussion_content_view.coffee
+7
-7
common/static/coffee/src/discussion/views/discussion_thread_view.coffee
+4
-0
lms/templates/discussion/_underscore_templates.html
+4
-1
No files found.
common/static/coffee/spec/discussion/discussion_spec_helper.coffee
View file @
c88a017d
...
...
@@ -470,12 +470,15 @@ browser and pasting the output. When that file changes, this one should be rege
<script type="text/template" id="forum-action-vote">
<li class="actions-item">
<span aria-hidden="true" class="display-vote" style="display: none;">
<span class="vote-count"></span>
</span>
<a href="#" class="action-button action-vote" role="checkbox" aria-checked="false">
<span class="sr">Vote</span>
<span class="sr js-sr-vote-count"></span>
<span class="action-label" aria-hidden="true">
<span class="
js-visual-
vote-count"></span>
<span class="vote-count"></span>
</span>
<span class="action-icon" aria-hidden="true">
...
...
common/static/coffee/spec/discussion/view/discussion_thread_view_spec.coffee
View file @
c88a017d
...
...
@@ -43,7 +43,8 @@ describe "DiscussionThreadView", ->
expect
(
view
.
$el
.
find
(
".load-response-button"
).
length
).
toEqual
(
0
)
describe
"closed and open Threads"
,
->
checkCommentForm
=
(
originallyClosed
,
mode
)
->
createDiscussionThreadView
=
(
originallyClosed
,
mode
)
->
threadData
=
DiscussionViewSpecHelper
.
makeThreadWithProps
({
closed
:
originallyClosed
})
thread
=
new
Thread
(
threadData
)
discussion
=
new
Discussion
(
thread
)
...
...
@@ -60,18 +61,36 @@ describe "DiscussionThreadView", ->
(
model
,
updates
,
safeAjaxParams
,
errorMsg
)
->
model
.
set
(
updates
)
)
view
checkCommentForm
=
(
originallyClosed
,
mode
)
->
view
=
createDiscussionThreadView
(
originallyClosed
,
mode
)
expect
(
view
.
$
(
'.comment-form'
).
closest
(
'li'
).
is
(
":visible"
)).
toBe
(
not
originallyClosed
)
expect
(
view
.
$
(
".discussion-reply-new"
).
is
(
":visible"
)).
toBe
(
not
originallyClosed
)
view
.
$
(
".action-close"
).
click
()
expect
(
view
.
$
(
'.comment-form'
).
closest
(
'li'
).
is
(
":visible"
)).
toBe
(
originallyClosed
)
expect
(
view
.
$
(
".discussion-reply-new"
).
is
(
":visible"
)).
toBe
(
originallyClosed
)
checkVoteDisplay
=
(
originallyClosed
,
mode
)
->
view
=
createDiscussionThreadView
(
originallyClosed
,
mode
)
expect
(
view
.
$
(
'.action-vote'
).
is
(
":visible"
)).
toBe
(
not
originallyClosed
)
expect
(
view
.
$
(
'.display-vote'
).
is
(
":visible"
)).
toBe
(
originallyClosed
)
view
.
$
(
".action-close"
).
click
()
expect
(
view
.
$
(
'.action-vote'
).
is
(
":visible"
)).
toBe
(
originallyClosed
)
expect
(
view
.
$
(
'.display-vote'
).
is
(
":visible"
)).
toBe
(
not
originallyClosed
)
_
.
each
([
"tab"
,
"inline"
],
(
mode
)
=>
it
'Test that in #{mode} mode when a closed thread is opened the comment form is displayed'
,
->
checkCommentForm
(
true
,
mode
)
it
'Test that in #{mode} mode when a open thread is closed the comment form is hidden'
,
->
checkCommentForm
(
false
,
mode
)
it
'Test that in #{mode} mode when a closed thread is opened the vote button is displayed and vote count is hidden'
,
->
checkVoteDisplay
(
true
,
mode
)
it
'Test that in #{mode} mode when a open thread is closed the vote button is hidden and vote count is displayed'
,
->
checkVoteDisplay
(
false
,
mode
)
)
describe
"tab mode"
,
->
...
...
common/static/coffee/spec/discussion/view/discussion_view_spec_helper.coffee
View file @
c88a017d
...
...
@@ -21,7 +21,7 @@ class @DiscussionViewSpecHelper
button
=
view
.
$el
.
find
(
".action-vote"
)
expect
(
button
.
hasClass
(
"is-checked"
)).
toBe
(
user
.
voted
(
model
))
expect
(
button
.
attr
(
"aria-checked"
)).
toEqual
(
user
.
voted
(
model
).
toString
())
expect
(
button
.
find
(
".
js-visual-
vote-count"
).
text
()).
toMatch
(
"^
#{
model
.
get
(
'votes'
).
up_count
}
Votes?$"
)
expect
(
button
.
find
(
".vote-count"
).
text
()).
toMatch
(
"^
#{
model
.
get
(
'votes'
).
up_count
}
Votes?$"
)
expect
(
button
.
find
(
".sr.js-sr-vote-count"
).
text
()).
toMatch
(
"^currently
#{
model
.
get
(
'votes'
).
up_count
}
votes?$"
)
@
checkRenderVote
=
(
view
,
model
)
->
...
...
common/static/coffee/src/discussion/views/discussion_content_view.coffee
View file @
c88a017d
...
...
@@ -118,13 +118,13 @@ if Backbone?
true
)
)
button
.
find
(
".js-visual-vote-count"
).
html
(
interpolate
(
ngettext
(
"%(numVotes)s Vote"
,
"%(numVotes)s Votes"
,
numVotes
)
,
{
numVotes
:
numVotes
},
true
)
)
votesHtml
=
interpolate
(
ngettext
(
"%(numVotes)s Vote"
,
"%(numVotes)s Votes"
,
numVotes
),
{
numVotes
:
numVotes
}
,
true
)
button
.
find
(
".vote-count"
).
html
(
votesHtml
)
@
$el
.
find
(
'.display-vote .vote-count'
).
html
(
votesHtml
)
pinned
:
(
pinned
)
->
@
updateButtonState
(
".action-pin"
,
pinned
)
...
...
common/static/coffee/src/discussion/views/discussion_thread_view.coffee
View file @
c88a017d
...
...
@@ -77,6 +77,9 @@ if Backbone?
closed
:
(
closed
)
->
@
$
(
".discussion-reply-new"
).
toggle
(
not
closed
)
@
$
(
'.comment-form'
).
closest
(
'li'
).
toggle
(
not
closed
)
@
$
(
".action-vote"
).
toggle
(
not
closed
)
@
$
(
".display-vote"
).
toggle
(
closed
)
# @$(".display-vote").toggle(closed)
@
renderAddResponseButton
()
})
...
...
@@ -309,6 +312,7 @@ if Backbone?
closeEditView
:
(
event
)
=>
@
createShowView
()
@
renderShowView
()
@
renderAttrs
()
# next call is necessary to re-render the post action controls after
# submitting or cancelling a thread edit in inline mode.
@
$el
.
find
(
".post-extended-content"
).
show
()
...
...
lms/templates/discussion/_underscore_templates.html
View file @
c88a017d
...
...
@@ -518,13 +518,16 @@ ${primaryAction("follow", "star", _("Follow"), _("Follow"), _("Unfollow"))}
<script
type=
"text/template"
id=
"forum-action-vote"
>
<
li
class
=
"actions-item"
>
<
span
aria
-
hidden
=
"true"
class
=
"display-vote"
>
<
span
class
=
"vote-count"
><
/span
>
<
/span
>
<
a
href
=
"#"
class
=
"action-button action-vote"
role
=
"checkbox"
aria
-
checked
=
"false"
>
##
Vote
counts
are
populated
by
JS
<
span
class
=
"sr"
>
$
{
_
(
"Vote"
)}
<
/span
>
<
span
class
=
"sr js-sr-vote-count"
><
/span
>
<
span
class
=
"action-label"
aria
-
hidden
=
"true"
>
<
span
class
=
"
js-visual-
vote-count"
><
/span
>
<
span
class
=
"vote-count"
><
/span
>
<
/span
>
<
span
class
=
"action-icon"
aria
-
hidden
=
"true"
>
...
...
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