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
ddce6d8c
Commit
ddce6d8c
authored
Jul 31, 2012
by
Brittany Cheng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:dementrock/mitx into discussion2
parents
48674d6f
c39b2db6
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
63 additions
and
31 deletions
+63
-31
common/lib/xmodule/xmodule/discussion_module.py
+1
-10
lms/djangoapps/courseware/module_render.py
+0
-12
lms/djangoapps/django_comment_client/forum/urls.py
+1
-0
lms/djangoapps/django_comment_client/forum/views.py
+6
-6
lms/static/coffee/src/discussion.coffee
+48
-3
lms/templates/courseware.html
+4
-0
lms/templates/discussion/_show_discussion.html
+3
-0
No files found.
common/lib/xmodule/xmodule/discussion_module.py
View file @
ddce6d8c
...
...
@@ -13,16 +13,9 @@ import json
class
DiscussionModule
(
XModule
):
def
get_html
(
self
):
context
=
{
'threads'
:
comment_client
.
get_threads
(
self
.
discussion_id
,
recursive
=
False
),
'time_ago_in_words'
:
time_ago_in_words
,
'parse'
:
dateutil
.
parser
.
parse
,
'discussion_id'
:
self
.
discussion_id
,
'search_bar'
:
''
,
'user_info'
:
comment_client
.
get_user_info
(
self
.
user_id
,
raw
=
True
),
'tags'
:
comment_client
.
get_threads_tags
(
raw
=
True
),
'course_id'
:
self
.
course_id
,
}
return
self
.
system
.
render_template
(
'discussion/
inline
.html'
,
context
)
return
self
.
system
.
render_template
(
'discussion/
_show_discussion
.html'
,
context
)
def
__init__
(
self
,
system
,
location
,
definition
,
instance_state
=
None
,
shared_state
=
None
,
**
kwargs
):
XModule
.
__init__
(
self
,
system
,
location
,
definition
,
instance_state
,
shared_state
,
**
kwargs
)
...
...
@@ -33,8 +26,6 @@ class DiscussionModule(XModule):
self
.
discussion_id
=
xml_data
.
attrib
[
'id'
]
self
.
title
=
xml_data
.
attrib
[
'for'
]
self
.
discussion_category
=
xml_data
.
attrib
[
'discussion_category'
]
self
.
user_id
=
instance_state
[
'user_id'
]
self
.
course_id
=
instance_state
[
'course_id'
]
class
DiscussionDescriptor
(
RawDescriptor
):
module_class
=
DiscussionModule
lms/djangoapps/courseware/module_render.py
View file @
ddce6d8c
...
...
@@ -124,13 +124,6 @@ def get_module(user, request, location, student_module_cache, position=None):
'''
descriptor
=
modulestore
()
.
get_item
(
location
)
user_id
=
user
.
id
import
re
course_id
=
re
.
search
(
r'^/courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/'
,
request
.
path
)
if
course_id
:
course_id
=
course_id
.
group
(
'course_id'
)
instance_module
=
student_module_cache
.
lookup
(
descriptor
.
category
,
descriptor
.
location
.
url
())
...
...
@@ -142,11 +135,6 @@ def get_module(user, request, location, student_module_cache, position=None):
shared_module
=
None
instance_state
=
instance_module
.
state
if
instance_module
is
not
None
else
{}
instance_hash
=
json
.
loads
(
instance_state
)
if
isinstance
(
instance_state
,
str
)
or
isinstance
(
instance_state
,
unicode
)
\
else
instance_state
instance_state
=
json
.
dumps
(
dict
(
instance_hash
.
items
()
+
[(
"user_id"
,
user
.
id
),
(
"course_id"
,
course_id
)]))
shared_state
=
shared_module
.
state
if
shared_module
is
not
None
else
None
# TODO (vshnayder): fix hardcoded urls (use reverse)
...
...
lms/djangoapps/django_comment_client/forum/urls.py
View file @
ddce6d8c
...
...
@@ -4,5 +4,6 @@ import django_comment_client.forum.views
urlpatterns
=
patterns
(
'django_comment_client.forum.views'
,
url
(
r'search$'
,
'search'
,
name
=
'search'
),
url
(
r'(?P<discussion_id>\w+)/threads/(?P<thread_id>\w+)$'
,
'single_thread'
,
name
=
'single_thread'
),
url
(
r'(?P<discussion_id>\w+)/inline$'
,
'inline_discussion'
,
name
=
'inline_discussion'
),
url
(
r'(?P<discussion_id>\w+)$'
,
'forum_form_discussion'
,
name
=
'forum_form_discussion'
),
)
lms/djangoapps/django_comment_client/forum/views.py
View file @
ddce6d8c
...
...
@@ -40,6 +40,12 @@ def render_discussion(request, course_id, threads, discussion_id=None, search_te
}
return
render_to_string
(
'discussion/inline.html'
,
context
)
def
inline_discussion
(
request
,
course_id
,
discussion_id
):
print
"rendering inline"
threads
=
comment_client
.
get_threads
(
discussion_id
,
recursive
=
False
)
html
=
render_discussion
(
request
,
course_id
,
threads
,
discussion_id
)
return
HttpResponse
(
html
,
content_type
=
"text/plain"
)
def
render_search_bar
(
request
,
course_id
,
discussion_id
=
None
,
text
=
''
):
if
not
discussion_id
:
return
''
...
...
@@ -54,10 +60,6 @@ def forum_form_discussion(request, course_id, discussion_id):
course
=
check_course
(
course_id
)
_
,
course_name
,
_
=
course_id
.
split
(
'/'
)
url_course_id
=
course_id
.
replace
(
'/'
,
'_'
)
.
replace
(
'.'
,
'_'
)
search_text
=
request
.
GET
.
get
(
'text'
,
''
)
if
len
(
search_text
)
>
0
:
...
...
@@ -67,9 +69,7 @@ def forum_form_discussion(request, course_id, discussion_id):
context
=
{
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
'COURSE_TITLE'
:
course
.
title
,
'course'
:
course
,
'init'
:
''
,
'content'
:
render_discussion
(
request
,
course_id
,
threads
,
discussion_id
,
search_text
),
'accordion'
:
render_accordion
(
request
,
course
,
discussion_id
),
}
...
...
lms/static/coffee/src/discussion.coffee
View file @
ddce6d8c
...
...
@@ -9,9 +9,13 @@ $ ->
$
(
'#open_close_accordion a'
).
click
@
toggle
$
(
'#accordion'
).
show
()
$
(
".discussion-module"
).
each
(
index
,
elem
)
->
Discussion
.
initializeDiscussionModule
(
elem
)
$
(
"section.discussion"
).
each
(
index
,
discussion
)
->
Discussion
.
bindDiscussionEvents
(
discussion
)
Discussion
.
initializeDiscussion
(
discussion
)
Discussion
.
bindDiscussionEvents
(
discussion
)
generateLocal
=
(
elem
)
->
...
...
@@ -82,12 +86,52 @@ Discussion =
upload
:
"/courses/
#{
$$course_id
}
/discussion/upload"
search
:
"/courses/
#{
$$course_id
}
/discussion/forum/search"
tags_autocomplete
:
"/courses/
#{
$$course_id
}
/discussion/threads/tags/autocomplete"
retrieve_discussion
:
"/courses/
#{
$$course_id
}
/discussion/forum/
#{
param
}
/inline"
}[
name
]
handleAnchorAndReload
:
(
response
)
->
#window.location = window.location.pathname + "#" + response['id']
window
.
location
.
reload
()
initializeDiscussionModule
:
(
elem
)
->
$discussionModule
=
$
(
elem
)
$local
=
generateLocal
(
$discussionModule
)
handleShowDiscussion
=
(
elem
)
->
$elem
=
$
(
elem
)
if
$elem
.
attr
(
"disabled"
)
return
if
not
$local
(
"section.discussion"
).
length
$elem
.
attr
(
"disabled"
,
"disabled"
)
discussion_id
=
$elem
.
attr
(
"discussion_id"
)
url
=
Discussion
.
urlFor
'retrieve_discussion'
,
discussion_id
$
.
ajax
url
:
url
method
:
"GET"
success
:
(
data
,
textStatus
,
xhr
)
->
$discussionModule
.
append
(
data
)
discussion
=
$local
(
"section.discussion"
)
Discussion
.
initializeDiscussion
(
discussion
)
Discussion
.
bindDiscussionEvents
(
discussion
)
$elem
.
removeAttr
(
"disabled"
)
$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
)
initializeDiscussion
:
(
discussion
)
->
initializeVote
=
(
index
,
content
)
->
...
...
@@ -342,8 +386,9 @@ Discussion =
converter
=
Markdown
.
getMathCompatibleConverter
()
$local
(
".content-body"
).
html
(
converter
.
makeHtml
(
raw_text
))
id
=
$content
.
attr
(
"_id"
)
if
not
(
$$annotated_content_info
[
id
]
||
[])[
'editable'
]
$local
(
".discussion-edit"
).
remove
()
if
$$annotated_content_info
?
if
not
(
$$annotated_content_info
[
id
]
||
[])[
'editable'
]
$local
(
".discussion-edit"
).
remove
()
...
...
lms/templates/courseware.html
View file @
ddce6d8c
...
...
@@ -36,6 +36,10 @@
document
.
write
(
'
\
x3Cscript type="text/javascript" src="'
+
document
.
location
.
protocol
+
'//www.youtube.com/player_api">
\
x3C/script>'
);
</script>
<script
type=
"text/javascript"
>
var
$$course_id
=
"${course.id}"
;
</script>
</
%
block>
<
%
include
file=
"course_navigation.html"
args=
"active_page='courseware'"
/>
...
...
lms/templates/discussion/_show_discussion.html
0 → 100644
View file @
ddce6d8c
<div
class=
"discussion-module"
>
<a
class=
"discussion-show control-button"
href=
"javascript:void(0)"
discussion_id=
"${discussion_id}"
>
Show Discussion
</a>
</div>
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