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
654075e0
Commit
654075e0
authored
Aug 21, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
migrated follow thread
parent
11e3276e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
14 deletions
+31
-14
lms/static/coffee/src/backbone_discussion/content.coffee
+27
-11
lms/static/coffee/src/backbone_discussion/discussion.coffee
+1
-2
lms/templates/discussion/mustache/_content.mustache
+3
-1
No files found.
lms/static/coffee/src/backbone_discussion/content.coffee
View file @
654075e0
...
@@ -80,7 +80,11 @@ class @ContentView extends Backbone.View
...
@@ -80,7 +80,11 @@ class @ContentView extends Backbone.View
comments_count
:
(
comments_count
)
->
comments_count
:
(
comments_count
)
->
@
$
(
".comments-count"
).
html
(
comments_count
)
@
$
(
".comments-count"
).
html
(
comments_count
)
subscribed
:
(
subscribed
)
->
#later
subscribed
:
(
subscribed
)
->
if
subscribed
@
$
(
".discussion-follow-thread"
).
addClass
(
"discussion-unfollow-thread"
).
html
(
"Unfollow"
)
else
@
$
(
".discussion-follow-thread"
).
removeClass
(
"discussion-unfollow-thread"
).
html
(
"Follow"
)
ability
:
(
ability
)
->
ability
:
(
ability
)
->
for
action
,
elemSelector
of
@
model
.
actions
for
action
,
elemSelector
of
@
model
.
actions
...
@@ -114,7 +118,7 @@ class @ContentView extends Backbone.View
...
@@ -114,7 +118,7 @@ class @ContentView extends Backbone.View
@
updateShowComments
()
@
updateShowComments
()
else
else
$elem
=
$
.
merge
@
$
(
".thread-title"
),
@
$showComments
()
$elem
=
$
.
merge
@
$
(
".thread-title"
),
@
$showComments
()
url
=
@
model
.
urlFor
(
'retrieve
_single_thread
'
)
url
=
@
model
.
urlFor
(
'retrieve'
)
DiscussionUtil
.
get
$elem
,
url
,
(
response
,
textStatus
)
=>
DiscussionUtil
.
get
$elem
,
url
,
(
response
,
textStatus
)
=>
@
showed
=
true
@
showed
=
true
@
updateShowComments
()
@
updateShowComments
()
...
@@ -219,6 +223,16 @@ class @ContentView extends Backbone.View
...
@@ -219,6 +223,16 @@ class @ContentView extends Backbone.View
DiscussionUtil
.
post
$elem
,
url
,
data
,
(
response
,
textStatus
)
=>
DiscussionUtil
.
post
$elem
,
url
,
data
,
(
response
,
textStatus
)
=>
@
model
.
set
(
'endorsed'
,
not
endorsed
)
@
model
.
set
(
'endorsed'
,
not
endorsed
)
toggleFollow
:
(
event
)
->
$elem
=
$
(
event
.
target
)
subscribed
=
@
model
.
get
(
'subscribed'
)
if
subscribed
url
=
@
model
.
urlFor
(
'unfollow'
)
else
url
=
@
model
.
urlFor
(
'follow'
)
DiscussionUtil
.
post
$elem
,
url
,
{},
(
response
,
textStatus
)
=>
@
model
.
set
(
'subscribed'
,
not
subscribed
)
toggleClosed
:
(
event
)
->
toggleClosed
:
(
event
)
->
$elem
=
$
(
event
.
target
)
$elem
=
$
(
event
.
target
)
url
=
@
model
.
urlFor
(
'close'
)
url
=
@
model
.
urlFor
(
'close'
)
...
@@ -288,6 +302,7 @@ class @ContentView extends Backbone.View
...
@@ -288,6 +302,7 @@ class @ContentView extends Backbone.View
@
model
.
get
(
'thread'
).
removeComment
(
@
model
)
@
model
.
get
(
'thread'
).
removeComment
(
@
model
)
events
:
events
:
"click .discussion-follow-thread"
:
"toggleFollow"
"click .thread-title"
:
"toggleSingleThread"
"click .thread-title"
:
"toggleSingleThread"
"click .discussion-show-comments"
:
"toggleSingleThread"
"click .discussion-show-comments"
:
"toggleSingleThread"
"click .discussion-reply-thread"
:
"reply"
"click .discussion-reply-thread"
:
"reply"
...
@@ -334,14 +349,16 @@ class @ContentView extends Backbone.View
...
@@ -334,14 +349,16 @@ class @ContentView extends Backbone.View
class
@
Thread
extends
@
Content
class
@
Thread
extends
@
Content
urlMappers
:
urlMappers
:
'retrieve_single_thread'
:
->
DiscussionUtil
.
urlFor
(
'retrieve_single_thread'
,
@
discussion
.
id
,
@
id
)
'retrieve'
:
->
DiscussionUtil
.
urlFor
(
'retrieve_single_thread'
,
@
discussion
.
id
,
@
id
)
'reply'
:
->
DiscussionUtil
.
urlFor
(
'create_comment'
,
@
id
)
'reply'
:
->
DiscussionUtil
.
urlFor
(
'create_comment'
,
@
id
)
'unvote'
:
->
DiscussionUtil
.
urlFor
(
"undo_vote_for_
#{
@
get
(
'type'
)
}
"
,
@
id
)
'unvote'
:
->
DiscussionUtil
.
urlFor
(
"undo_vote_for_
#{
@
get
(
'type'
)
}
"
,
@
id
)
'upvote'
:
->
DiscussionUtil
.
urlFor
(
"upvote_
#{
@
get
(
'type'
)
}
"
,
@
id
)
'upvote'
:
->
DiscussionUtil
.
urlFor
(
"upvote_
#{
@
get
(
'type'
)
}
"
,
@
id
)
'downvote'
:
->
DiscussionUtil
.
urlFor
(
"downvote_
#{
@
get
(
'type'
)
}
"
,
@
id
)
'downvote'
:
->
DiscussionUtil
.
urlFor
(
"downvote_
#{
@
get
(
'type'
)
}
"
,
@
id
)
'close'
:
->
DiscussionUtil
.
urlFor
(
'openclose_thread'
,
@
id
)
'close'
:
->
DiscussionUtil
.
urlFor
(
'openclose_thread'
,
@
id
)
'update'
:
->
DiscussionUtil
.
urlFor
(
'update_thread'
,
@
id
)
'update'
:
->
DiscussionUtil
.
urlFor
(
'update_thread'
,
@
id
)
'delete'
:
->
DiscussionUtil
.
urlFor
(
'delete_thread'
,
@
id
)
'delete'
:
->
DiscussionUtil
.
urlFor
(
'delete_thread'
,
@
id
)
'follow'
:
->
DiscussionUtil
.
urlFor
(
'follow_thread'
,
@
id
)
'unfollow'
:
->
DiscussionUtil
.
urlFor
(
'unfollow_thread'
,
@
id
)
initialize
:
->
initialize
:
->
@
set
(
'thread'
,
@
)
@
set
(
'thread'
,
@
)
...
@@ -381,7 +398,6 @@ class @Comments extends Backbone.Collection
...
@@ -381,7 +398,6 @@ class @Comments extends Backbone.Collection
model
:
Comment
model
:
Comment
initialize
:
->
initialize
:
->
@
bind
"add"
,
(
item
)
=>
@
bind
"add"
,
(
item
)
=>
item
.
collection
=
@
item
.
collection
=
@
...
...
lms/static/coffee/src/backbone_discussion/discussion.coffee
View file @
654075e0
class
@
Discussion
extends
Backbone
.
Collection
class
@
Discussion
extends
Backbone
.
Collection
model
:
Thread
model
:
Thread
initialize
:
->
initialize
:
->
DiscussionUtil
.
addDiscussion
@
id
,
@
DiscussionUtil
.
addDiscussion
@
id
,
@
@
bind
"add"
,
(
item
)
=>
@
bind
"add"
,
(
item
)
=>
item
.
discussion
=
@
item
.
discussion
=
@
...
...
lms/templates/discussion/mustache/_content.mustache
View file @
654075e0
...
@@ -52,7 +52,9 @@
...
@@ -52,7 +52,9 @@
</div>
</div>
<ul
class=
"discussion-actions"
>
<ul
class=
"discussion-actions"
>
<li><a
class=
"discussion-link discussion-reply discussion-reply-
{{
content
.
type
}}
"
href=
"javascript:void(0)"
>
Reply
</a></li>
<li><a
class=
"discussion-link discussion-reply discussion-reply-
{{
content
.
type
}}
"
href=
"javascript:void(0)"
>
Reply
</a></li>
<li><div
class=
"follow-wrapper"
></div></li>
{{#
thread
}}
<li><div
class=
"follow-wrapper"
><a
class=
"discussion-link discussion-follow-thread"
href=
"javascript:void(0)"
>
Follow
</a></div></li>
{{/
thread
}}
<li><a
class=
"discussion-link discussion-permanent-link"
href=
"javascript:void(0)"
>
Permanent Link
</a></li>
<li><a
class=
"discussion-link discussion-permanent-link"
href=
"javascript:void(0)"
>
Permanent Link
</a></li>
</ul>
</ul>
</div>
</div>
...
...
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