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
13ae85ac
Commit
13ae85ac
authored
Aug 29, 2012
by
Matthew Mongeau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Navigating threads.
parent
1026a173
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
69 additions
and
19 deletions
+69
-19
lms/djangoapps/django_comment_client/forum/views.py
+1
-5
lms/static/coffee/src/discussion/discussion_router.coffee
+27
-0
lms/static/coffee/src/discussion/models/discussion_user.coffee
+2
-3
lms/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
+4
-0
lms/static/coffee/src/discussion/views/discussion_thread_view.coffee
+3
-0
lms/static/coffee/src/discussion/views/thread_list_item_view.coffee
+5
-0
lms/templates/discussion/single_thread.html
+27
-11
No files found.
lms/djangoapps/django_comment_client/forum/views.py
View file @
13ae85ac
...
@@ -224,17 +224,13 @@ def single_thread(request, course_id, discussion_id, thread_id):
...
@@ -224,17 +224,13 @@ def single_thread(request, course_id, discussion_id, thread_id):
course_id
,
course_id
,
)
)
user_info
=
cc
.
User
.
from_django_user
(
request
.
user
)
.
to_dict
()
user_info
=
cc
.
User
.
from_django_user
(
request
.
user
)
.
to_dict
()
thread
=
cc
.
Thread
.
find
(
thread_id
)
.
retrieve
(
recursive
=
True
)
annotated_content_info
=
utils
.
get_annotated_content_infos
(
course_id
,
thread
=
thread
,
user
=
request
.
user
,
user_info
=
user_info
)
context
=
{
context
=
{
'discussion_id'
:
discussion_id
,
'discussion_id'
:
discussion_id
,
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
'init'
:
''
,
'init'
:
''
,
'
annotated_content_info'
:
json
.
dumps
(
annotated_content
_info
),
'
user_info'
:
json
.
dumps
(
user
_info
),
'content'
:
render_single_thread
(
request
,
discussion_id
,
course_id
,
thread_id
),
'content'
:
render_single_thread
(
request
,
discussion_id
,
course_id
,
thread_id
),
'course'
:
course
,
'course'
:
course
,
'recent_active_threads'
:
recent_active_threads
,
'recent_active_threads'
:
recent_active_threads
,
...
...
lms/static/coffee/src/discussion/discussion_router.coffee
0 → 100644
View file @
13ae85ac
class
@
DiscussionRouter
extends
Backbone
.
Router
routes
:
""
:
"allThreads"
":forum_name/threads/:thread_id"
:
"showThread"
initialize
:
(
options
)
->
@
user
=
options
[
'user'
]
@
discussion
=
options
[
'discussion'
]
@
displayNav
()
@
forum
=
null
allThreads
:
->
true
showThread
:
(
forum_name
,
thread_id
)
->
@
forum
=
forum_name
thread
=
@
discussion
.
get
(
thread_id
)
view
=
new
DiscussionThreadView
(
el
:
$
(
".discussion-column"
),
model
:
thread
,
user
:
@
user
)
view
.
render
()
displayNav
:
->
view
=
new
DiscussionThreadListView
(
collection
:
@
discussion
,
el
:
$
(
".post-list"
))
view
.
on
"thread:selected"
,
@
navigateToThread
view
.
render
()
navigateToThread
:
(
thread_id
)
=>
@
navigate
(
"
#{
@
forum
}
/threads/
#{
thread_id
}
"
,
trigger
:
true
)
lms/static/coffee/src/discussion/models/discussion_user.coffee
View file @
13ae85ac
...
@@ -3,8 +3,7 @@ class @DiscussionUser
...
@@ -3,8 +3,7 @@ class @DiscussionUser
@
content_info
=
content_info
@
content_info
=
content_info
following
:
(
thread
)
->
following
:
(
thread
)
->
@
content_info
[
thread
.
id
][
'subscribed'
]
==
true
_
.
include
(
@
content_info
[
'subscribed_thread_ids'
],
thread
.
id
)
voted
:
(
thread
)
->
voted
:
(
thread
)
->
@
content_info
[
thread
.
id
][
'voted'
]
==
'up'
_
.
include
(
@
content_info
[
'upvoted_ids'
],
thread
.
id
)
lms/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
View file @
13ae85ac
...
@@ -4,5 +4,9 @@ class @DiscussionThreadListView extends Backbone.View
...
@@ -4,5 +4,9 @@ class @DiscussionThreadListView extends Backbone.View
@
@
renderThreadListItem
:
(
thread
)
=>
renderThreadListItem
:
(
thread
)
=>
view
=
new
ThreadListItemView
(
model
:
thread
)
view
=
new
ThreadListItemView
(
model
:
thread
)
view
.
on
"thread:selected"
,
@
threadSelected
view
.
render
()
view
.
render
()
@
$el
.
append
(
view
.
el
)
@
$el
.
append
(
view
.
el
)
threadSelected
:
(
thread_id
)
=>
@
trigger
(
"thread:selected"
,
thread_id
)
lms/static/coffee/src/discussion/views/discussion_thread_view.coffee
View file @
13ae85ac
...
@@ -2,9 +2,12 @@ class @DiscussionThreadView extends Backbone.View
...
@@ -2,9 +2,12 @@ class @DiscussionThreadView extends Backbone.View
events
:
events
:
"click .discussion-vote-up"
:
"toggleVote"
"click .discussion-vote-up"
:
"toggleVote"
"click .dogear"
:
"toggleFollowing"
"click .dogear"
:
"toggleFollowing"
template
:
_
.
template
(
$
(
"#thread-template"
).
html
())
initialize
:
(
options
)
->
initialize
:
(
options
)
->
@
user
=
options
[
'user'
]
@
user
=
options
[
'user'
]
@
model
.
bind
"change"
,
@
updateModelDetails
@
model
.
bind
"change"
,
@
updateModelDetails
@
$el
.
html
(
@
template
(
@
model
.
toJSON
()))
updateModelDetails
:
=>
updateModelDetails
:
=>
@
$
(
".votes-count-number"
).
html
(
@
model
.
get
(
"votes"
)[
"up_count"
])
@
$
(
".votes-count-number"
).
html
(
@
model
.
get
(
"votes"
)[
"up_count"
])
...
...
lms/static/coffee/src/discussion/views/thread_list_item_view.coffee
View file @
13ae85ac
class
@
ThreadListItemView
extends
Backbone
.
View
class
@
ThreadListItemView
extends
Backbone
.
View
tagName
:
"li"
tagName
:
"li"
template
:
_
.
template
(
$
(
"#thread-list-item-template"
).
html
())
template
:
_
.
template
(
$
(
"#thread-list-item-template"
).
html
())
events
:
"click a"
:
"threadSelected"
initialize
:
->
initialize
:
->
@
model
.
on
"change"
,
@
render
@
model
.
on
"change"
,
@
render
render
:
=>
render
:
=>
@
$el
.
html
(
@
template
(
@
model
.
toJSON
()))
@
$el
.
html
(
@
template
(
@
model
.
toJSON
()))
@
@
threadSelected
:
->
@
trigger
(
"thread:selected"
,
@
model
.
id
)
false
lms/templates/discussion/single_thread.html
View file @
13ae85ac
...
@@ -58,7 +58,7 @@
...
@@ -58,7 +58,7 @@
<div
class=
"browse is-open"
>
<div
class=
"browse is-open"
>
<a
href=
"#"
class=
"board-drop-icon"
></a>
<a
href=
"#"
class=
"board-drop-icon"
></a>
<a
href=
"#"
class=
"board-drop-btn"
><span
class=
"current-board"
>
Homework / Week 1
</span>
<span
class=
"drop-arrow"
>
▾
</span></a>
<a
href=
"#"
class=
"board-drop-btn"
><span
class=
"current-board"
>
Homework / Week 1
</span>
<span
class=
"drop-arrow"
>
▾
</span></a>
</div>
</div>
<ul
class=
"board-drop-menu"
>
<ul
class=
"board-drop-menu"
>
<li><a
href=
"#"
><span
class=
"board-name"
>
All
</span>
<span
class=
"unread"
>
1,248
</span></a></li>
<li><a
href=
"#"
><span
class=
"board-name"
>
All
</span>
<span
class=
"unread"
>
1,248
</span></a></li>
<li><a
href=
"#"
><span
class=
"board-name"
>
Following
</span></a></li>
<li><a
href=
"#"
><span
class=
"board-name"
>
Following
</span></a></li>
...
@@ -97,30 +97,46 @@
...
@@ -97,30 +97,46 @@
</div>
</div>
</div>
</div>
<div
class=
"discussion-column"
>
<div
class=
"discussion-column"
>
${content.decode('utf-8')}
</div>
</div>
</div>
</div>
</div>
</div>
<script
type=
"text/template"
id=
"thread-template"
>
<
article
class
=
"discussion-article"
data
-
id
=
"${'<%= id %>'}"
>
<
a
href
=
"#"
class
=
"dogear"
><
/a
>
<
div
class
=
"discussion-post"
>
<
header
>
<
a
href
=
"#"
class
=
"vote-btn discussion-vote discussion-vote-up"
><
span
class
=
"plus-icon"
>+<
/span> <span class='votes-count-number'>${'<%= votes
[
"up_count"
]
%>'}</
span
><
/a
>
<
h1
>
$
{
'<%= title %>'
}
<
/h1
>
<
p
class
=
"posted-details"
>
<
span
class
=
"timeago"
title
=
"${'<%= created_at %>'}"
>
sometime
<
/span> b
y
<
a
href
=
"${'<%= user_id %>'}"
>
$
{
'<%= username %>'
}
<
/a
>
<
/p
>
<
/header
>
<
div
class
=
"post-body"
>
$
{
'<%= body %>'
}
<
/div
>
<
/div
>
<
ol
class
=
"responses"
>
<
/ol
>
<
/article
>
</script>
<script
type=
"text/template"
id=
"thread-list-item-template"
>
<script
type=
"text/template"
id=
"thread-list-item-template"
>
<
a
href
=
"
#
"
><
span
class
=
"title"
>
$
{
"<%= title %>"
}
<
/span> <span class="comments-count">${"<%= comments_count %>"}</
span
><
span
class
=
"votes-count"
>+
$
{
"<%= votes['up_count'] %>"
}
<
/span></
a
>
<
a
href
=
"
${'<%= id %>'}
"
><
span
class
=
"title"
>
$
{
"<%= title %>"
}
<
/span> <span class="comments-count">${"<%= comments_count %>"}</
span
><
span
class
=
"votes-count"
>+
$
{
"<%= votes['up_count'] %>"
}
<
/span></
a
>
</script>
</script>
<script>
<script>
$$contents
=
{}
$$contents
=
{}
$$discussions
=
{}
$$discussions
=
{}
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
var
user
=
new
DiscussionUser
(
JSON
.
parse
(
"${
annotated_content
_info | escapejs}"
));
var
user
=
new
DiscussionUser
(
JSON
.
parse
(
"${
user
_info | escapejs}"
));
var
discussion
=
new
Discussion
(
JSON
.
parse
(
"${threads | escapejs}"
));
var
discussion
=
new
Discussion
(
JSON
.
parse
(
"${threads | escapejs}"
));
list_view
=
new
DiscussionThreadListView
({
collection
:
discussion
,
el
:
$
(
".post-list"
)});
var
app
=
new
DiscussionRouter
({
user
:
user
,
discussion
:
discussion
})
list_view
.
render
();
Backbone
.
history
.
start
({
pushState
:
true
,
root
:
"/courses/${course_id}/discussion/forum/"
})
var
thread
=
discussion
.
get
(
"${thread_id | escapejs}"
)
view
=
new
DiscussionThreadView
({
el
:
$
(
".discussion-article"
),
model
:
thread
,
user
:
user
});
view
.
render
();
});
});
</script>
</script>
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