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
4dae36cd
Commit
4dae36cd
authored
Aug 22, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
only execude code when backbone is defined
parent
45431ae7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
32 deletions
+34
-32
lms/static/coffee/src/discussion/content.coffee
+0
-0
lms/static/coffee/src/discussion/discussion.coffee
+0
-0
lms/static/coffee/src/discussion/discussion_module.coffee
+32
-31
lms/static/coffee/src/discussion/main.coffee
+2
-1
No files found.
lms/static/coffee/src/discussion/content.coffee
View file @
4dae36cd
This diff is collapsed.
Click to expand it.
lms/static/coffee/src/discussion/discussion.coffee
View file @
4dae36cd
This diff is collapsed.
Click to expand it.
lms/static/coffee/src/discussion/discussion_module.coffee
View file @
4dae36cd
class
@
DiscussionModuleView
extends
Backbone
.
View
events
:
"click .discussion-show"
:
"toggleDiscussion"
toggleDiscussion
:
(
event
)
->
if
@
showed
@
$
(
"section.discussion"
).
hide
()
$
(
event
.
target
).
html
(
"Show Discussion"
)
@
showed
=
false
else
if
@
retrieved
@
$
(
"section.discussion"
).
show
()
$
(
event
.
target
).
html
(
"Hide Discussion"
)
@
showed
=
true
if
Backbone
?
class
@
DiscussionModuleView
extends
Backbone
.
View
events
:
"click .discussion-show"
:
"toggleDiscussion"
toggleDiscussion
:
(
event
)
->
if
@
showed
@
$
(
"section.discussion"
).
hide
()
$
(
event
.
target
).
html
(
"Show Discussion"
)
@
showed
=
false
else
$elem
=
$
(
event
.
target
)
discussion_id
=
$elem
.
attr
(
"discussion_id"
)
url
=
DiscussionUtil
.
urlFor
'retrieve_discussion'
,
discussion_id
Discussion
.
safeAjax
$elem
:
$elem
url
:
url
type
:
"GET"
dataType
:
'json'
success
:
(
response
,
textStatus
)
=>
@
$el
.
append
(
response
.
html
)
$discussion
=
@
$el
.
find
(
"section.discussion"
)
$
(
event
.
target
).
html
(
"Hide Discussion"
)
discussion
=
new
Discussion
()
discussion
.
reset
(
response
.
discussionData
,
{
silent
:
false
})
view
=
new
DiscussionView
(
el
:
$discussion
[
0
],
model
:
discussion
)
DiscussionUtil
.
bulkUpdateContentInfo
(
window
.
$
$annotated_content_info
)
@
retrieved
=
true
@
showed
=
true
if
@
retrieved
@
$
(
"section.discussion"
).
show
()
$
(
event
.
target
).
html
(
"Hide Discussion"
)
@
showed
=
true
else
$elem
=
$
(
event
.
target
)
discussion_id
=
$elem
.
attr
(
"discussion_id"
)
url
=
DiscussionUtil
.
urlFor
'retrieve_discussion'
,
discussion_id
Discussion
.
safeAjax
$elem
:
$elem
url
:
url
type
:
"GET"
dataType
:
'json'
success
:
(
response
,
textStatus
)
=>
@
$el
.
append
(
response
.
html
)
$discussion
=
@
$el
.
find
(
"section.discussion"
)
$
(
event
.
target
).
html
(
"Hide Discussion"
)
discussion
=
new
Discussion
()
discussion
.
reset
(
response
.
discussionData
,
{
silent
:
false
})
view
=
new
DiscussionView
(
el
:
$discussion
[
0
],
model
:
discussion
)
DiscussionUtil
.
bulkUpdateContentInfo
(
window
.
$
$annotated_content_info
)
@
retrieved
=
true
@
showed
=
true
lms/static/coffee/src/discussion/main.coffee
View file @
4dae36cd
...
...
@@ -12,4 +12,5 @@ $ ->
discussion
.
reset
(
discussionData
,
{
silent
:
false
})
view
=
new
DiscussionView
(
el
:
elem
,
model
:
discussion
)
DiscussionUtil
.
bulkUpdateContentInfo
(
window
.
$
$annotated_content_info
)
if
window
.
$
$annotated_content_info
?
DiscussionUtil
.
bulkUpdateContentInfo
(
window
.
$
$annotated_content_info
)
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