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
3965f912
Commit
3965f912
authored
Feb 07, 2013
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cohort filter almost done
parent
d047d826
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
6 deletions
+54
-6
common/static/coffee/src/discussion/discussion.coffee
+2
-0
common/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
+18
-1
lms/djangoapps/django_comment_client/forum/views.py
+23
-5
lms/templates/discussion/_thread_list_template.html
+11
-0
No files found.
common/static/coffee/src/discussion/discussion.coffee
View file @
3965f912
...
@@ -39,6 +39,8 @@ if Backbone?
...
@@ -39,6 +39,8 @@ if Backbone?
url
=
DiscussionUtil
.
urlFor
'threads'
url
=
DiscussionUtil
.
urlFor
'threads'
when
'followed'
when
'followed'
url
=
DiscussionUtil
.
urlFor
'followed_threads'
,
options
.
user_id
url
=
DiscussionUtil
.
urlFor
'followed_threads'
,
options
.
user_id
if
options
[
'group_id'
]
data
[
'group_id'
]
=
options
[
'group_id'
]
data
[
'sort_key'
]
=
sort_options
.
sort_key
||
'date'
data
[
'sort_key'
]
=
sort_options
.
sort_key
||
'date'
data
[
'sort_order'
]
=
sort_options
.
sort_order
||
'desc'
data
[
'sort_order'
]
=
sort_options
.
sort_order
||
'desc'
DiscussionUtil
.
safeAjax
DiscussionUtil
.
safeAjax
...
...
common/static/coffee/src/discussion/views/discussion_thread_list_view.coffee
View file @
3965f912
...
@@ -9,6 +9,7 @@ if Backbone?
...
@@ -9,6 +9,7 @@ if Backbone?
"click .browse-topic-drop-search-input"
:
"ignoreClick"
"click .browse-topic-drop-search-input"
:
"ignoreClick"
"click .post-list .list-item a"
:
"threadSelected"
"click .post-list .list-item a"
:
"threadSelected"
"click .post-list .more-pages a"
:
"loadMorePages"
"click .post-list .more-pages a"
:
"loadMorePages"
"change .cohort-options"
:
"chooseCohort"
'keyup .browse-topic-drop-search-input'
:
DiscussionFilter
.
filterDrop
'keyup .browse-topic-drop-search-input'
:
DiscussionFilter
.
filterDrop
initialize
:
->
initialize
:
->
...
@@ -128,10 +129,20 @@ if Backbone?
...
@@ -128,10 +129,20 @@ if Backbone?
switch
@
mode
switch
@
mode
when
'search'
when
'search'
options
.
search_text
=
@
current_search
options
.
search_text
=
@
current_search
if
@
group_id
options
.
group_id
=
@
group_id
when
'followed'
when
'followed'
options
.
user_id
=
window
.
user
.
id
options
.
user_id
=
window
.
user
.
id
options
.
group_id
=
"all"
when
'commentables'
when
'commentables'
options
.
commentable_ids
=
@
discussionIds
options
.
commentable_ids
=
@
discussionIds
if
@
group_id
options
.
group_id
=
@
group_id
when
'all'
if
@
group_id
options
.
group_id
=
@
group_id
@
collection
.
retrieveAnotherPage
(
@
mode
,
options
,
{
sort_key
:
@
sortBy
})
@
collection
.
retrieveAnotherPage
(
@
mode
,
options
,
{
sort_key
:
@
sortBy
})
renderThread
:
(
thread
)
=>
renderThread
:
(
thread
)
=>
...
@@ -263,13 +274,19 @@ if Backbone?
...
@@ -263,13 +274,19 @@ if Backbone?
if
discussionId
==
"#all"
if
discussionId
==
"#all"
@
discussionIds
=
""
@
discussionIds
=
""
@
$
(
".post-search-field"
).
val
(
""
)
@
$
(
".post-search-field"
).
val
(
""
)
@
$
(
'.cohort'
).
show
()
@
retrieveAllThreads
()
@
retrieveAllThreads
()
else
if
discussionId
==
"#following"
else
if
discussionId
==
"#following"
@
retrieveFollowed
(
event
)
@
retrieveFollowed
(
event
)
@
$
(
'.cohort'
).
hide
()
else
else
discussionIds
=
_
.
map
item
.
find
(
".board-name[data-discussion_id]"
),
(
board
)
->
$
(
board
).
data
(
"discussion_id"
).
id
discussionIds
=
_
.
map
item
.
find
(
".board-name[data-discussion_id]"
),
(
board
)
->
$
(
board
).
data
(
"discussion_id"
).
id
@
retrieveDiscussions
(
discussionIds
)
@
retrieveDiscussions
(
discussionIds
)
chooseCohort
:
(
event
)
->
@
group_id
=
@
$
(
'.cohort-options :selected'
).
val
()
@
retrieveAllThreads
()
retrieveDiscussion
:
(
discussion_id
,
callback
=
null
)
->
retrieveDiscussion
:
(
discussion_id
,
callback
=
null
)
->
url
=
DiscussionUtil
.
urlFor
(
"retrieve_discussion"
,
discussion_id
)
url
=
DiscussionUtil
.
urlFor
(
"retrieve_discussion"
,
discussion_id
)
DiscussionUtil
.
safeAjax
DiscussionUtil
.
safeAjax
...
...
lms/djangoapps/django_comment_client/forum/views.py
View file @
3965f912
...
@@ -61,13 +61,27 @@ def get_threads(request, course_id, discussion_id=None, per_page=THREADS_PER_PAG
...
@@ -61,13 +61,27 @@ def get_threads(request, course_id, discussion_id=None, per_page=THREADS_PER_PAG
cc_user
.
save
()
cc_user
.
save
()
#if the course-user is cohorted, then add the group id
#there are 2 dimensions to consider when executing a search with respect to group id
group_id
=
get_cohort_id
(
request
.
user
,
course_id
)
#is user a moderator
#did the user request a group
#if you're an instructor, show everything
#if the user requested a group explicitly, give them that group, othewrise, if mod, show all, else if student, use cohort
if
group_id
and
not
cached_has_permission
(
request
.
user
,
"see_all_cohorts"
,
course_id
):
group_id
=
request
.
GET
.
get
(
'group_id'
)
if
group_id
==
"all"
:
group_id
=
None
if
not
group_id
:
if
not
cached_has_permission
(
request
.
user
,
"see_all_cohorts"
,
course_id
):
group_id
=
get_cohort_id
(
request
.
user
,
course_id
)
if
group_id
:
default_query_params
[
"group_id"
]
=
group_id
default_query_params
[
"group_id"
]
=
group_id
#so by default, a moderator sees all items, and a student sees his cohort
query_params
=
merge_dict
(
default_query_params
,
query_params
=
merge_dict
(
default_query_params
,
strip_none
(
extract
(
request
.
GET
,
strip_none
(
extract
(
request
.
GET
,
[
'page'
,
'sort_key'
,
[
'page'
,
'sort_key'
,
...
@@ -76,7 +90,6 @@ def get_threads(request, course_id, discussion_id=None, per_page=THREADS_PER_PAG
...
@@ -76,7 +90,6 @@ def get_threads(request, course_id, discussion_id=None, per_page=THREADS_PER_PAG
threads
,
page
,
num_pages
=
cc
.
Thread
.
search
(
query_params
)
threads
,
page
,
num_pages
=
cc
.
Thread
.
search
(
query_params
)
#now add the group name if the thread has a group id
#now add the group name if the thread has a group id
for
thread
in
threads
:
for
thread
in
threads
:
if
thread
.
get
(
'group_id'
):
if
thread
.
get
(
'group_id'
):
...
@@ -229,6 +242,11 @@ def forum_form_discussion(request, course_id):
...
@@ -229,6 +242,11 @@ def forum_form_discussion(request, course_id):
'is_course_cohorted'
:
is_course_cohorted
(
course_id
)
'is_course_cohorted'
:
is_course_cohorted
(
course_id
)
}
}
# print "start rendering.."
# print "start rendering.."
print
"
\n\n\n\n\n\n
*************************"
print
is_course_cohorted
(
course_id
)
print
cached_has_permission
(
request
.
user
,
"see_all_cohorts"
,
course_id
)
print
cohorts
return
render_to_response
(
'discussion/index.html'
,
context
)
return
render_to_response
(
'discussion/index.html'
,
context
)
...
...
lms/templates/discussion/_thread_list_template.html
View file @
3965f912
...
@@ -18,6 +18,17 @@
...
@@ -18,6 +18,17 @@
<
li
><
a
href
=
"#"
data
-
sort
=
"votes"
>
votes
<
/a></
li
>
<
li
><
a
href
=
"#"
data
-
sort
=
"votes"
>
votes
<
/a></
li
>
<
li
><
a
href
=
"#"
data
-
sort
=
"comments"
>
comments
<
/a></
li
>
<
li
><
a
href
=
"#"
data
-
sort
=
"comments"
>
comments
<
/a></
li
>
<
/ul
>
<
/ul
>
%
if
is_course_cohorted
and
is_moderator
:
<
span
class
=
"group-filter-label cohort"
>
Show
:
<
/span
>
<
select
class
=
"group-filter-select cohort-options cohort"
>
<
option
value
=
"all"
>
All
Groups
<
/option
>
%
for
c
in
cohorts
:
<
option
value
=
"${c.id}"
>
$
{
c
.
name
}
and
public
<
/option
>
%
endfor
<
/select>
%
endif
<
/div
>
<
/div
>
<
div
class
=
"post-list-wrapper"
>
<
div
class
=
"post-list-wrapper"
>
<
ul
class
=
"post-list"
>
<
ul
class
=
"post-list"
>
...
...
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