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
5ec864f7
Commit
5ec864f7
authored
Aug 29, 2012
by
Matthew Mongeau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hook up list to voting.
parent
ee7ade41
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
7 deletions
+31
-7
lms/djangoapps/django_comment_client/forum/views.py
+2
-1
lms/static/coffee/src/discussion/main.coffee
+17
-0
lms/templates/discussion/single_thread.html
+12
-6
No files found.
lms/djangoapps/django_comment_client/forum/views.py
View file @
5ec864f7
...
...
@@ -241,7 +241,8 @@ def single_thread(request, course_id, discussion_id, thread_id):
'recent_active_threads'
:
recent_active_threads
,
'trending_tags'
:
trending_tags
,
'course_id'
:
course
.
id
,
'threads'
:
threads
,
'thread_id'
:
thread_id
,
'threads'
:
json
.
dumps
(
threads
),
}
return
render_to_response
(
'discussion/single_thread.html'
,
context
)
...
...
lms/static/coffee/src/discussion/main.coffee
View file @
5ec864f7
...
...
@@ -8,6 +8,23 @@ class @DiscussionUser
voted
:
(
thread
)
->
@
content_info
[
thread
.
id
][
'voted'
]
==
'up'
class
@
ThreadListItemView
extends
Backbone
.
View
tagName
:
"li"
template
:
_
.
template
(
$
(
"#thread-list-item-template"
).
html
())
initialize
:
->
@
model
.
on
"change"
,
@
render
render
:
=>
@
$el
.
html
(
@
template
(
@
model
.
toJSON
()))
@
class
@
DiscussionThreadListView
extends
Backbone
.
View
render
:
->
@
collection
.
each
@
renderThreadListItem
renderThreadListItem
:
(
thread
)
=>
view
=
new
ThreadListItemView
(
model
:
thread
)
view
.
render
()
@
$el
.
append
(
view
.
el
)
class
@
DiscussionThreadView
extends
Backbone
.
View
events
:
"click .discussion-vote-up"
:
"toggleVote"
...
...
lms/templates/discussion/single_thread.html
View file @
5ec864f7
...
...
@@ -30,9 +30,6 @@
</div>
<div
class=
"post-list-wrapper"
>
<ul
class=
"post-list"
>
% for discussion_thread in threads:
<li><a
href=
"${helpers.permalink(discussion_thread) | h}"
><span
class=
"title"
>
${discussion_thread['title'] | h}
</span>
<span
class=
"comments-count"
>
${discussion_thread['comments_count'] | h}
</span><span
class=
"votes-count"
>
+${discussion_thread['votes']['up_count'] | h}
</span></a></li>
% endfor
</ul>
</div>
</div>
...
...
@@ -51,13 +48,22 @@
</div>
</div>
<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
>
</script>
<script>
$$contents
=
{}
$$discussions
=
{}
$
(
document
).
ready
(
function
()
{
var
user
=
new
DiscussionUser
(
JSON
.
parse
(
"${annotated_content_info | escapejs}"
));
var
thread
=
new
Thread
(
JSON
.
parse
(
"${thread | escapejs}"
));
view
=
new
DiscussionThreadView
({
el
:
$
(
".discussion-article"
),
model
:
thread
,
user
:
user
})
view
.
render
()
var
discussion
=
new
Discussion
(
JSON
.
parse
(
"${threads | escapejs}"
));
list_view
=
new
DiscussionThreadListView
({
collection
:
discussion
,
el
:
$
(
".post-list"
)});
list_view
.
render
();
var
thread
=
discussion
.
get
(
"${thread_id | escapejs}"
)
view
=
new
DiscussionThreadView
({
el
:
$
(
".discussion-article"
),
model
:
thread
,
user
:
user
});
view
.
render
();
});
</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