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
641c5ae5
Commit
641c5ae5
authored
Aug 21, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make delete work
parent
95e0d3be
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
18 deletions
+11
-18
lms/static/coffee/src/backbone_discussion/content.coffee
+11
-18
No files found.
lms/static/coffee/src/backbone_discussion/content.coffee
View file @
641c5ae5
...
...
@@ -261,27 +261,18 @@ class @ContentView extends Backbone.View
@
$
(
".discussion-content-edit"
).
hide
()
@
$
(
".discussion-content-wrapper"
).
show
()
delete
:
->
if
$content
.
hasClass
(
"thread"
)
url
=
Discussion
.
urlFor
(
'delete_thread'
,
id
)
c
=
confirm
"Are you sure to delete thread
\"
"
+
$content
.
find
(
"a.thread-title"
).
text
()
+
"
\"
?"
delete
:
(
event
)
->
url
=
@
model
.
urlFor
(
'delete'
)
if
@
model
.
get
(
'type'
)
==
'thread'
c
=
confirm
"Are you sure to delete thread
\"
#{
@
model
.
get
(
'title'
)
}
\"
?"
else
url
=
Discussion
.
urlFor
(
'delete_comment'
,
id
)
c
=
confirm
"Are you sure to delete this comment? "
if
c
!=
true
if
not
c
return
Discussion
.
safeAjax
$elem
:
$
(
elem
)
url
:
url
type
:
"POST"
dataType
:
"json"
data
:
{}
success
:
(
response
,
textStatus
)
=>
if
textStatus
==
"success"
$
(
content
).
remove
()
error
:
(
response
,
textStatus
,
e
)
->
console
.
log
e
$elem
=
$
(
event
.
target
)
DiscussionUtil
.
post
$elem
,
url
,
{},
(
response
,
textStatus
)
=>
@
$el
.
remove
()
#TODO also do data-wise operation
events
:
"click .thread-title"
:
"toggleSingleThread"
"click .discussion-show-comments"
:
"toggleSingleThread"
...
...
@@ -336,6 +327,7 @@ class @Thread extends @Content
'downvote'
:
->
DiscussionUtil
.
urlFor
(
"downvote_
#{
@
get
(
'type'
)
}
"
,
@
id
)
'close'
:
->
DiscussionUtil
.
urlFor
(
'openclose_thread'
,
@
id
)
'update'
:
->
DiscussionUtil
.
urlFor
(
'update_thread'
,
@
id
)
'delete'
:
->
DiscussionUtil
.
urlFor
(
'delete_thread'
,
@
id
)
initialize
:
->
@
set
(
'thread'
,
@
)
...
...
@@ -355,6 +347,7 @@ class @Comment extends @Content
'downvote'
:
->
DiscussionUtil
.
urlFor
(
"downvote_
#{
@
get
(
'type'
)
}
"
,
@
id
)
'endorse'
:
->
DiscussionUtil
.
urlFor
(
'endorse_comment'
,
@
id
)
'update'
:
->
DiscussionUtil
.
urlFor
(
'update_comment'
,
@
id
)
'delete'
:
->
DiscussionUtil
.
urlFor
(
'delete_comment'
,
@
id
)
permalink
:
->
thread_id
=
@
get
(
'thread'
).
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