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
7335c152
Commit
7335c152
authored
Aug 15, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show all content in a course in the forum view
parent
00ff1b94
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
22 deletions
+22
-22
lms/djangoapps/django_comment_client/forum/urls.py
+1
-1
lms/djangoapps/django_comment_client/forum/views.py
+11
-11
lms/lib/comment_client/thread.py
+6
-2
lms/templates/course_navigation.html
+1
-1
lms/templates/discussion/_thread.html
+3
-3
lms/templates/discussion/index.html
+0
-4
No files found.
lms/djangoapps/django_comment_client/forum/urls.py
View file @
7335c152
...
...
@@ -5,5 +5,5 @@ urlpatterns = patterns('django_comment_client.forum.views',
url
(
r'users/(?P<user_id>\w+)$'
,
'user_profile'
,
name
=
'user_profile'
),
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'
),
url
(
r''
,
'forum_form_discussion'
,
name
=
'forum_form_discussion'
),
)
lms/djangoapps/django_comment_client/forum/views.py
View file @
7335c152
...
...
@@ -23,6 +23,10 @@ import dateutil
THREADS_PER_PAGE
=
5
PAGES_NEARBY_DELTA
=
2
def
_general_discussion_id
(
course_id
):
return
course_id
.
replace
(
'/'
,
'_'
)
.
replace
(
'.'
,
'_'
)
def
_should_perform_search
(
request
):
return
bool
(
request
.
GET
.
get
(
'text'
,
False
)
or
\
request
.
GET
.
get
(
'tags'
,
False
))
...
...
@@ -56,7 +60,7 @@ def render_discussion(request, course_id, threads, *args, **kwargs):
base_url
=
{
'inline'
:
(
lambda
:
reverse
(
'django_comment_client.forum.views.inline_discussion'
,
args
=
[
course_id
,
discussion_id
])),
'forum'
:
(
lambda
:
reverse
(
'django_comment_client.forum.views.forum_form_discussion'
,
args
=
[
course_id
,
discussion_id
])),
'forum'
:
(
lambda
:
reverse
(
'django_comment_client.forum.views.forum_form_discussion'
,
args
=
[
course_id
])),
'user'
:
(
lambda
:
reverse
(
'django_comment_client.forum.views.user_profile'
,
args
=
[
course_id
,
user_id
])),
}[
discussion_type
]()
...
...
@@ -92,11 +96,11 @@ def render_forum_discussion(*args, **kwargs):
def
render_user_discussion
(
*
args
,
**
kwargs
):
return
render_discussion
(
discussion_type
=
'user'
,
*
args
,
**
kwargs
)
def
get_threads
(
request
,
course_id
,
discussion_id
):
def
get_threads
(
request
,
course_id
,
discussion_id
=
None
):
query_params
=
{
'page'
:
request
.
GET
.
get
(
'page'
,
1
),
'per_page'
:
THREADS_PER_PAGE
,
#TODO maybe change this later
'sort_key'
:
request
.
GET
.
get
(
'sort_key'
,
'
date
'
),
'sort_key'
:
request
.
GET
.
get
(
'sort_key'
,
'
activity
'
),
'sort_order'
:
request
.
GET
.
get
(
'sort_order'
,
'desc'
),
'text'
:
request
.
GET
.
get
(
'text'
,
''
),
'tags'
:
request
.
GET
.
get
(
'tags'
,
''
),
...
...
@@ -128,22 +132,19 @@ def render_search_bar(request, course_id, discussion_id=None, text=''):
}
return
render_to_string
(
'discussion/_search_bar.html'
,
context
)
def
forum_form_discussion
(
request
,
course_id
,
discussion_id
):
def
forum_form_discussion
(
request
,
course_id
):
course
=
check_course
(
request
.
user
,
course_id
)
threads
,
query_params
=
get_threads
(
request
,
course_id
,
discussion_id
)
content
=
render_forum_discussion
(
request
,
course_id
,
threads
,
discussion_id
=
discussion_id
,
\
query_params
=
query_params
)
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
)
recent_active_threads
=
cc
.
search_recent_active_threads
(
course_id
,
recursive
=
False
,
query_params
=
{
'follower_id'
:
request
.
user
.
id
,
'commentable_id'
:
discussion_id
},
query_params
=
{
'follower_id'
:
request
.
user
.
id
},
)
trending_tags
=
cc
.
search_trending_tags
(
course_id
,
query_params
=
{
'commentable_id'
:
discussion_id
},
)
if
request
.
is_ajax
():
...
...
@@ -153,7 +154,6 @@ def forum_form_discussion(request, course_id, discussion_id):
'csrf'
:
csrf
(
request
)[
'csrf_token'
],
'course'
:
course
,
'content'
:
content
,
'accordion'
:
render_accordion
(
request
,
course
,
discussion_id
),
'recent_active_threads'
:
recent_active_threads
,
'trending_tags'
:
trending_tags
,
}
...
...
lms/lib/comment_client/thread.py
View file @
7335c152
...
...
@@ -35,13 +35,17 @@ class Thread(models.Model):
url
=
cls
.
url
(
action
=
'search'
)
else
:
url
=
cls
.
url
(
action
=
'get_all'
,
params
=
extract
(
params
,
'commentable_id'
))
del
params
[
'commentable_id'
]
if
params
.
get
(
'commentable_id'
):
del
params
[
'commentable_id'
]
response
=
perform_request
(
'get'
,
url
,
params
,
*
args
,
**
kwargs
)
return
response
.
get
(
'collection'
,
[]),
response
.
get
(
'page'
,
1
),
response
.
get
(
'num_pages'
,
1
)
@classmethod
def
url_for_threads
(
cls
,
params
=
{}):
return
"{prefix}/{commentable_id}/threads"
.
format
(
prefix
=
settings
.
PREFIX
,
commentable_id
=
params
[
'commentable_id'
])
if
params
.
get
(
'commentable_id'
):
return
"{prefix}/{commentable_id}/threads"
.
format
(
prefix
=
settings
.
PREFIX
,
commentable_id
=
params
[
'commentable_id'
])
else
:
return
"{prefix}/threads"
.
format
(
prefix
=
settings
.
PREFIX
)
@classmethod
def
url_for_search_threads
(
cls
,
params
=
{}):
...
...
lms/templates/course_navigation.html
View file @
7335c152
...
...
@@ -19,7 +19,7 @@ def url_class(url):
<li
class=
"book"
><a
href=
"${reverse('book', args=[course.id])}"
class=
"${url_class('book')}"
>
Textbook
</a></li>
% endif
% if settings.MITX_FEATURES.get('ENABLE_DISCUSSION_SERVICE'):
<li
class=
"discussion"
><a
href=
"${reverse('django_comment_client.forum.views.forum_form_discussion', args=[course.id
, course.id.replace('/', '_').replace('.', '_')
])}"
class=
"${url_class('discussion')}"
>
Discussion
</a></li>
<li
class=
"discussion"
><a
href=
"${reverse('django_comment_client.forum.views.forum_form_discussion', args=[course.id])}"
class=
"${url_class('discussion')}"
>
Discussion
</a></li>
<li
class=
"news"
><a
href=
"${reverse('news', args=[course.id])}"
class=
"${url_class('news')}"
>
News
</a></li>
% endif
% endif
...
...
lms/templates/discussion/_thread.html
View file @
7335c152
...
...
@@ -44,10 +44,10 @@
<
%
def
name=
"render_content(content, type, **kwargs)"
>
<div
class=
"discussion-content"
>
<div
class=
"discussion-content-wrapper
clearfix
"
>
<div
class=
"discussion-content-wrapper"
>
${render_vote(content)}
<div
class=
"discussion-right-wrapper
clearfix
"
>
<div
class=
"discussion-right-wrapper"
>
<ul
class=
"admin-actions"
>
% if type == 'comment':
<li><a
href=
"javascript:void(0)"
class=
"admin-endorse"
>
Endorse
</a></li>
...
...
@@ -96,7 +96,7 @@
<
%
def
name=
"render_tags(content, type, **kwargs)"
>
<
%
def
url_for_tags
(
tags
)
:
return
reverse
('
django_comment_client
.
forum
.
views
.
forum_form_discussion
',
args=
[course_id
,
content
['
commentable_id
']
])
+
'?'
+
urllib
.
urlencode
({'
tags
'
:
",".
join
(
tags
)})
return
reverse
('
django_comment_client
.
forum
.
views
.
forum_form_discussion
',
args=
[course_id])
+
'?'
+
urllib
.
urlencode
({'
tags
'
:
",".
join
(
tags
)})
%
>
% if type == "thread":
<div
class=
"thread-tags"
>
...
...
lms/templates/discussion/index.html
View file @
7335c152
...
...
@@ -16,10 +16,6 @@
<section
class=
"container"
>
<div
class=
"course-wrapper"
>
<section
aria-label=
"Course Navigation"
class=
"course-index"
>
<header
id=
"open_close_accordion"
>
<h2>
Discussion Boards
</h2>
<a
href=
"#"
>
close
</a>
</header>
<nav>
<article
class=
"sidebar-module discussion-sidebar"
>
...
...
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