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
ded9e2d6
Commit
ded9e2d6
authored
Aug 03, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some archived stuff for later
parent
0f5b406b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
5 deletions
+82
-5
lms/static/coffee/src/discussion/content.coffee
+6
-5
lms/static/coffee/src/discussion/templates.coffee
+76
-0
No files found.
lms/static/coffee/src/discussion/content.coffee
View file @
ded9e2d6
...
...
@@ -15,13 +15,14 @@ Discussion = @Discussion
discussionContentHoverIn
=
->
status
=
$discussionContent
.
attr
(
"status"
)
||
"normal"
if
status
==
"normal"
$local
(
".discussion-link"
).
show
()
$local
(
".discussion-link"
).
show
()
if
status
==
"reply"
$local
(
".discussion-reply"
).
hide
()
discussionContentHoverOut
=
->
$local
(
".discussion-link"
).
hide
()
$discussionContent
.
hover
(
discussionContentHoverIn
,
discussionContentHoverOut
)
$discussionContent
.
children
(
".discussion-content-wrapper"
).
hover
(
discussionContentHoverIn
,
discussionContentHoverOut
)
handleReply
=
(
elem
)
->
$replyView
=
$local
(
".discussion-reply-new"
)
...
...
@@ -44,8 +45,8 @@ Discussion = @Discussion
$replyView
=
$local
(
".discussion-reply-new"
)
if
$replyView
.
length
$replyView
.
hide
()
reply
=
Discussion
.
generateDiscussionLink
(
"discussion-reply"
,
"Reply"
,
handleReply
)
$
(
elem
).
replaceWith
(
reply
)
#
reply = Discussion.generateDiscussionLink("discussion-reply", "Reply", handleReply)
#
$(elem).replaceWith(reply)
$discussionContent
.
attr
(
"status"
,
"normal"
)
handleSubmitReply
=
(
elem
)
->
...
...
lms/static/coffee/src/discussion/templates.coffee
View file @
ded9e2d6
...
...
@@ -3,7 +3,83 @@ if not @Discussion?
Discussion
=
@
Discussion
###
titleTemplate = """
<a class="thread-title" name="{{id}}" href="javascript:void(0)">{{title}}</a>
"""
threadTemplate: """
<div class="thread" _id="{{id}}">
{{content}}
<div class="comments">
</div>
</div>
"""
commentTemplate: """
<div class="comment" _id="{{id}}">
{{content}}
<div class="comments">
</div>
</div>
"""
contentTemplate: """
<div class="discussion-content">
<div class="discussion-content-wrapper clearfix">
{{vote}}
<div class="discussion-right-wrapper clearfix">
{{title}}
<div class="discussion-content-view">
<div class="content-body {{type}}-body" id="content-body-{{id}}">{{body}}</div>
<div class="content-raw-body {{type}}-raw-body" style="display: none">{{body}}</div>
{{tags}}
{{bottom_bar}}
</div>
</div>
</div>
</div>
"""
tagsTemplate = """
<div class="thread-tags">
</div>
<div class="thread-raw-tags" style="display: none">
"""
###
@
Discussion
=
$
.
extend
@
Discussion
,
###
renderThread: (thread) ->
rendered_title = Mustache.render titleTemplate, thread
content_view =
tags: rendered_tags
rendered_bottom_bar: rendered_bottom_bar
rendered_title: rendered_title
rendered_vote: rendered_vote
rendered_content = Mustache.render contentTemplate, $.extend(thread, contentView)
Mustache.render threadTemplate, {rendered_content: rendered_content}
renderComment: (comment) ->
commentTemplate: """
"""
###
newPostTemplate
:
"""
<form class="new-post-form" _id="{{discussion_id}}">
<ul class="discussion-errors"></ul>
...
...
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