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
3b76fe16
Commit
3b76fe16
authored
Aug 22, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make inline page working
parent
951fb063
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
52 deletions
+45
-52
lms/djangoapps/django_comment_client/forum/views.py
+5
-3
lms/static/coffee/src/backbone_discussion/content.coffee
+1
-1
lms/static/coffee/src/backbone_discussion/discussion.coffee
+8
-4
lms/static/coffee/src/backbone_discussion/discussion_module.coffee
+28
-37
lms/static/coffee/src/backbone_discussion/main.coffee
+1
-1
lms/static/coffee/src/backbone_discussion/utils.coffee
+0
-4
lms/templates/courseware/courseware.html
+2
-2
No files found.
lms/djangoapps/django_comment_client/forum/views.py
View file @
3b76fe16
...
...
@@ -125,7 +125,11 @@ def inline_discussion(request, course_id, discussion_id):
threads
,
query_params
=
get_threads
(
request
,
course_id
,
discussion_id
)
html
=
render_inline_discussion
(
request
,
course_id
,
threads
,
discussion_id
=
discussion_id
,
\
query_params
=
query_params
)
return
utils
.
HtmlResponse
(
html
)
return
utils
.
JsonResponse
({
'html'
:
html
,
'discussionData'
:
threads
,
})
def
render_search_bar
(
request
,
course_id
,
discussion_id
=
None
,
text
=
''
):
if
not
discussion_id
:
...
...
@@ -142,8 +146,6 @@ def forum_form_discussion(request, course_id):
threads
,
query_params
=
get_threads
(
request
,
course_id
)
content
=
render_forum_discussion
(
request
,
course_id
,
threads
,
discussion_id
=
_general_discussion_id
(
course_id
),
query_params
=
query_params
)
if
request
.
is_ajax
():
return
utils
.
JsonResponse
({
'html'
:
content
,
...
...
lms/static/coffee/src/backbone_discussion/content.coffee
View file @
3b76fe16
...
...
@@ -175,7 +175,7 @@ class @ContentView extends Backbone.View
data
:
body
:
body
anonymous
:
anonymous
auto
watch
:
autowatch
auto
_subscribe
:
autowatch
error
:
DiscussionUtil
.
formErrorHandler
@
$
(
".discussion-errors"
)
success
:
(
response
,
textStatus
)
=>
DiscussionUtil
.
clearFormErrors
@
$
(
".discussion-errors"
)
...
...
lms/static/coffee/src/backbone_discussion/discussion.coffee
View file @
3b76fe16
...
...
@@ -15,8 +15,6 @@ class @Discussion extends Backbone.Collection
@
add
model
model
class
@
DiscussionModuleView
extends
Backbone
.
View
class
@
DiscussionView
extends
Backbone
.
View
$
:
(
selector
)
->
...
...
@@ -39,11 +37,13 @@ class @DiscussionView extends Backbone.View
@
newPost
()
reload
:
(
$elem
,
url
)
->
console
.
log
"here"
if
not
url
then
return
DiscussionUtil
.
get
$elem
,
url
,
{},
(
response
,
textStatus
)
=>
$discussion
=
$
(
response
.
html
)
console
.
log
response
$parent
=
@
$el
.
parent
()
@
$el
.
replaceWith
(
$discussion
)
@
$el
.
replaceWith
(
response
.
html
)
$discussion
=
$parent
.
find
(
"section.discussion"
)
@
model
.
reset
(
response
.
discussionData
,
{
silent
:
false
})
view
=
new
DiscussionView
el
:
$discussion
[
0
],
model
:
@
model
DiscussionUtil
.
bulkUpdateContentInfo
(
window
.
$
$annotated_content_info
)
...
...
@@ -111,6 +111,8 @@ class @DiscussionView extends Backbone.View
title
=
@
$
(
".new-post-title"
).
val
()
body
=
DiscussionUtil
.
getWmdContent
@
$el
,
$
.
proxy
(
@
$
,
@
),
"new-post-body"
tags
=
@
$
(
".new-post-tags"
).
val
()
anonymous
=
false
||
@
$
(
".discussion-post-anonymously"
).
is
(
":checked"
)
autowatch
=
false
||
@
$
(
".discussion-auto-watch"
).
is
(
":checked"
)
url
=
DiscussionUtil
.
urlFor
(
'create_thread'
,
@
model
.
id
)
DiscussionUtil
.
safeAjax
$elem
:
$
(
event
.
target
)
...
...
@@ -121,6 +123,8 @@ class @DiscussionView extends Backbone.View
title
:
title
body
:
body
tags
:
tags
anonymous
:
anonymous
auto_subscribe
:
autowatch
error
:
DiscussionUtil
.
formErrorHandler
(
@
$
(
".new-post-form-errors"
))
success
:
(
response
,
textStatus
)
=>
DiscussionUtil
.
clearFormErrors
(
@
$
(
".new-post-form-errors"
))
...
...
lms/static/coffee/src/backbone_discussion/discussion_module.coffee
View file @
3b76fe16
if
not
@
Discussion
?
@
Discussion
=
{}
Discussion
=
@
Discussion
@
Discussion
=
$
.
extend
@
Discussion
,
initializeDiscussionModule
:
(
elem
)
->
$discussionModule
=
$
(
elem
)
$local
=
Discussion
.
generateLocal
(
$discussionModule
)
handleShowDiscussion
=
(
elem
)
->
$elem
=
$
(
elem
)
if
not
$local
(
"section.discussion"
).
length
class
@
DiscussionModuleView
extends
Backbone
.
View
events
:
"click .discussion-show"
:
"toggleDiscussion"
toggleDiscussion
:
(
event
)
->
console
.
log
"toggle"
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
else
$elem
=
$
(
event
.
target
)
discussion_id
=
$elem
.
attr
(
"discussion_id"
)
url
=
Discussion
.
urlFor
'retrieve_discussion'
,
discussion_id
url
=
Discussion
Util
.
urlFor
'retrieve_discussion'
,
discussion_id
Discussion
.
safeAjax
$elem
:
$elem
url
:
url
type
:
"GET"
success
:
(
data
,
textStatus
,
xhr
)
->
$discussionModule
.
append
(
data
)
discussion
=
$local
(
"section.discussion"
)
Discussion
.
initializeDiscussion
(
discussion
)
Discussion
.
bindDiscussionEvents
(
discussion
)
$elem
.
html
(
"Hide Discussion"
)
$elem
.
unbind
(
'click'
).
click
->
handleHideDiscussion
(
this
)
dataType
:
'html'
else
$local
(
"section.discussion"
).
show
()
$elem
.
html
(
"Hide Discussion"
)
$elem
.
unbind
(
'click'
).
click
->
handleHideDiscussion
(
this
)
handleHideDiscussion
=
(
elem
)
->
$local
(
"section.discussion"
).
hide
()
$elem
=
$
(
elem
)
$elem
.
html
(
"Show Discussion"
)
$elem
.
unbind
(
'click'
).
click
->
handleShowDiscussion
(
this
)
$local
(
".discussion-show"
).
click
->
handleShowDiscussion
(
this
)
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/backbone_discussion/main.coffee
View file @
3b76fe16
...
...
@@ -7,7 +7,7 @@ $ ->
view
=
new
DiscussionModuleView
(
el
:
elem
)
$
(
"section.discussion"
).
each
(
index
,
elem
)
->
discussionData
=
DiscussionUtil
.
getDiscussionData
(
elem
)
discussionData
=
DiscussionUtil
.
getDiscussionData
(
$
(
elem
).
attr
(
"_id"
)
)
discussion
=
new
Discussion
()
discussion
.
reset
(
discussionData
,
{
silent
:
false
})
view
=
new
DiscussionView
(
el
:
elem
,
model
:
discussion
)
...
...
lms/static/coffee/src/backbone_discussion/utils.coffee
View file @
3b76fe16
...
...
@@ -6,10 +6,6 @@ class @DiscussionUtil
$
(
"script#
#{
id
}
"
).
html
()
@
getDiscussionData
:
(
id
)
->
if
id
instanceof
$
id
=
id
.
attr
(
"_id"
)
else
if
typeof
id
==
"object"
id
=
$
(
id
).
attr
(
"_id"
)
return
$$discussion_data
[
id
]
@
addContent
:
(
id
,
content
)
->
window
.
$
$contents
[
id
]
=
content
...
...
lms/templates/courseware/courseware.html
View file @
3b76fe16
...
...
@@ -5,7 +5,7 @@
<
%
block
name=
"headextra"
>
<
%
static:css
group=
'course'
/>
<
%
include
file=
"discussion/_js_head_dependencies.html"
/>
<
%
include
file=
"
../
discussion/_js_head_dependencies.html"
/>
</
%
block>
<
%
block
name=
"js_extra"
>
...
...
@@ -23,7 +23,7 @@
<
%
static:js
group=
'courseware'
/>
<
%
include
file=
"discussion/_js_body_dependencies.html"
/>
<
%
include
file=
"
../
discussion/_js_body_dependencies.html"
/>
<!-- TODO: http://docs.jquery.com/Plugins/Validation -->
...
...
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