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
cc47de51
Commit
cc47de51
authored
Jul 30, 2012
by
Brittany Cheng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:dementrock/mitx into discussion2
parents
a98c505b
24610899
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
22 deletions
+21
-22
lms/djangoapps/django_comment_client/forum/urls.py
+1
-1
lms/djangoapps/django_comment_client/forum/views.py
+8
-10
lms/templates/discussion/thread.html
+5
-4
lms/templates/notifications.html
+7
-7
No files found.
lms/djangoapps/django_comment_client/forum/urls.py
View file @
cc47de51
...
...
@@ -3,6 +3,6 @@ import django_comment_client.forum.views
urlpatterns
=
patterns
(
'django_comment_client.forum.views'
,
url
(
r'search$'
,
'search'
,
name
=
'search'
),
url
(
r'threads/(?P<thread_id>\w+)$'
,
'single_thread'
,
name
=
'single_thread'
),
url
(
r'
(?P<discussion_id>\w+)/
threads/(?P<thread_id>\w+)$'
,
'single_thread'
,
name
=
'single_thread'
),
url
(
r'(?P<discussion_id>\w+)$'
,
'forum_form_discussion'
,
name
=
'forum_form_discussion'
),
)
lms/djangoapps/django_comment_client/forum/views.py
View file @
cc47de51
...
...
@@ -16,7 +16,10 @@ from django_comment_client.utils import get_categorized_discussion_info
import
json
def
render_accordion
(
request
,
course
,
discussion_info
,
discussion_id
):
def
render_accordion
(
request
,
course
,
discussion_id
):
discussion_info
=
get_categorized_discussion_info
(
request
,
course
)
context
=
{
'course'
:
course
,
'discussion_info'
:
discussion_info
,
...
...
@@ -55,8 +58,6 @@ def forum_form_discussion(request, course_id, discussion_id):
url_course_id
=
course_id
.
replace
(
'/'
,
'_'
)
.
replace
(
'.'
,
'_'
)
discussion_info
=
get_categorized_discussion_info
(
request
,
course
)
#request.user, course, course_name, url_course_id)
search_text
=
request
.
GET
.
get
(
'text'
,
''
)
if
len
(
search_text
)
>
0
:
...
...
@@ -70,12 +71,13 @@ def forum_form_discussion(request, course_id, discussion_id):
'course'
:
course
,
'init'
:
''
,
'content'
:
render_discussion
(
request
,
course_id
,
threads
,
discussion_id
,
search_text
),
'accordion'
:
render_accordion
(
request
,
course
,
discussion_i
nfo
,
discussion_i
d
),
'accordion'
:
render_accordion
(
request
,
course
,
discussion_id
),
}
return
render_to_response
(
'discussion/index.html'
,
context
)
def
render_single_thread
(
request
,
course_id
,
thread_id
):
context
=
{
'thread'
:
comment_client
.
get_thread
(
thread_id
,
recursive
=
True
),
'user_info'
:
comment_client
.
get_user_info
(
request
.
user
.
id
,
raw
=
True
),
...
...
@@ -84,7 +86,7 @@ def render_single_thread(request, course_id, thread_id):
}
return
render_to_string
(
'discussion/single_thread.html'
,
context
)
def
single_thread
(
request
,
course_id
,
thread_id
):
def
single_thread
(
request
,
course_id
,
discussion_id
,
thread_id
):
course
=
check_course
(
course_id
)
...
...
@@ -92,7 +94,7 @@ def single_thread(request, course_id, thread_id):
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
'init'
:
''
,
'content'
:
render_single_thread
(
request
,
course_id
,
thread_id
),
'accordion'
:
''
,
'accordion'
:
render_accordion
(
request
,
course
,
discussion_id
)
,
'course'
:
course
,
}
...
...
@@ -106,10 +108,6 @@ def search(request, course_id):
commentable_id
=
request
.
GET
.
get
(
'commentable_id'
,
None
)
tags
=
request
.
GET
.
get
(
'tags'
,
None
)
print
text
print
commentable_id
print
tags
threads
=
comment_client
.
search_threads
({
'text'
:
text
,
'commentable_id'
:
commentable_id
,
...
...
lms/templates/discussion/thread.html
View file @
cc47de51
...
...
@@ -44,10 +44,11 @@
<
%
def
name=
"render_title(content, type, **kwargs)"
>
<
%
if
kwargs
.
get
('
show_comments
',
False
)
:
url_for_thread =
""
else:
url_for_thread =
reverse('django_comment_client.forum.views.single_thread',
args=
[course_id,
content
['
id
']])
if
type =
=
"
thread
"
:
if
kwargs
.
get
('
show_comments
',
False
)
:
url_for_thread =
""
else:
url_for_thread =
reverse('django_comment_client.forum.views.single_thread',
args=
[course_id,
content
['
commentable_id
'],
content
['
id
']])
%
>
% if type == "thread":
<a
class=
"thread-title"
name=
"${content['id']}"
href=
"${url_for_thread}"
>
${content['title'] | h}
</a>
...
...
lms/templates/notifications.html
View file @
cc47de51
<
%!
from
django
.
core
.
urlresolvers
import
reverse
%
>
<
%
def
url_for_thread
(
thread_id
)
:
return
reverse
('
django_comment_client
.
forum
.
views
.
single_thread
',
args=
[course.id,
thread_id
])
def
url_for_thread
(
discussion_id
,
thread_id
)
:
return
reverse
('
django_comment_client
.
forum
.
views
.
single_thread
',
args=
[course.id,
discussion_id
,
thread_id
])
%
>
<
%
def
url_for_comment
(
thread_id
,
comment_id
)
:
return
reverse
('
django_comment_client
.
forum
.
views
.
single_thread
',
args=
[course.id,
thread_id
]
)
+
"#"
+
comment_id
def
url_for_comment
(
discussion_id
,
thread_id
,
comment_id
)
:
return
url_for_thread
(
discussion_id
,
thread_id
)
+
"#"
+
comment_id
%
>
<
%
...
...
@@ -32,14 +32,14 @@ def discussion_title(discussion_id):
<
%
info =
notification['info']
%
>
% if notification['notification_type'] == 'post_reply':
User No.${notification['actor_id']} posted a
<a
href=
"${url_for_comment(info['thread_id'], info['comment_id'])}"
>
comment
</a>
<a
href=
"${url_for_comment(info['
commentable_id', info['
thread_id'], info['comment_id'])}"
>
comment
</a>
to the thread
<a
href=
"${url_for_thread(info['thread_id'])}"
>
${info['thread_title']}
</a>
<a
href=
"${url_for_thread(info['
commentable_id'], info['
thread_id'])}"
>
${info['thread_title']}
</a>
in discussion
<a
href=
"${url_for_discussion(info['commentable_id'])}"
>
${discussion_title(info['commentable_id'])}
</a>
% elif notification['notification_type'] == 'post_topic':
User No.${notification['actor_id']} posted a new thread
<a
href=
"${url_for_thread(info['thread_id'])}"
>
${info['thread_title']}
</a>
<a
href=
"${url_for_thread(info['
commentable_id'], info['
thread_id'])}"
>
${info['thread_title']}
</a>
in discussion
<a
href=
"${url_for_discussion(info['commentable_id'])}"
>
${discussion_title(info['commentable_id'])}
</a>
% endif
...
...
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