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
b4caf75c
Commit
b4caf75c
authored
Mar 03, 2014
by
Greg Price
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make forum comment buttons activate by keyboard
Neither edit nor delete activated on pressing the space key.
parent
93607603
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
11 deletions
+24
-11
common/static/coffee/spec/discussion/view/response_comment_show_view_spec.coffee
+15
-8
common/static/coffee/src/discussion/views/response_comment_show_view.coffee
+9
-3
No files found.
common/static/coffee/spec/discussion/view/response_comment_show_view_spec.coffee
View file @
b4caf75c
...
...
@@ -63,23 +63,30 @@ describe 'ResponseCommentShowView', ->
@
comment
.
unflagAbuse
()
expect
(
@
comment
.
get
'abuse_flaggers'
).
toEqual
[]
describe
'
comment deletion
'
,
->
describe
'
_delete
'
,
->
it
'triggers
the delete event when the delete icon is clicked
'
,
->
it
'triggers
on the correct events
'
,
->
DiscussionUtil
.
loadRoles
[]
@
comment
.
updateInfo
{
ability
:
{
'can_delete'
:
true
}}
@
view
.
render
()
DiscussionViewSpecHelper
.
checkButtonEvents
(
@
view
,
"_delete"
,
".action-delete"
)
it
'triggers the delete event'
,
->
triggerTarget
=
jasmine
.
createSpy
()
@
view
.
bind
"comment:_delete"
,
triggerTarget
@
view
.
render
()
@
view
.
$el
.
find
(
'.action-delete'
).
click
()
@
view
.
_delete
()
expect
(
triggerTarget
).
toHaveBeenCalled
()
describe
'
comment
edit'
,
->
describe
'edit'
,
->
it
'triggers
comment:edit when the edit button is clicked
'
,
->
it
'triggers
on the correct events
'
,
->
DiscussionUtil
.
loadRoles
[]
@
comment
.
updateInfo
{
ability
:
{
'can_edit'
:
true
}}
@
view
.
render
()
DiscussionViewSpecHelper
.
checkButtonEvents
(
@
view
,
"edit"
,
".action-edit"
)
it
'triggers comment:edit when the edit button is clicked'
,
->
triggerTarget
=
jasmine
.
createSpy
()
@
view
.
bind
"comment:edit"
,
triggerTarget
@
view
.
render
()
@
view
.
$el
.
find
(
".action-edit"
).
click
()
@
view
.
edit
()
expect
(
triggerTarget
).
toHaveBeenCalled
()
common/static/coffee/src/discussion/views/response_comment_show_view.coffee
View file @
b4caf75c
...
...
@@ -2,8 +2,14 @@ if Backbone?
class
@
ResponseCommentShowView
extends
DiscussionContentView
events
:
"click .action-delete"
:
"_delete"
"click .action-edit"
:
"edit"
"click .action-delete"
:
(
event
)
->
@
_delete
(
event
)
"keydown .action-delete"
:
(
event
)
->
DiscussionUtil
.
activateOnSpace
(
event
,
@
_delete
)
"click .action-edit"
:
(
event
)
->
@
edit
(
event
)
"keydown .action-edit"
:
(
event
)
->
DiscussionUtil
.
activateOnSpace
(
event
,
@
edit
)
tagName
:
"li"
...
...
@@ -52,7 +58,7 @@ if Backbone?
else
if
DiscussionUtil
.
isTA
(
@
model
.
get
(
"user_id"
))
@
$el
.
find
(
"a.profile-link"
).
after
(
'<span class="community-ta-label">'
+
gettext
(
'Community TA'
)
+
'</span>'
)
_delete
:
(
event
)
-
>
_delete
:
(
event
)
=
>
@
trigger
"comment:_delete"
,
event
renderFlagged
:
=>
...
...
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