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
f23c8fa0
Commit
f23c8fa0
authored
Aug 29, 2012
by
Matthew Mongeau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Comment details and comment voting.
parent
30a42dd5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
6 deletions
+54
-6
lms/static/coffee/src/discussion/views/discussion_thread_view.coffee
+1
-0
lms/static/coffee/src/discussion/views/response_comment_view.coffee
+1
-0
lms/static/coffee/src/discussion/views/thread_response_view.coffee
+36
-1
lms/templates/discussion/single_thread.html
+16
-5
No files found.
lms/static/coffee/src/discussion/views/discussion_thread_view.coffee
View file @
f23c8fa0
...
...
@@ -37,6 +37,7 @@ class @DiscussionThreadView extends Backbone.View
@
vote
()
else
@
unvote
()
false
toggleFollowing
:
(
event
)
->
$elem
=
$
(
event
.
target
)
...
...
lms/static/coffee/src/discussion/views/response_comment_view.coffee
View file @
f23c8fa0
...
...
@@ -3,4 +3,5 @@ class @ResponseCommentView extends Backbone.View
template
:
_
.
template
(
$
(
"#response-comment-template"
).
html
())
render
:
->
@
$el
.
html
(
@
template
(
@
model
.
toJSON
()))
@
$
(
".timeago"
).
timeago
()
@
lms/static/coffee/src/discussion/views/thread_response_view.coffee
View file @
f23c8fa0
class
@
ThreadResponseView
extends
Backbone
.
View
tagName
:
"li"
template
:
_
.
template
(
$
(
"#thread-response-template"
).
html
())
events
:
"click .vote-btn"
:
"toggleVote"
render
:
->
@
$el
.
html
(
@
template
(
@
model
.
toJSON
()))
if
window
.
user
.
voted
(
@
model
)
@
$
(
".vote-btn"
).
addClass
(
"is-cast"
)
@
$
(
".posted-details"
).
timeago
()
@
renderComments
()
@
...
...
@@ -12,4 +17,34 @@ class @ThreadResponseView extends Backbone.View
renderComment
:
(
comment
)
=>
view
=
new
ResponseCommentView
(
model
:
comment
)
view
.
render
()
@
$
(
".comments"
).
append
(
view
.
el
)
@
$
(
".comments li:last"
).
before
(
view
.
el
)
toggleVote
:
->
@
$
(
".vote-btn"
).
toggleClass
(
"is-cast"
)
if
@
$
(
".vote-btn"
).
hasClass
(
"is-cast"
)
@
vote
()
else
@
unvote
()
false
vote
:
->
url
=
@
model
.
urlFor
(
"upvote"
)
@
$
(
".votes-count-number"
).
html
(
parseInt
(
@
$
(
".votes-count-number"
).
html
())
+
1
)
DiscussionUtil
.
safeAjax
$elem
:
@
$
(
".discussion-vote"
)
url
:
url
type
:
"POST"
success
:
(
response
,
textStatus
)
=>
if
textStatus
==
'success'
@
model
.
set
(
response
)
unvote
:
->
url
=
@
model
.
urlFor
(
"unvote"
)
@
$
(
".votes-count-number"
).
html
(
parseInt
(
@
$
(
".votes-count-number"
).
html
())
-
1
)
DiscussionUtil
.
safeAjax
$elem
:
@
$
(
".discussion-vote"
)
url
:
url
type
:
"POST"
success
:
(
response
,
textStatus
)
=>
if
textStatus
==
'success'
@
model
.
set
(
response
)
lms/templates/discussion/single_thread.html
View file @
f23c8fa0
...
...
@@ -127,13 +127,23 @@
</script>
<script
type=
"text/template"
id=
"thread-response-template"
>
<
header
>
<
a
href
=
"#"
class
=
"vote-btn"
data
-
tooltip
=
"vote"
><
span
class
=
"plus-icon"
><
/span><span class="votes-count-number">${"<%= votes
[
'up_count'
]
%>"}</
span
><
/a
>
<
a
href
=
"#"
class
=
"posted-by"
>
$
{
"<%= username %>"
}
<
/a
>
<
p
class
=
"posted-details"
title
=
"${'<%= created_at %>'}"
>
Sometime
<
/p
>
<
/header
>
<
div
class
=
"response-body"
>
$
{
"<%= body %>"
}
<
/div
>
<
ol
class
=
"comments"
>
<
li
>
<
form
class
=
"comment-form"
>
<
input
type
=
"text"
placeholder
=
"Comment…"
class
=
"comment-form-input"
>
<
/form
>
<
/li
>
<
/ol
>
</script>
<script
type=
"text/template"
id=
"response-comment-template"
>
<
p
>
$
{
'<%= body %>'
}
<
/p
>
<
p
>
$
{
'<%= body %>'
}
<
span
class
=
"posted-details"
>
–
posted
<
span
class
=
"timeago"
title
=
"${'<%= created_at %>'}"
>
sometime
<
/span> by <a href="#">${'<%= username %>'}</
a
><
/span>
</
p
>
</script>
<script
type=
"text/template"
id=
"thread-list-item-template"
>
...
...
@@ -141,13 +151,14 @@
</script>
<script>
$$contents
=
{}
$$discussions
=
{}
$$contents
=
{};
$$discussions
=
{};
$$course_id
=
"${course_id}"
;
$
(
document
).
ready
(
function
()
{
window
.
user
=
new
DiscussionUser
(
JSON
.
parse
(
"${user_info | escapejs}"
));
var
discussion
=
new
Discussion
(
JSON
.
parse
(
"${threads | escapejs}"
));
var
app
=
new
DiscussionRouter
({
discussion
:
discussion
})
Backbone
.
history
.
start
({
pushState
:
true
,
root
:
"/courses/${course_id}/discussion/forum/"
})
var
app
=
new
DiscussionRouter
({
discussion
:
discussion
})
;
Backbone
.
history
.
start
({
pushState
:
true
,
root
:
"/courses/${course_id}/discussion/forum/"
})
;
});
</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